-let g:asyncomplete_auto_completeopt = 0
-let g:asyncomplete_auto_popup = 0
-imap <C-b> <Plug>(asyncomplete_force_refresh)
+vim9script
-let g:lsp_highlight_references_enabled = 1
-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
- nmap <buffer> [g <Plug>(lsp-previous-diagnostic)
- nmap <buffer> ]g <Plug>(lsp-next-diagnostic)
- nmap <buffer> gd <plug>(lsp-definition)
- nmap <buffer> K <plug>(lsp-hover)
-endfunction
+var lspServers: list<dict<any>>
-augroup lsp_install
- autocmd!
- autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
-augroup END
+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
+
+var lspOpts = {
+ ignoreMissingServer: true,
+ autoComplete: false,
+ autoHighlight: true,
+ autoPopulateDiags: true,
+ showInlayHints: true,
+ showSignature: false,
+}
+
+autocmd VimEnter * call LspAddServer(lspServers)
+autocmd VimEnter * call LspOptionsSet(lspOpts)
+nmap gd :LspGotoDefinition<CR>
+nmap <C-W>gd :vert LspGotoDefinition<CR>
+nmap <F6> :lopen<CR>