diff options
Diffstat (limited to 'nvim/.config/nvim/plugin/maps.vim')
-rw-r--r-- | nvim/.config/nvim/plugin/maps.vim | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/nvim/.config/nvim/plugin/maps.vim b/nvim/.config/nvim/plugin/maps.vim new file mode 100644 index 0000000..55990d2 --- /dev/null +++ b/nvim/.config/nvim/plugin/maps.vim | |||
@@ -0,0 +1,78 @@ | |||
1 | mapclear | ||
2 | |||
3 | let mapleader=' ' | ||
4 | |||
5 | " clipboard | ||
6 | map <leader>cc :w !xclip -sel c<CR> | ||
7 | |||
8 | " normal | ||
9 | nnoremap <Leader>o : only<cr> | ||
10 | " nnoremap <Leader>l : Lines<cr> | ||
11 | nnoremap <Leader>b : Buffers<cr> | ||
12 | nnoremap <Leader>n : bnext<cr> | ||
13 | nnoremap <Leader>p : bprev<cr> | ||
14 | nnoremap <Leader>z : FZF<cr> | ||
15 | nnoremap <Leader>l : Lines<cr> | ||
16 | nnoremap <Leader>w : MtaJumpToOtherTag<cr> | ||
17 | nnoremap <Leader>t : call GetTabber()<cr> | ||
18 | nnoremap <Leader><ESC> : nohlsearch<cr> | ||
19 | nnoremap <C-l> :nohlsearch<cr>:diffupdate<cr>:syntax sync fromstart<cr><c-l> | ||
20 | nnoremap H H:exec 'norm! '. &scrolloff . 'k'<cr> | ||
21 | nnoremap L L:exec 'norm! '. &scrolloff . 'j'<cr> | ||
22 | nnoremap <expr> gb '`[' . strpart(getregtype(), 0, 1) . '`]' | ||
23 | |||
24 | |||
25 | nnoremap <F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' | ||
26 | \ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" | ||
27 | \ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR> | ||
28 | |||
29 | cmap w!! %!sudo tee > /dev/null % | ||
30 | |||
31 | " visual | ||
32 | vnoremap > >gv | ||
33 | vnoremap < <gv | ||
34 | |||
35 | " operator-pending | ||
36 | onoremap ax a` | ||
37 | onoremap ix i` | ||
38 | |||
39 | " visual block | ||
40 | xnoremap + g<C-a> | ||
41 | xnoremap - g<C-x> | ||
42 | |||
43 | " COC keymaps | ||
44 | inoremap <silent><expr> <TAB> | ||
45 | \ pumvisible() ? "\<C-n>" : | ||
46 | \ <SID>check_back_space() ? "\<TAB>" : | ||
47 | \ coc#refresh() | ||
48 | inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" | ||
49 | |||
50 | function! s:check_back_space() abort | ||
51 | let col = col('.') - 1 | ||
52 | return !col || getline('.')[col - 1] =~# '\s' | ||
53 | endfunction | ||
54 | |||
55 | inoremap <silent><expr> <c-space> coc#refresh() | ||
56 | |||
57 | inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | ||
58 | |||
59 | nmap <silent> [g <Plug>(coc-diagnostic-prev) | ||
60 | nmap <silent> ]g <Plug>(coc-diagnostic-next) | ||
61 | nmap <silent> gd <Plug>(coc-definition) | ||
62 | nmap <silent> gy <Plug>(coc-type-definition) | ||
63 | nmap <silent> gr <Plug>(coc-references) | ||
64 | |||
65 | nnoremap <silent> K :call <SID>show_documentation()<CR> | ||
66 | |||
67 | function! s:show_documentation() | ||
68 | if (index(['vim','help'], &filetype) >= 0) | ||
69 | execute 'h '.expand('<cword>') | ||
70 | else | ||
71 | call CocAction('doHover') | ||
72 | endif | ||
73 | endfunction | ||
74 | |||
75 | nmap <leader>rn <Plug>(coc-rename) | ||
76 | |||
77 | xmap <leader>f <Plug>(coc-format-selected) | ||
78 | nmap <leader>f <Plug>(coc-format-selected) | ||