Home

Awesome

Vim-EasyComplete

It's 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 AI coding assistants as well.

What

Vim-easycomplete is a fast and minimalism style completion plugin for vim/nvim. It aims to be available out of the box on linux and mac. It is implemented in pure VimScript and is extremely simple to configure without installing Node and a bunch of Node modules.

https://github.com/jayli/vim-easycomplete/assets/188244/5fdef6cb-ef1d-4428-960e-d9802cbc2a84

It contains these features:

Installation

Easycomplete requires Vim 8.2 or higher version with MacOS/Linux/FreeBSD. For neovim users, 0.6.0 or higher is required.

Vimscript config with vim-plug:

Plug 'jayli/vim-easycomplete'
Plug 'SirVer/ultisnips'

Run :PlugInstall.

Lua config with Packer.nvim:

use { 'jayli/vim-easycomplete', requires = {'SirVer/ultisnips'}}

Run :PackerInstall

Full configuration example.

Commands

All commands:

CommandDescription
:EasyCompleteInstallServerInstall LSP server for current fileytpe
:InstallLspServerSame as EasyCompleteInstallServer
:EasyCompleteDisableDisable EasyComplete
:EasyCompleteEnableEnable EasyComplete
:EasyCompleteGotoDefinitionGoto definition position
:EasyCompleteReferenceFind references
:EasyCompleteRenameRename
:EasyCompleteCheckChecking LSP server
:EasyCompletePreviousDiagnosticGoto Previous diagnostic
:EasyCompleteNextDiagnosticGoto Next diagnostic
:EasyCompleteProfileStartStart record diagnostics message
:EasyCompleteProfileStopStop record diagnostics message
:EasyCompleteLintDo diagnostic
:LintEasyCompleteDo diagnostic
:BackToOriginalBufferReturn to the position before the reference jump
:DenoCacheDo Deno Cache for downloading modules
:CleanLogclose quickfix window

Configuration

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).

Lua configuration:

-- 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>')

Vimscript configuration:

" 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>

Other optional configurations:

Global configurations:

Global ConfigureDefaultDescription
g:easycomplete_nerd_font0Using nerdfont for lsp icons
g:easycomplete_menu_skin{}Menu skin.
g:easycomplete_sign_text{}Sign icons.
g:easycomplete_lsp_type_font...lsp icons configuration
g:easycomplete_tabnine_suggestion1Tabnine inline suggestion(for nvim only)
g:easycomplete_lsp_checking1Check whether the lsp is installed while opening a file
g:easycomplete_tabnine_enable1Enable Tabnine
g:easycomplete_directory_enable1Directory complete
g:easycomplete_tabnine_config{}TabNine Configuration
g:easycomplete_filetypes{}Custom filetyps configuration
g:easycomplete_enable1Enable 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_hl0Highlight the symbol when holding the cursor
g:easycomplete_signature_offset0Signature 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_enable1Enable diagnostics
g:easycomplete_signature_enable1Enable signature
g:easycomplete_diagnostics_hover1Gives a diagnostic prompt when the cursor holds
g:easycomplete_pum_format["abbr", "kind", "menu"]Pmenu format

Typing :h easycomplete for help.

Language Support

There are tow ways to install lsp server.

  1. For vim/nvim: via integrated installer by :InstallLspServer.
  2. 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:

All supported languages:

