]> Sergey Matveev's repositories - dotfiles.git/blob - vim/.vim/plugin/lsp.vim
c5e1c90ac8b51cc098c98925560e42a927275523
[dotfiles.git] / vim / .vim / plugin / lsp.vim
1 vim9script
2
3 # go get golang.org/x/tools/gopls@latest
4 # pip install 'python-language-server[all]'
5
6 var lspServers = [
7     {
8         filetype: ["c", "cpp"],
9         path: "clangd",
10         args: ["--log=error"],
11     },
12     {
13         filetype: ["go"],
14         path: "gopls",
15         syncInit: true,
16     },
17     {
18         filetype: ["python"],
19         path: "pyls",
20         args: ["-v"],
21         syncInit: true,
22         workspaceConfig: {pyls: {
23             configurationSources: ["flake8"],
24             plugins: {
25                 mccabe: {enabled: false},
26             },
27         }},
28     }
29 ]
30 var lspOpts = {
31     ignoreMissingServer: true,
32     autoComplete: false,
33     autoHighlight: true,
34     autoPopulateDiags: true,
35     showInlayHints: true,
36 }
37
38 autocmd VimEnter * call LspAddServer(lspServers)
39 autocmd VimEnter * call LspOptionsSet(lspOpts)
40 nmap gd :LspGotoDefinition<CR>
41 nmap <C-W>gd :vert LspGotoDefinition<CR>
42 nmap <F6> :lopen<CR>