To register a LSP server, add the following lines to your .vimrc file:
```
let lspServers = [
- \ {
- \ 'filetype': ['c', 'cpp'],
- \ 'path': '/usr/local/bin/clangd',
- \ 'args': ['--background-index']
- \ },
- \ {
- \ 'filetype': ['javascript', 'typescript'],
- \ 'path': '/usr/local/bin/typescript-language-server',
- \ 'args': ['--stdio']
- \ },
- \ {
- \ 'filetype': 'sh',
- \ 'path': '/usr/local/bin/bash-language-server',
- \ 'args': ['start']
- \ },
- \ {
- \ 'filetype': 'vim',
- \ 'path': '/usr/local/bin/vim-language-server',
- \ 'args': ['--stdio']
- \ },
- \ {
- \ 'filetype': ['go', 'gomod'],
- \ 'path': '/usr/local/bin/gopls',
- \ 'args': []
- \ },
- \ {
- \ 'filetype': ['python'],
- \ 'path': '/usr/local/bin/pyls',
- \ 'args': []
- \ },
- \ {
- \ 'filetype': ['fortran'],
- \ 'path': '/usr/local/bin/fortls',
- \ 'args': ['--nthreads=1', '--use_signature_help', '--hover_signature']
- \ }
+ \ #{
+ \ filetype: ['c', 'cpp'],
+ \ path: '/usr/local/bin/clangd',
+ \ args: ['--background-index']
+ \ },
+ \ #{
+ \ filetype: ['javascript', 'typescript'],
+ \ path: '/usr/local/bin/typescript-language-server',
+ \ args: ['--stdio']
+ \ },
+ \ #{
+ \ filetype: 'sh',
+ \ path: '/usr/local/bin/bash-language-server',
+ \ args: ['start']
+ \ },
+ \ #{
+ \ filetype: 'vim',
+ \ path: '/usr/local/bin/vim-language-server',
+ \ args: ['--stdio']
+ \ },
+ \ #{
+ \ filetype: ['go', 'gomod'],
+ \ path: '/usr/local/bin/gopls',
+ \ args: ['serve']
+ \ syncInit: v:true,
+ \ },
+ \ #{
+ \ filetype: ['rust'],
+ \ path: '/usr/local/bin/rust-analyzer',
+ \ args: []
+ \ syncInit: v:true,
+ \ },
+ \ #{
+ \ filetype: ['python'],
+ \ path: '/usr/local/bin/pyls',
+ \ args: []
+ \ },
+ \ #{
+ \ filetype: ['fortran'],
+ \ path: '/usr/local/bin/fortls',
+ \ args: ['--nthreads=1', '--use_signature_help', '--hover_signature']
+ \ }
\ ]
call LspAddServer(lspServers)
```
Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
For Vim version 8.2.2342 and above
-Last change: Sep 9, 2022
+Last change: Sep 27, 2022
==============================================================================
*lsp-license*
file types, add the following commands to the .vimrc file: >
let lspServers = [
- \ {
- \ 'filetype': ['javascript', 'typescript'],
- \ 'path': '/usr/local/bin/typescript-language-server',
- \ 'args': ['--stdio']
- \ },
- \ {
- \ 'filetype': 'python',
- \ 'path': '/usr/local/bin/pyls',
- \ 'args': ['--check-parent-process', '-v']
- \ }
+ \ #{
+ \ filetype: ['javascript', 'typescript'],
+ \ path: '/usr/local/bin/typescript-language-server',
+ \ args: ['--stdio']
+ \ },
+ \ #{
+ \ filetype: 'python',
+ \ path: '/usr/local/bin/pyls',
+ \ args: ['--check-parent-process', '-v']
+ \ }
\ ]
call LspAddServer(lspServers)
<
\ },
\ #{
\ filetype: ['go', 'gomod', 'gohtmltmpl', 'gotexttmpl'],
- \ path: '/home/dza/.go/bin/gopls',
+ \ path: '/path/to/.go/bin/gopls',
\ args: [],
\ syncInit: v:true,
- \ omnicompl: v:true,
\ },
\ #{
\ filetype: ['rust'],
- \ path: '/home/dza/.cargo/bin/rust-analyzer',
+ \ path: '/path/to/.cargo/bin/rust-analyzer',
\ args: [],
\ syncInit: v:true,
- \ omnicompl: v:true,
\ },
\ #{
\ filetype: 'sh',