forked from mpkopec/nvim-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic-maps.vim
More file actions
46 lines (36 loc) · 1.57 KB
/
Copy pathbasic-maps.vim
File metadata and controls
46 lines (36 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
" Split navigation
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Better fold toggling
nnoremap <space> za
" Replace Ctrl-n, Ctrl-p with Ctrl-j and Ctrl-k
" TODO After installing a proper completion engine, this needs to be reverted
inoremap <expr><C-j> pumvisible() ? "\<C-n>" : "\<C-x><C-n>"
inoremap <expr><C-k> pumvisible() ? "\<C-p>" : "\<C-x><C-p>"
inoremap <expr><C-l> pumvisible() ? "\<C-y>" : "\<C-l>"
" Moving lines and groups of them
nnoremap <silent> <A-u> :m .+1<CR>
inoremap <silent> <A-u> <Esc>:m .+1<CR>gi
vnoremap <silent> <A-u> :m '>+1<CR>gv
nnoremap <silent> <A-i> :m .-2<CR>
inoremap <silent> <A-i> <Esc>:m .-2<CR>gi
vnoremap <silent> <A-i> :m '<-2<CR>gv
" Consume mouse-button events in visual mode without acting on them — see
" mouse=nv comment in basic-settings.vim for the full rationale.
vnoremap <LeftMouse> <nop>
vnoremap <LeftRelease> <nop>
" Better jk navigation with soft-wrapped lines and jump list for count > 1
nnoremap <expr> k v:count == 0 ? 'gk' : v:count > 1 ? "m'".v:count.'k' : v:count.'k'
nnoremap <expr> j v:count == 0 ? 'gj' : v:count > 1 ? "m'".v:count.'j' : v:count.'j'
" Remove trailing whitespace
nnoremap ,ts mm:%s/\s\+$//<cr>:noh<cr>`m
" Highlight but not jump
nnoremap * :keepjumps normal! mi*`i<CR>
" For verilog state machines sequential logic
vnoremap ,rtn :s/\(\s\+\)\(\(\w\+\)_reg\)\(\s\+\)<=\(\s\+\)\w\+;/\1\2\4<=\5\3_next;<CR>
" Make a scratchpad buffer and open it
nnoremap ,s :enew<CR>:setlocal buftype=nofile bufhidden=hide noswapfile<CR>
" Exit terminal mode
tnoremap <A-n> <C-\><C-n>