X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=vim%2F.vim%2Fplugin%2Flsp.vim;h=c5e1c90ac8b51cc098c98925560e42a927275523;hb=332316f0d9ab39aa5f8365962ba2f7c785f0edd4;hp=dfffc1b239dc36675157d6f5d9ec1a9014b685e3;hpb=1c6d453a56833e3a932b008909cd64f09e8b3497;p=dotfiles.git diff --git a/vim/.vim/plugin/lsp.vim b/vim/.vim/plugin/lsp.vim index dfffc1b..c5e1c90 100644 --- a/vim/.vim/plugin/lsp.vim +++ b/vim/.vim/plugin/lsp.vim @@ -1,19 +1,42 @@ -if exists("g:loaded_mein_lsp") | finish | endif -let g:loaded_mein_lsp = 1 -let g:lsp_auto_enable = 1 +vim9script -let g:lsp_diagnostics_echo_cursor = 1 -let g:lsp_diagnostics_echo_delay = -1 +# go get golang.org/x/tools/gopls@latest +# pip install 'python-language-server[all]' -function! s:on_lsp_buffer_enabled() abort - setlocal omnifunc=lsp#complete - nmap [g (lsp-previous-diagnostic) - nmap ]g (lsp-next-diagnostic) - nmap gd (lsp-definition) - nmap K (lsp-hover) -endfunction +var lspServers = [ + { + filetype: ["c", "cpp"], + path: "clangd", + args: ["--log=error"], + }, + { + filetype: ["go"], + path: "gopls", + syncInit: true, + }, + { + filetype: ["python"], + path: "pyls", + args: ["-v"], + syncInit: true, + workspaceConfig: {pyls: { + configurationSources: ["flake8"], + plugins: { + mccabe: {enabled: false}, + }, + }}, + } +] +var lspOpts = { + ignoreMissingServer: true, + autoComplete: false, + autoHighlight: true, + autoPopulateDiags: true, + showInlayHints: true, +} -augroup lsp_install - autocmd! - autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled() -augroup END +autocmd VimEnter * call LspAddServer(lspServers) +autocmd VimEnter * call LspOptionsSet(lspOpts) +nmap gd :LspGotoDefinition +nmap gd :vert LspGotoDefinition +nmap :lopen