UNPKG

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