vim: More usage LanguageClient

This commit is contained in:
Mathieu Maret 2020-12-17 15:49:59 +01:00
parent 38f1c62a4d
commit 95bd07aa10
1 changed files with 19 additions and 1 deletions

20
.vimrc
View File

@ -350,6 +350,8 @@ function Help()
try
if exists('b:current_syntax') && b:current_syntax == "python"
:call ShowPyDoc(expand("<cword>"), 1)
elseif has_key(g:LanguageClient_serverCommands, &filetype)
:call LanguageClient#textDocument_hover()
else
execute "Man " . expand("<cword>")
endif
@ -591,7 +593,23 @@ nnoremap <silent> <leader>O :FZF!<CR>
if v:version >= 800
" Async lint
Plugin 'w0rp/ale'
"Plugin 'w0rp/ale'
Plugin 'autozimu/LanguageClient-neovim', {
\ 'oninstall': 'bash install.sh',
\ }
let g:LanguageClient_serverCommands = {
\ 'cpp': ['clangd', '-background-index',],
\ 'c': ['clangd', '-background-index',],
\ }
function LC_maps()
if has_key(g:LanguageClient_serverCommands, &filetype)
nmap <buffer> <silent> K <Plug>(lcn-hover)
nmap <buffer> <silent> gd <Plug>(lcn-definition)
nmap <buffer> <silent> cr <Plug>(lcn-rename)
endif
endfunction
autocmd FileType * call LC_maps()
else
"Syntax checking | Install flake8 or pylint for python
" Install shellcheck for bash