nvim: init.vim: Use vim-unimpaired & improve bindings
unimpaired provides some helpful bindings so use that. Remove redundant bindings like the ones for quickfix & location list due to use of unimpaired. It also provides consistent bindings across the board. While at it, reduce the use of leader key. The idea behind using leader key everywhere was taken since we migrated from spacemacs, However, for non-conflicting bindings it's better to have a hit as few keys as possible, so remove leader from few of the earlier bindings. To see list of all mappings, use '9verbose nmap <key>'. Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
parent
df07def242
commit
4ebc8f3788
1 changed files with 46 additions and 55 deletions
101
nvim/init.vim
101
nvim/init.vim
|
@ -89,6 +89,7 @@ Plug 'tpope/vim-surround'
|
||||||
Plug 'tpope/vim-repeat'
|
Plug 'tpope/vim-repeat'
|
||||||
Plug 'tpope/vim-eunuch'
|
Plug 'tpope/vim-eunuch'
|
||||||
Plug 'tpope/vim-sleuth'
|
Plug 'tpope/vim-sleuth'
|
||||||
|
Plug 'tpope/vim-unimpaired'
|
||||||
Plug 'editorconfig/editorconfig-vim'
|
Plug 'editorconfig/editorconfig-vim'
|
||||||
Plug 'igankevich/mesonic'
|
Plug 'igankevich/mesonic'
|
||||||
Plug 'stefandtw/quickfix-reflector.vim'
|
Plug 'stefandtw/quickfix-reflector.vim'
|
||||||
|
@ -206,23 +207,23 @@ nnoremap ; :
|
||||||
nnoremap Q <Nop>
|
nnoremap Q <Nop>
|
||||||
|
|
||||||
" For Fuzzy
|
" For Fuzzy
|
||||||
nnoremap <Leader>vf :GFiles<CR>
|
nnoremap ff :GFiles<CR>
|
||||||
nnoremap <Leader>v? :GFiles?<CR>
|
nnoremap f? :GFiles?<CR>
|
||||||
nnoremap <Leader>vF :Files<CR>
|
nnoremap fF :Files<CR>
|
||||||
nnoremap <Leader>vb :Buffers<CR>
|
nnoremap fb :Buffers<CR>
|
||||||
nnoremap <Leader>vL :Lines<CR>
|
nnoremap fL :Lines<CR>
|
||||||
nnoremap <Leader>vl :BLines<CR>
|
nnoremap fl :BLines<CR>
|
||||||
nnoremap <Leader>vt :BTags<CR>
|
nnoremap ft :BTags<CR>
|
||||||
nnoremap <Leader>vT :Tags<CR>
|
nnoremap fT :Tags<CR>
|
||||||
nnoremap <Leader>vc :BCommits<CR>
|
nnoremap fc :BCommits<CR>
|
||||||
nnoremap <Leader>vC :Commits<CR>
|
nnoremap fC :Commits<CR>
|
||||||
nnoremap <Leader>vch :History:<CR>
|
nnoremap fch :History:<CR>
|
||||||
nnoremap <Leader>vsh :History/<CR>
|
nnoremap fsh :History/<CR>
|
||||||
nnoremap <Leader>vm :Commands<CR>
|
nnoremap fm :Commands<CR>
|
||||||
nnoremap <Leader>vo :Locate<SPACE>
|
nnoremap fo :Locate<SPACE>
|
||||||
nnoremap <Leader>vk :Maps<CR>
|
nnoremap fk :Maps<CR>
|
||||||
nnoremap <Leader>v/ :Rg<CR>
|
nnoremap f/ :Rg<CR>
|
||||||
nnoremap <Leader>* :exe ':Rg ' . expand('<cword>')<CR>
|
nnoremap * :exe ':Rg ' . expand('<cword>')<CR>
|
||||||
" Quick buffer switching
|
" Quick buffer switching
|
||||||
nnoremap <Leader>b :ls<CR>:b<Space>
|
nnoremap <Leader>b :ls<CR>:b<Space>
|
||||||
" Undo tree
|
" Undo tree
|
||||||
|
@ -236,19 +237,15 @@ nnoremap <Leader>sh <Esc>:sp<CR>
|
||||||
nnoremap <Leader>sv <Esc>:vsp<CR>
|
nnoremap <Leader>sv <Esc>:vsp<CR>
|
||||||
" Quit
|
" Quit
|
||||||
nnoremap <Leader>x <Esc>:x<CR>
|
nnoremap <Leader>x <Esc>:x<CR>
|
||||||
|
nnoremap <Leader>q <Esc>:q<CR>
|
||||||
nnoremap <Leader>Q <Esc>:qa<CR>
|
nnoremap <Leader>Q <Esc>:qa<CR>
|
||||||
" Terminal
|
" Terminal
|
||||||
nnoremap <Leader>te :vsp<CR> :terminal<CR>
|
nnoremap <Leader>te :vsp<CR> :terminal<CR>
|
||||||
nnoremap <Leader>tc :SlimeConfig<CR>
|
nnoremap <Leader>tc :SlimeConfig<CR>
|
||||||
xmap <Leader>ts <Plug>SlimeRegionSend
|
xmap <Leader>ts <Plug>SlimeRegionSend
|
||||||
nmap <Leader>ts <Plug>SlimeParagraphSend
|
nmap <Leader>ts <Plug>SlimeParagraphSend
|
||||||
" Tab navigation shortcuts
|
|
||||||
nnoremap <Leader>tn :bn<CR>
|
|
||||||
nnoremap <Leader>tp :bp<CR>
|
|
||||||
nnoremap <PageUp> :bprevious<CR>
|
|
||||||
nnoremap <PageDown> :bnext<CR>
|
|
||||||
" Reload opened vim config file
|
" Reload opened vim config file
|
||||||
nnoremap <Leader>vr :so %<CR>
|
nnoremap <Leader>r :so %<CR>
|
||||||
" For git
|
" For git
|
||||||
nnoremap <Leader>gm :GitMessenger<CR>
|
nnoremap <Leader>gm :GitMessenger<CR>
|
||||||
nnoremap <Leader>gl :0Glog<CR>
|
nnoremap <Leader>gl :0Glog<CR>
|
||||||
|
@ -269,38 +266,32 @@ nnoremap <Leader>gf :exe ':Ggrep ' . expand('<cword>')<CR>
|
||||||
nnoremap <Leader>gF :Ggrep<SPACE>
|
nnoremap <Leader>gF :Ggrep<SPACE>
|
||||||
nnoremap <Leader>gg :GGrep<SPACE>
|
nnoremap <Leader>gg :GGrep<SPACE>
|
||||||
" For gitgutter
|
" For gitgutter
|
||||||
nnoremap <Leader>ghn :GitGutterNextHunk<CR>
|
nnoremap un :GitGutterNextHunk<CR>
|
||||||
nnoremap <Leader>ghp :GitGutterPrevHunk<CR>
|
nnoremap up :GitGutterPrevHunk<CR>
|
||||||
nnoremap <Leader>ghs :GitGutterStageHunk<CR>
|
nnoremap us :GitGutterStageHunk<CR>
|
||||||
nnoremap <Leader>ghu :GitGutterUndoHunk<CR>
|
nnoremap ud :GitGutterUndoHunk<CR>
|
||||||
nnoremap <Leader>ghr :GitGutterPreviewHunk<CR>
|
nnoremap ur :GitGutterPreviewHunk<CR>
|
||||||
nnoremap <Leader>gqf :GitGutterQuickFix<CR>
|
nnoremap uq :GitGutterQuickFix<CR>
|
||||||
nnoremap <Leader>ggf :GitGutterFold<CR>
|
nnoremap uf :GitGutterFold<CR>
|
||||||
" For Neomake/Neoformat
|
" For Neomake/Neoformat
|
||||||
nnoremap <Leader>nm :Neomake<CR>
|
nnoremap nm :Neomake<CR>
|
||||||
nnoremap <Leader>nc :NeomakeClean<CR>
|
nnoremap nc :NeomakeClean<CR>
|
||||||
nnoremap <Leader>ns :NeomakeSh<SPACE>
|
nnoremap ns :NeomakeSh<SPACE>
|
||||||
nnoremap <Leader>njl :NeomakeListJobs<CR>
|
nnoremap njl :NeomakeListJobs<CR>
|
||||||
nnoremap <Leader>nja :NeomakeCancelJobs<CR>
|
nnoremap nja :NeomakeCancelJobs<CR>
|
||||||
nnoremap <Leader>njc :NeomakeCancelJob<SPACE>
|
nnoremap njc :NeomakeCancelJob<SPACE>
|
||||||
nnoremap <Leader>nf :Neoformat<CR>
|
nnoremap nf :Neoformat<CR>
|
||||||
" For workspace
|
" For workspace
|
||||||
nnoremap <Leader>sw :ToggleWorkspace<CR>
|
nnoremap <Leader>sw :ToggleWorkspace<CR>
|
||||||
|
|
||||||
" Quickfix & Location list mappings
|
" Quickfix & Location list mappings
|
||||||
nnoremap <Leader>fn :cnext<CR>
|
nnoremap qo :copen<CR>
|
||||||
nnoremap <Leader>fp :cprevious<CR>
|
nnoremap qc :cclose<CR>
|
||||||
nnoremap <Leader>fo :copen<CR>
|
nnoremap qs :vimgrep<SPACE>
|
||||||
nnoremap <Leader>fc :cclose<CR>
|
nnoremap qt :call ToggleQuickfixList()<CR>
|
||||||
nnoremap <Leader>fs :vimgrep<SPACE>
|
nnoremap Lo :lopen<CR>
|
||||||
nnoremap <Leader>ft :call ToggleQuickfixList()<CR>
|
nnoremap Lc :lclose<CR>
|
||||||
|
nnoremap Ls :lvimgrep<SPACE>
|
||||||
nnoremap <Leader>ffn :lnext<CR>
|
nnoremap Lt :call ToggleLocationList()<CR>
|
||||||
nnoremap <Leader>ffp :lprevious<CR>
|
|
||||||
nnoremap <Leader>ffo :lopen<CR>
|
|
||||||
nnoremap <Leader>ffc :lclose<CR>
|
|
||||||
nnoremap <Leader>ffs :lvimgrep<SPACE>
|
|
||||||
nnoremap <Leader>fft :call ToggleLocationList()<CR>
|
|
||||||
|
|
||||||
" Key Bindings to help with terminal mode
|
" Key Bindings to help with terminal mode
|
||||||
:tnoremap jk <C-\><C-n>
|
:tnoremap jk <C-\><C-n>
|
||||||
|
@ -362,9 +353,9 @@ command! -bang -nargs=* GGrep
|
||||||
" --------------------------- Autocmd groups ---------------------------------
|
" --------------------------- Autocmd groups ---------------------------------
|
||||||
augroup vimplug_maps
|
augroup vimplug_maps
|
||||||
au!
|
au!
|
||||||
au FileType vim nmap <Leader>pg :PlugUpgrade<CR>
|
au FileType vim nmap pg :PlugUpgrade<CR>
|
||||||
au FileType vim nmap <Leader>pd :PlugUpdate<CR>
|
au FileType vim nmap pd :PlugUpdate<CR>
|
||||||
au FileType vim nmap <Leader>pc :PlugClean<CR>
|
au FileType vim nmap pc :PlugClean<CR>
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup haskell_maps
|
augroup haskell_maps
|
||||||
|
@ -427,7 +418,7 @@ augroup rust_maps
|
||||||
au FileType rust nmap <buffer> gd <plug>DeopleteRustGoToDefinitionDefault
|
au FileType rust nmap <buffer> gd <plug>DeopleteRustGoToDefinitionDefault
|
||||||
au FileType rust nmap <buffer> K <plug>DeopleteRustShowDocumentation
|
au FileType rust nmap <buffer> K <plug>DeopleteRustShowDocumentation
|
||||||
au FileType rust nmap <buffer> gv <plug>DeopleteRustGoToDefinitionVSplit
|
au FileType rust nmap <buffer> gv <plug>DeopleteRustGoToDefinitionVSplit
|
||||||
au FileType rust nmap <buffer> gh <plug>DeopleteRustGoToDefinitionSplit
|
au FileType rust nmap <buffer> g- <plug>DeopleteRustGoToDefinitionSplit
|
||||||
au FileType rust nmap <buffer> gt <plug>DeopleteRustGoToDefinitionTab
|
au FileType rust nmap <buffer> gt <plug>DeopleteRustGoToDefinitionTab
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue