X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=vim%2F.vim%2Fplugin%2Flsp.vim;h=a342e3cfe3398e2a0075bc5fe5edd49b29dbccc3;hb=HEAD;hp=ad6d0a51b508aece1db2fe11e8b7399ac4b75bed;hpb=52bdc1b0d0e1ed7c936d0b20913a877c521d0e5e;p=dotfiles.git diff --git a/vim/.vim/plugin/lsp.vim b/vim/.vim/plugin/lsp.vim index ad6d0a5..a342e3c 100644 --- a/vim/.vim/plugin/lsp.vim +++ b/vim/.vim/plugin/lsp.vim @@ -1,16 +1,18 @@ vim9script # go get golang.org/x/tools/gopls@latest -# pip install 'python-language-server[all]' +# pip install "python-language-server[all]" -var lspServers = [ +var lspServers: list> + +for d in [ { - filetype: ["c", "cpp"], + filetype: ["c", "ch", "cpp"], path: "clangd", args: ["--log=error"], }, { - filetype: ["go"], + filetype: ["go", "gomod"], path: "gopls", syncInit: true, }, @@ -24,18 +26,32 @@ var lspServers = [ mccabe: {enabled: false}, }, }}, - } + }, ] + if executable(d["path"]) + add(lspServers, d) + endif +endfor + var lspOpts = { ignoreMissingServer: true, autoComplete: false, + autoHighlight: true, autoPopulateDiags: true, - showInlayHints: true, + + # Lint warning only on status line, do not show near cursor + showDiagInPopup: false, + showDiagOnStatusLine: true, + showSignature: false, } +set omnifunc=g:LspOmniFunc autocmd VimEnter * call LspAddServer(lspServers) autocmd VimEnter * call LspOptionsSet(lspOpts) +autocmd CursorMoved * silent! LspDiagCurrent nmap gd :LspGotoDefinition nmap gd :vert LspGotoDefinition nmap :lopen +nmap [l :LspDiagPrev +nmap ]l :LspDiagNext