UNPKG

3.68 kBMarkdownView Raw
1# vim language server
2
3> language server for viml
4
5**Features:**
6
7- auto completion
8- function signature help
9- hover document
10- go to definition
11- go to references
12- rename
13- snippets
14- diagnostic
15
16![image](https://user-images.githubusercontent.com/5492542/57384333-019b9880-71e3-11e9-9ee8-7e731944777b.png)
17
18## Install
19
20``` sh
21yarn global add vim-language-server
22```
23
24**For coc.nvim user** install coc extension:
25
26``` vim
27:CocInstall coc-vimlsp
28```
29
30## Config
31
32for document highlight
33
34``` vim
35let g:markdown_fenced_languages = [
36 \ 'vim',
37 \ 'help'
38 \]
39```
40
41lsp client config example with coc.nvim
42
43- Using node ipc
44
45``` jsonc
46"languageserver": {
47 "vimls": {
48 "module": "/path/to/vim-language-server/bin/index.js",
49 "args": ["--node-ipc"],
50 "initializationOptions": {
51 "iskeyword": "@,48-57,_,192-255,-#", // vim iskeyword option
52 "vimruntime": "", // $VIMRUNTIME option
53 "runtimepath": "", // vim runtime path separate by `,`
54 "diagnostic": {
55 "enable": true
56 },
57 "indexes": {
58 "runtimepath": true, // if index runtimepath's vim files this will effect the suggest
59 "gap": 100, // index time gap between next file
60 "count": 3, // count of files index at the same time
61 "projectRootPatterns" : ["strange-root-pattern", ".git", "autoload", "plugin"] // Names of files used as the mark of project root. If empty, the default value [".git", "autoload", "plugin"] will be used
62 },
63 "suggest": {
64 "fromVimruntime": true, // completionItems from vimruntime's vim files
65 "fromRuntimepath": false // completionItems from runtimepath's vim files, if this is true that fromVimruntime is true
66 }
67 },
68 "filetypes": [ "vim" ],
69 }
70}
71```
72
73- Using stdio
74
75``` jsonc
76"languageserver": {
77 "vimls": {
78 "command": "vim-language-server",
79 "args": ["--stdio"],
80 "initializationOptions": {
81 "iskeyword": "@,48-57,_,192-255,-#", // vim iskeyword option
82 "vimruntime": "", // $VIMRUNTIME option
83 "runtimepath": "", // vim runtime path separate by `,`
84 "diagnostic": {
85 "enable": true
86 },
87 "indexes": {
88 "runtimepath": true, // if index runtimepath's vim files this will effect the suggest
89 "gap": 100, // index time gap between next file
90 "count": 3, // count of files index at the same time
91 "projectRootPatterns" : ["strange-root-pattern", ".git", "autoload", "plugin"] // Names of files used as the mark of project root. If empty, the default value [".git", "autoload", "plugin"] will be used
92 },
93 "suggest": {
94 "fromVimruntime": true, // completionItems from vimruntime's vim files
95 "fromRuntimepath": false // completionItems from runtimepath's vim files, if this is true that fromVimruntime is true
96 }
97 },
98 "filetypes": [ "vim" ]
99 }
100}
101```
102
103**Note**:
104
105- if you want to speed up index, change `gap` to smaller and `count` to greater, this will cause high CPU usage for some time
106- if you don't want to index vim's runtimepath files, set `runtimepath` to `false` and you will not get any suggest from those files.
107- while `fromRuntimepath` is true, if you have install too many plugins it will slow down the complete
108
109## References
110
111- [vim-vimlparser](https://github.com/vim-jp/vim-vimlparser)
112- [neco-vim](https://github.com/Shougo/neco-vim)
113
114### Buy Me A Coffee ☕️
115
116![btc](https://img.shields.io/keybase/btc/iamcco.svg?style=popout-square)
117
118![image](https://user-images.githubusercontent.com/5492542/42771079-962216b0-8958-11e8-81c0-520363ce1059.png)