UNPKG

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