-" go get golang.org/x/tools/gopls@latest
-" pip install 'python-language-server[all]'
+vim9script
-let g:lsc_enable_autocomplete = v:false
-let g:lsc_server_commands = {
- \ "c": {"command": "clangd --log=error"},
- \ "cpp": {"command": "clangd --log=error"},
- \ "go": {"command": "gopls", "log_level": "Error"},
- \ "python": {
- \ "command": "pyls",
- \ "workspace_config": {"pyls": {
- \ "configurationSources": ["flake8"],
- \ "plugins": {
- \ "mccabe": {"enabled": v:false},
- \ },
- \ }},
- \ "enabled": v:false,
- \ },
-\ }
-let g:lsc_auto_map = {
- \ "GoToDefinition": "gd",
- \ "GoToDefinitionSplit": "<C-W>gd",
- \ "ShowHover": v:true,
- \ "Completion": "omnifunc",
-\ }
+# go get golang.org/x/tools/gopls@latest
+# pip install 'python-language-server[all]'
-map <F6> :LSClientAllDiagnostics<CR>
+var lspServers: list<dict<any>>
+
+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>