A Fast and Minimalism Style Completion Plugin for vim/nvim.
There are many excellent vim auto-completion plugins such as nvim-cmp, vim-lsp, YouCompleteMe and coc.nvim etc. However I still want a simpler plugin without any redundant configurations. And it's a good idea to incorporate the capabilities of an AI coding assistant as well.
Vim-easycomplete is a fast and minimalism style completion plugin for vim/nvim. The goal is to work everywhere out of the box. It requires pure VimScript. It's also super simple to configure. Especially, You don’t have to install Node and a bunch of Node modules unless you’re a js/ts programmer.
It contains these features:
- AI coding assistant via tabnine. (Highly Recommend!)
- Buffer Keywords/Directory support
- LSP(language-server-protocol) support. Easy to install LSP Server with one command
- Written in pure vim script for vim8 and neovim
- Snippet support
- Fast performance
Easycomplete requires Vim 8.2 or higher version with MacOS/Linux/FreeBSD. For neovim users, 0.4.4 or higher is required.
For vim-plug:
Plug 'jayli/vim-easycomplete'
Plug 'SirVer/ultisnips'Run :PlugInstall.
For dein.vim
call dein#add('jayli/vim-easycomplete')
call dein#add('SirVer/ultisnips')For Packer.nvim
use { 'SirVer/ultisnips' }
use { 'jayli/vim-easycomplete' }Run :PackerInstall
You can use my default configuration here with lua.
All commands:
| Command | Description |
|---|---|
:EasyCompleteInstallServer |
Install LSP server for current fileytpe |
:InstallLspServer |
Same as EasyCompleteInstallServer |
:EasyCompleteDisable |
Disable EasyComplete |
:EasyCompleteEnable |
Enable EasyComplete |
:EasyCompleteGotoDefinition |
Goto definition position |
:EasyCompleteReference |
Find references |
:EasyCompleteRename |
Rename |
:EasyCompleteCheck |
Checking LSP server |
:EasyCompletePreviousDiagnostic |
Goto Previous diagnostic |
:EasyCompleteNextDiagnostic |
Goto Next diagnostic |
:EasyCompleteProfileStart |
Start record diagnostics message |
:EasyCompleteProfileStop |
Stop record diagnostics message |
:EasyCompleteLint |
Do diagnostic |
:LintEasyComplete |
Do diagnostic |
:BackToOriginalBuffer |
Return to the position before the reference jump |
:DenoCache |
Do Deno Cache for downloading modules |
:CleanLog |
close quickfix window |
The plugin is out of box and config nothing. (If you want full features, please refer to my full configuration). Use Tab to trigger the completion suggestions and select matched items. By default use Ctrl-] for definition jumping, Ctrl-t for jumping back (Same as tags jumping).
Example configuration with lua:
-- Highlight the symbol when holding the cursor if you need it
vim.g.easycomplete_cursor_word_hl = 1
-- Using nerdfont is highly recommended
vim.g.easycomplete_nerd_font = 1
-- GoTo code navigation
vim.keymap.set('n', 'gr', ':EasyCompleteReference<CR>')
vim.keymap.set('n', 'gd', ':EasyCompleteGotoDefinition<CR>')
vim.keymap.set('n', 'rn', ':EasyCompleteRename<CR>')
vim.keymap.set('n', 'gb', ':BackToOriginalBuffer<CR>')Example configuration with vim script:
" Highlight the symbol when holding the cursor
let g:easycomplete_cursor_word_hl = 1
" Using nerdfont is highly recommended
let g:easycomplete_nerd_font = 1
" GoTo code navigation
noremap gr :EasyCompleteReference<CR>
noremap gd :EasyCompleteGotoDefinition<CR>
noremap rn :EasyCompleteRename<CR>
noremap gb :BackToOriginalBuffer<CR>Global configurations
| Global Configure | Default | Description |
|---|---|---|
g:easycomplete_nerd_font |
0 | Using nerdfont for lsp icons |
g:easycomplete_menu_skin |
{} |
Menu skin. Examples |
g:easycomplete_sign_text |
{} |
Sign icons. Examples |
g:easycomplete_lsp_type_font |
... | lsp icons configuration |
g:easycomplete_tabnine_suggestion |
1 | Tabnine inline suggestion(for nvim only) |
g:easycomplete_lsp_checking |
1 | Check whether the lsp is installed while opening a file |
g:easycomplete_tabnine_enable |
1 | Enable Tabnine |
g:easycomplete_directory_enable |
1 | Directory complete |
g:easycomplete_tabnine_config |
{} |
TabNine Configuration |
g:easycomplete_filetypes |
{} |
Custom filetyps configuration |
g:easycomplete_enable |
1 | Enable this plugin |
g:easycomplete_tab_trigger |
<Tab> |
Use tab to trigger completion and select next item |
g:easycomplete_shift_tab_trigger |
<S-Tab> |
Use s-tab to select previous item |
g:easycomplete_cursor_word_hl |
0 | Highlight the symbol when holding the cursor |
g:easycomplete_signature_offset |
0 | Signature offset |
g:easycomplete_diagnostics_next |
<C-N> |
Goto next diagnostic position |
g:easycomplete_diagnostics_prev |
<S-C-n> |
Goto previous diagnostic position |
g:easycomplete_diagnostics_enable |
1 | Enable diagnostics |
g:easycomplete_signature_enable |
1 | Enable signature |
g:easycomplete_diagnostics_hover |
1 | Gives a diagnostic prompt when the cursor holds |
g:easycomplete_scheme |
"" |
Popup menu colorscheme |
Typing :h easycomplete for help.
There are tow ways to install lsp server.
- For vim/nvim: via integrated installer by
:InstallLspServer. - For nvim only: via nvim-lsp-installer by
:LspInstall
Plug 'williamboman/nvim-lsp-installer'LSP Server will all be installed in ~/.config/vim-easycomplete/servers.
You can give a specified plugin name for InstallLspServer command. Both of the following useage are avilable:
:InstallLspServer:InstallLspServer lua
All supported languages:
| Plugin Name | Languages | Language Server | Installer | Requirements | nvim-lsp-installer support |
|---|---|---|---|---|---|
| directory | directory | No Need | Integrated | None | - |
| buf | buf & dict | No Need | Integrated | None | - |
| snips | Snippets | ultisnips | Integrated | python3 | - |
| ts | js/ts | tsserver | Yes | node/npm | Yes |
| deno | js/ts | denols | Yes | deno | Yes |
| tn | TabNine | TabNine | Yes | None | No |
| vim | Vim | vimls | Yes | node/npm | Yes |
| cpp | C/C++/OC | clangd | Yes | None | Yes |
| css | CSS | cssls | Yes | node/npm | Yes |
| html | HTML | html | Yes | node/npm | Yes |
| yml | YAML | yamlls | Yes | node/npm | Yes |
| xml | Xml | lemminx | Yes | java/jdk | Yes |
| sh | Bash | bashls | Yes | node/npm | Yes |
| json | JSON | json-languageserver | Yes | node/npm | No |
| php | php | intelephense | Yes | node/npm | Yes |
| dart | dart | dartls | Yes | None | Yes |
| py | Python | pylsp | Yes | python3/pip3 | Yes |
| java | Java | jdtls | Yes | java11/jdk | Yes |
| go | Go | gopls | Yes | go | Yes |
| r | R | r-languageserver | Yes | R | No |
| rb | Ruby | solargraph | Yes | ruby/bundle | No |
| lua | Lua | sumneko_lua |
Yes | Lua | Yes |
| nim | Nim | nimls | Yes | nim/nimble | Yes |
| rust | Rust | rust_analyzer |
Yes | None | Yes |
| kt | Kotlin | kotlin_language_server |
Yes | java/jdk | Yes |
| grvy | Groovy | groovyls | Yes | java/jdk | Yes |
| cmake | cmake | cmake | Yes | python3/pip3 | Yes |
| c# | C# | omnisharp-lsp | Yes | None | No |
More info about semantic completion for each supported language:
- JavaScript & TypeScript: tsserver required.
- Python: pylsp required. (
pip install python-language-server) - Go: gopls required. (
go get golang.org/x/tools/gopls) - Vim Script: vimls required.
- C++/C/OC:Clangd required.
- CSS: cssls required. (css-languageserver),Css-languageserver dose not support CompletionProvider by default as it requires Snippets,You must install it manually.
- JSON: json-languageserver required.
- PHP: intelephense
- Dart: dartls
- HTML: html required. html-languageserver dose not support CompletionProvider by default. You must install Snippets manually.
- Shell: bashls required.
- Java: jdtls, java 11 and upper version required.
- Cmake: cmake required.
- Kotlin: kotlin language server required.
- Rust: rust-analyzer required.
- Lua: sumneko lua required. Local configuration file path is
~/.config/vim-easycomplete/servers/lua/config.json. Get more information here. - Xml: lemminx required.
- Groovy: groovyls required.
- Yaml: yamlls required.
- Ruby: solargraph required.
- Nim: nimlsp required. packages.json downloading is very slow, You'd better intall minlsp manually via
choosenimfollow this guide. - Deno: denols required. Use
:DenoCachecommand fordeno cachecurrent ts/js file. - C# : omnisharp required.
- R: r-languageserver required.
- TabNine: TabNine
Add filetypes whitelist for specified language plugin:
let g:easycomplete_filetypes = {
\ "sh": {
\ "whitelist": ["shell"]
\ },
\ "r": {
\ "whitelist": ["rmd", "rmarkdown"]
\ },
\ }Vim-EasyComplete does not support snippets by default. If you want snippet integration, you will first have to install ultisnips. UltiSnips is compatible with Vim-EasyComplete out of the box. UltiSnips required python3 installed.
Solution of "E319: No python3 provider found" Error in neovim 0.4.4 with ultisnips
Install TabNine: :InstallLspServer tabnine. Then restart your vim/nvim.
Set let g:easycomplete_tabnine_enable = 0 to disable TabNine. You can config TabNine by g:easycomplete_tabnine_config witch contains two properties:
- line_limit: The number of lines before and after the cursor to send to TabNine. If the option is smaller, the performance may be improved. (default: 1000)
- max_num_result: Max results from TabNine. (default: 10)
let g:easycomplete_tabnine_config = {
\ 'line_limit': 1000,
\ 'max_num_result' : 10,
\ }TabNine works well without APIKey. If you have a Tabnine's Pro API key or purchased a subscription license. To configure, you'll need to use the TabNine' magic string. Type Tabnine::config in insert mode to open the configuration panel.
Disable TabNine inline suggestion: let g:easycomplete_tabnine_suggestion = 0.
There are four build-in popup menu themes in cterm: blue,light,rider and sharp(for iterm). (let g:easycomplete_scheme="sharp").
If you just want to use default nerdfonts configuration, you can simplily config g:easycomplete_nerd_font = 1
If you want to customize the kind icon, you can modify the configuration with https://nerdfonts.com installed. Examples.
→ add custom completion plugin
[WIP] If you have bug reports or feature suggestions, please use the issue tracker. In the meantime feel free to read some of my thoughts at https://zhuanlan.zhihu.com/p/366496399, https://zhuanlan.zhihu.com/p/425555993, https://medium.com/@lijing00333/vim-easycomplete
TabNine snippets inline suggestion
Update Deno Cache via :DenoCache
Directory selecting:
Handle backsapce typing
Snip Support
Diagnostics jumping
Signature
TabNine supporting:
MIT









