nvim: init.vim: Group key bindings as per filetype

This commit is contained in:
Sanchayan Maity 2019-12-05 14:25:46 +05:30 committed by Sanchayan Maity
parent 47739fc256
commit 3036a0300a

View file

@ -255,10 +255,6 @@ nnoremap <Leader>ghu :GitGutterUndoHunk<CR>
nnoremap <Leader>ghr :GitGutterPreviewHunk<CR>
nnoremap <Leader>gqf :GitGutterQuickFix<CR>
nnoremap <Leader>ggf :GitGutterFold<CR>
" For Cscope & tags
nnoremap <Leader>ct :NeomakeSh ctags -R .<CR>
nnoremap <Leader>cu :NeomakeSh cscope -bqR<CR>
nnoremap <Leader>cr :cs reset<CR>
" For Neomake
nnoremap <Leader>nm :Neomake<CR>
nnoremap <Leader>nc :NeomakeClean<CR>
@ -269,16 +265,6 @@ nnoremap <Leader>njc :NeomakeCancelJob<SPACE>
" For workspace
nnoremap <Leader>sw :ToggleWorkspace<CR>
" Haskell specific
nnoremap <Leader>ht :NeomakeSh stack exec -- fast-tags -R .<CR>
" For ghcid
nnoremap <Leader>hg :Ghcid<CR>
nnoremap <Leader>hk :GhcidKill<CR>
" For Hoogle
nnoremap <Leader>hc :HoogleClose<CR>
nnoremap <Leader>ho :exe ':Hoogle ' . expand('<cword>')<CR>
nnoremap <Leader>hi :exe ':HoogleInfo ' . expand('<cword>')<CR>
" Quickfix & Location list mappings
nnoremap <Leader>fn :cnext<CR>
nnoremap <Leader>fp :cprevious<CR>
@ -309,32 +295,48 @@ noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
nnoremap <silent> <Leader>ss :call Cscope("s", expand('<cword>'))<CR>
nnoremap <silent> <Leader>sg :call Cscope("g", expand('<cword>'))<CR>
nnoremap <silent> <Leader>sd :call Cscope("d", expand('<cword>'))<CR>
nnoremap <silent> <Leader>sc :call Cscope("c", expand('<cword>'))<CR>
nnoremap <silent> <Leader>st :call Cscope("t", expand('<cword>'))<CR>
nnoremap <silent> <Leader>se :call Cscope("e", expand('<cword>'))<CR>
nnoremap <silent> <Leader>sf :call Cscope("f", expand('<cword>'))<CR>
nnoremap <silent> <Leader>si :call Cscope("i", expand('<cword>'))<CR>
nnoremap <silent> <Leader>sa :call Cscope("a", expand('<cword>'))<CR>
nnoremap <silent> <Leader><Leader>ss :call CscopeQuery("s")<CR>
nnoremap <silent> <Leader><Leader>sg :call CscopeQuery("g")<CR>
nnoremap <silent> <Leader><Leader>sd :call CscopeQuery("d")<CR>
nnoremap <silent> <Leader><Leader>sc :call CscopeQuery("c")<CR>
nnoremap <silent> <Leader><Leader>st :call CscopeQuery("t")<CR>
nnoremap <silent> <Leader><Leader>se :call CscopeQuery("e")<CR>
nnoremap <silent> <Leader><Leader>sf :call CscopeQuery("f")<CR>
nnoremap <silent> <Leader><Leader>si :call CscopeQuery("i")<CR>
nnoremap <silent> <Leader><Leader>sa :call CscopeQuery("a")<CR>
nnoremap <silent> <Leader> :<C-U>WhichKey '<Space>'<CR>
" --------------------------- Autocmd groups ---------------------------------
augroup HaskellMaps
au!
au FileType haskell nmap <Leader>ht :NeomakeSh stack exec -- fast-tags -R .<CR>
au FileType haskell nmap <Leader>hg :Ghcid<CR>
au FileType haskell nmap <Leader>hk :GhcidKill<CR>
au FileType haskell nmap <Leader>hc :HoogleClose<CR>
au FileType haskell nmap <Leader>ho :exe ':Hoogle ' . expand('<cword>')<CR>
au FileType haskell nmap <Leader>hi :exe ':HoogleInfo ' . expand('<cword>')<CR>
augroup END
augroup CMaps
au!
au FileType c nmap <Leader>ct :NeomakeSh ctags -R .<CR>
au FileType c nmap <Leader>cu :NeomakeSh cscope -bqR<CR>
au FileType c nmap <Leader>cr :cs reset<CR>
au FileType c nmap <silent> <Leader>ss :call Cscope("s", expand('<cword>'))<CR>
au FileType c nmap <silent> <Leader>sg :call Cscope("g", expand('<cword>'))<CR>
au FileType c nmap <silent> <Leader>sd :call Cscope("d", expand('<cword>'))<CR>
au FileType c nmap <silent> <Leader>sc :call Cscope("c", expand('<cword>'))<CR>
au FileType c nmap <silent> <Leader>st :call Cscope("t", expand('<cword>'))<CR>
au FileType c nmap <silent> <Leader>se :call Cscope("e", expand('<cword>'))<CR>
au FileType c nmap <silent> <Leader>sf :call Cscope("f", expand('<cword>'))<CR>
au FileType c nmap <silent> <Leader>si :call Cscope("i", expand('<cword>'))<CR>
au FileType c nmap <silent> <Leader>sa :call Cscope("a", expand('<cword>'))<CR>
au FileType c nmap <silent> <Leader><Leader>ss :call CscopeQuery("s")<CR>
au FileType c nmap <silent> <Leader><Leader>sg :call CscopeQuery("g")<CR>
au FileType c nmap <silent> <Leader><Leader>sd :call CscopeQuery("d")<CR>
au FileType c nmap <silent> <Leader><Leader>sc :call CscopeQuery("c")<CR>
au FileType c nmap <silent> <Leader><Leader>st :call CscopeQuery("t")<CR>
au FileType c nmap <silent> <Leader><Leader>se :call CscopeQuery("e")<CR>
au FileType c nmap <silent> <Leader><Leader>sf :call CscopeQuery("f")<CR>
au FileType c nmap <silent> <Leader><Leader>si :call CscopeQuery("i")<CR>
au FileType c nmap <silent> <Leader><Leader>sa :call CscopeQuery("a")<CR>
augroup END
augroup deopleteMaps
au!
" For deoplete Rust
au FileType rust nmap <buffer> <Leader>rd <plug>DeopleteRustGoToDefinitionDefault
au FileType rust nmap <buffer> <Leader>rc <plug>DeopleteRustShowDocumentation
au FileType rust nmap <buffer> <Leader>rv <plug>DeopleteRustGoToDefinitionVSplit