Plugin NameLanguagesLanguage ServerInstallerRequirementsnvim-lsp-installer support
directorydirectoryNo NeedIntegratedNone-
bufbuf & dictNo NeedIntegratedNone-
snipsSnippetsultisnipsIntegratedpython3-
tsjs/tstsserverYesnode/npmYes
denojs/tsdenolsYesdenoYes
tnTabNineTabNineYesNoneNo
vimVimvimlsYesnode/npmYes
cppC/C++/OCclangdYesNoneYes
cssCSScsslsYesnode/npmYes
htmlHTMLhtmlYesnode/npmYes
ymlYAMLyamllsYesnode/npmYes
xmlXmllemminxYesjava/jdkYes
shBashbashlsYesnode/npmYes
jsonJSONjson-languageserverYesnode/npmNo
phpphpintelephenseYesnode/npmYes
dartdartdartlsYesNoneYes
pyPythonpylspYespython3/pip3Yes
javaJavajdtlsYesjava11/jdkYes
goGogoplsYesgoYes
rRr-languageserverYesRNo
rbRubysolargraphYesruby/bundleNo
luaLuasumneko_luaYesLuaYes
nimNimnimlsYesnim/nimbleYes
rustRustrust_analyzerYesNoneYes
ktKotlinkotlin_language_serverYesjava/jdkYes
grvyGroovygroovylsYesjava/jdkYes
cmakecmakecmakeYespython3/pip3Yes
c#C#omnisharp-lspYesNoneNo

More info about semantic completion for each supported language:

Add filetypes whitelist for specified language plugin:

let g:easycomplete_filetypes = {
      \   "sh": {
      \     "whitelist": ["shell"]
      \   },
      \   "r": {
      \     "whitelist": ["rmd", "rmarkdown"]
      \   },
      \ }

Snippet Support

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

AI Coding via TabNine Support

Install TabNine: :InstallLspServer tabnine. Then restart your vim/nvim.

<img src="https://gw.alicdn.com/imgextra/i2/O1CN01Qjk2tV2A20Ss9jtcq_!!6000000008144-0-tps-792-470.jpg" width="500px" />

Set let g:easycomplete_tabnine_enable = 0 to disable TabNine. You can config TabNine by g:easycomplete_tabnine_config witch contains two properties:

let g:easycomplete_tabnine_config = {
    \ 'line_limit': 1000,
    \ 'max_num_result' : 3,
    \ }

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.


Beautify completion menu

Set g:easycomplete_nerd_font = 1 to enable default nerdfonts configuration.

If you want to customize the kind icon, you can modify the configuration with https://nerdfonts.com installed. Examples.

You can add custom Pmenu styles by defining these highlight groups:

More examples here: full config example

My custom config:my-custom-config

截屏2023-12-30 20 25 06

Add custom completion plugin

add custom completion plugin

Issues

[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

More Examples:

TabNine snippets inline suggestion

<img src="https://gw.alicdn.com/imgextra/i2/O1CN01vESZ6G1h3j5u4hmN4_!!6000000004222-1-tps-1189-606.gif" width="600" />

Update Deno Cache via :DenoCache

<img src="https://img.alicdn.com/imgextra/i4/O1CN01kjPu4M1FVNbRKVrUD_!!6000000000492-1-tps-943-607.gif" width=600 />

Directory selecting:

<img src="https://img.alicdn.com/imgextra/i2/O1CN01FciC1Q1WHV4HJ79qn_!!6000000002763-1-tps-1027-663.gif" width=600 />

Handle backsapce typing

<img src="https://img.alicdn.com/imgextra/i3/O1CN01obuQnJ1tIAoUNv8Up_!!6000000005878-1-tps-880-689.gif" width=600 />

Snip Support

<img src="https://img.alicdn.com/imgextra/i3/O1CN01dGIJZW204A0MpESbI_!!6000000006795-1-tps-750-477.gif" width=600 />

Diagnostics jumping

<img src="https://img.alicdn.com/imgextra/i1/O1CN01g7PWjZ1q7EVKVpxno_!!6000000005448-1-tps-902-188.gif" width=600 />

Signature

<img src="https://img.alicdn.com/imgextra/i4/O1CN01kNd19n1k7nINy4SQT_!!6000000004637-1-tps-862-228.gif" width=600 />

TabNine supporting:

<img src="https://img.alicdn.com/imgextra/i3/O1CN013nBG6n1WjRE8rgMNi_!!6000000002824-1-tps-933-364.gif" width=600 />

License

MIT