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