X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=vim%2F.vim%2Fplugin%2Flsp.vim;h=4ced7caebfee7e039d94faba77076822b6d014e3;hb=HEAD;hp=c5e1c90ac8b51cc098c98925560e42a927275523;hpb=332316f0d9ab39aa5f8365962ba2f7c785f0edd4;p=dotfiles.git diff --git a/vim/.vim/plugin/lsp.vim b/vim/.vim/plugin/lsp.vim index c5e1c90..a342e3c 100644 --- a/vim/.vim/plugin/lsp.vim +++ b/vim/.vim/plugin/lsp.vim @@ -1,23 +1,24 @@ 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, }, { filetype: ["python"], path: "pyls", - args: ["-v"], syncInit: true, workspaceConfig: {pyls: { configurationSources: ["flake8"], @@ -25,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