nvim: Set up LC bindings only if it is started

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
Sanchayan Maity 2020-02-09 19:13:00 +05:30
parent 46364f42e3
commit d259c571bb

View file

@ -394,6 +394,7 @@ augroup haskell_maps
" https://github.com/maxigit/vimrc/tree/2020/compiler
au FileType haskell compiler stack
au FileType haskell setlocal makeprg=stack\ build
au FileType haskell setlocal keywordprg=:Hoogle
au FileType haskell nmap <LocalLeader>b :Neomake!<CR>
au FileType haskell nmap <LocalLeader>t :NeomakeSh stack exec -- hasktags -x -c .<CR>
au FileType haskell nmap <LocalLeader>g :Ghcid<CR>
@ -498,7 +499,9 @@ augroup END
augroup LSP
au!
autocmd FileType haskell,rust,python :call SetLspKeybindings()
nnoremap <LocalLeader>cs :LanguageClientStart<CR>
nnoremap <LocalLeader>ch :LanguageClientStop<CR>
autocmd User LanguageClientStarted :call SetLspKeybindings()
augroup END
" --------------------------- Plugin settings --------------------------------
@ -737,8 +740,6 @@ function! SetLspKeybindings()
nnoremap K :call LanguageClient#textDocument_hover()<CR>
nnoremap ge :call LanguageClient#explainErrorAtPoint()<CR>
nnoremap <LocalLeader>cs :LanguageClientStart<CR>
nnoremap <LocalLeader>ch :LanguageClientStop<CR>
nnoremap <LocalLeader>cm :call LanguageClient_contextMenu()<CR>
nnoremap <LocalLeader>td :call LanguageClient#textDocument_typeDefinition()<CR>
nnoremap <LocalLeader>di :call LanguageClient#textDocument_implementation()<CR>