UNPKG

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