X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=vim%2F.vim%2Fplugin%2Flsp.vim;h=946c5a89175f5e635c8952fc0a79b65f604d8f21;hb=714fc115ad97f8067fc408f6345c5c4b852018e3;hp=c7930b4e24cba965045381963e153cb155d71936;hpb=6b3cd1e80646e11ce56a53ccd15cb0b674dac88f;p=dotfiles.git diff --git a/vim/.vim/plugin/lsp.vim b/vim/.vim/plugin/lsp.vim index c7930b4..946c5a8 100644 --- a/vim/.vim/plugin/lsp.vim +++ b/vim/.vim/plugin/lsp.vim @@ -1,22 +1,49 @@ -if exists("*on_lsp_buffer_enabled") | finish | endif +vim9script -let g:lsp_auto_enable = 1 +# go get golang.org/x/tools/gopls@latest +# pip install 'python-language-server[all]' -let g:lsp_diagnostics_echo_cursor = 1 -let g:lsp_diagnostics_echo_delay = -1 -let g:lsp_signature_help_enabled = 0 +var lspServers: list> -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 +for d in [ + { + filetype: ["c", "cpp"], + path: "clangd", + args: ["--log=error"], + }, + { + filetype: ["go"], + path: "gopls", + syncInit: true, + }, + { + filetype: ["python"], + path: "pyls", + syncInit: true, + workspaceConfig: {pyls: { + configurationSources: ["flake8"], + plugins: { + mccabe: {enabled: false}, + }, + }}, + }, +] + if executable(d["path"]) + add(lspServers, d) + endif +endfor -augroup lsp_install - autocmd! - autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled() -augroup END +var lspOpts = { + ignoreMissingServer: true, + autoComplete: false, + autoHighlight: true, + autoPopulateDiags: true, + showInlayHints: true, + showSignature: false, +} -map :call mylsp#qfpopulate():copen +autocmd VimEnter * call LspAddServer(lspServers) +autocmd VimEnter * call LspOptionsSet(lspOpts) +nmap gd :LspGotoDefinition +nmap gd :vert LspGotoDefinition +nmap :lopen