X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=vim%2F.vim%2Fplugin%2Flsp.vim;h=c5e1c90ac8b51cc098c98925560e42a927275523;hb=332316f0d9ab39aa5f8365962ba2f7c785f0edd4;hp=13d51d5aeb8bad48e54c8a58e30a43d85e0892a8;hpb=31daf53ac7ef57c39cc0f11762d74228763b8dd7;p=dotfiles.git diff --git a/vim/.vim/plugin/lsp.vim b/vim/.vim/plugin/lsp.vim index 13d51d5..c5e1c90 100644 --- a/vim/.vim/plugin/lsp.vim +++ b/vim/.vim/plugin/lsp.vim @@ -1,25 +1,42 @@ -let g:lsp_settings_enable_suggestions = 0 -let g:lsp_settings = { -\ 'clangd': {'cmd': ['clangd60']}, -\} +vim9script -let g:asyncomplete_auto_completeopt = 0 -let g:asyncomplete_auto_popup = 0 -imap (asyncomplete_force_refresh) -autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif +# go get golang.org/x/tools/gopls@latest +# pip install 'python-language-server[all]' -let g:lsp_highlight_references_enabled = 1 -let g:lsp_diagnostics_echo_cursor = 1 -let g:lsp_diagnostics_echo_delay = -1 +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, +} -function! s:on_lsp_buffer_enabled() abort - nmap [g (lsp-previous-diagnostic) - nmap ]g (lsp-next-diagnostic) - nmap gd (lsp-definition) - nmap K (lsp-hover) -endfunction - -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