A async completion framework aims to provide completion to neovim's built in LSP written in Lua
Lua
957
440 commits
updated Oct 12, 2021
If you are looking for an autocompletion plugin, the neovim LSP team recommends either nvim-cmp or coq_nvim.
completion-nvim is an auto completion framework that aims to provide a better completion experience with neovim's built-in LSP. Other LSP functionality is not supported.
libuv api.Demo using sumneko_lua

Plug 'nvim-lua/completion-nvim'
on_attach function like this.lua require'lspconfig'.pyls.setup{on_attach=require'completion'.on_attach}
pyls to whichever language server you're using.on_attach function directly:" Use completion-nvim in every buffer
autocmd BufEnter * lua require'completion'.on_attach()
NOTE It's okay to set up completion-nvim without lsp. It will simply use another completion source instead(Ex: snippets).
built-in sources
ins-complete sources
:h ins-completion and wikiexternal sources
vim-dadbod." Use <Tab> and <S-Tab> to navigate through popup menu
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" Set completeopt to have a better completion experience
set completeopt=menuone,noinsert,noselect
" Avoid showing message extra message when using completion
set shortmess+=c
let g:completion_enable_auto_popup = 0
CompletionToggle"map <c-p> to manually trigger completion
imap <silent> <c-p> <Plug>(completion_trigger)
<Tab> as trigger keysimap <tab> <Plug>(completion_smart_tab)
imap <s-tab> <Plug>(completion_smart_s_tab)
" possible value: 'UltiSnips', 'Neosnippet', 'vim-vsnip', 'snippets.nvim'
let g:completion_enable_snippet = 'UltiSnips'
UltiSnips, Neosnippet, vim-vsnip and snippets.nvimcompletion-nvim can integrate
with other LSP snippet parsing plugin for this support.Right now, vim-vsnip (requiring vim-vsnip-integ) and snippets.nvim are supported.
completion-nvim supports chain completion, which use other completion sources
and ins-completion as a fallback for lsp completion.
See wiki for details on how to set this up.
<CR> is used to confirm completion and expand snippets, change it bylet g:completion_confirm_key = "\<C-y>"
" " and add escape key \ to avoid parsing issues.<CR>. You can avoid using the default confirm key option and
use a mapping like this instead.let g:completion_confirm_key = ""
imap <expr> <cr> pumvisible() ? complete_info()["selected"] != "-1" ?
\ "\<Plug>(completion_confirm_completion)" : "\<c-e>\<CR>" : "\<CR>"
let g:completion_enable_auto_hover = 0
let g:completion_enable_auto_signature = 0
"alphabet", change it by" possible value: "length", "alphabet", "none"
let g:completion_sorting = "length"
"none".There are three different kind of matching technique implement in
completion-nvim: substring, fuzzy, exact or all.
You can specify a list of matching strategy, completion-nvim will loop through the list and assign priority from high to low. For example
let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy', 'all']
NOTE Fuzzy match highly dependent on what language server you're using. It might not work as you expect on some language server.
g:completion_matching_ignore_case = 1
g:completion_matching_smart_case = 1
completion-nvim respect the trigger character of your language server, if you
want more trigger characters, add it bylet g:completion_trigger_character = ['.', '::']
NOTE use :lua print(vim.inspect(vim.lsp.buf_get_clients()[1].server_capabilities.completionProvider.triggerCharacters))
to see the trigger character of your language server.
augroup CompletionTriggerCharacter
autocmd!
autocmd BufEnter * let g:completion_trigger_character = ['.']
autocmd BufEnter *.c,*.cpp let g:completion_trigger_character = ['.', '::']
augroup end
let g:completion_trigger_keyword_length = 3 " default = 1
NOTE completion-nvim will ignore keyword length if you're on trigger character.
completion-nvim doesn't trigger completion on delete by default because sometimes I've found it annoying. However,
you can enable it bylet g:completion_trigger_on_delete = 1
let g:completion_timer_cycle = 200 "default value is 80
(top 24 of 29)
1,700 followers · starred May 2020
1,854 followers · starred Oct 2020
234 followers · starred Sep 2020
160 followers · starred Jun 2021
A async completion framework aims to provide completion to neovim's built in LSP written in Lua
Lua
957
440 commits
updated Oct 12, 2021
If you are looking for an autocompletion plugin, the neovim LSP team recommends either nvim-cmp or coq_nvim.
completion-nvim is an auto completion framework that aims to provide a better completion experience with neovim's built-in LSP. Other LSP functionality is not supported.
libuv api.Demo using sumneko_lua

Plug 'nvim-lua/completion-nvim'
on_attach function like this.lua require'lspconfig'.pyls.setup{on_attach=require'completion'.on_attach}
pyls to whichever language server you're using.on_attach function directly:" Use completion-nvim in every buffer
autocmd BufEnter * lua require'completion'.on_attach()
NOTE It's okay to set up completion-nvim without lsp. It will simply use another completion source instead(Ex: snippets).
built-in sources
ins-complete sources
:h ins-completion and wikiexternal sources
vim-dadbod." Use <Tab> and <S-Tab> to navigate through popup menu
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" Set completeopt to have a better completion experience
set completeopt=menuone,noinsert,noselect
" Avoid showing message extra message when using completion
set shortmess+=c
let g:completion_enable_auto_popup = 0
CompletionToggle"map <c-p> to manually trigger completion
imap <silent> <c-p> <Plug>(completion_trigger)
<Tab> as trigger keysimap <tab> <Plug>(completion_smart_tab)
imap <s-tab> <Plug>(completion_smart_s_tab)
" possible value: 'UltiSnips', 'Neosnippet', 'vim-vsnip', 'snippets.nvim'
let g:completion_enable_snippet = 'UltiSnips'
UltiSnips, Neosnippet, vim-vsnip and snippets.nvimcompletion-nvim can integrate
with other LSP snippet parsing plugin for this support.Right now, vim-vsnip (requiring vim-vsnip-integ) and snippets.nvim are supported.
completion-nvim supports chain completion, which use other completion sources
and ins-completion as a fallback for lsp completion.
See wiki for details on how to set this up.
<CR> is used to confirm completion and expand snippets, change it bylet g:completion_confirm_key = "\<C-y>"
" " and add escape key \ to avoid parsing issues.<CR>. You can avoid using the default confirm key option and
use a mapping like this instead.let g:completion_confirm_key = ""
imap <expr> <cr> pumvisible() ? complete_info()["selected"] != "-1" ?
\ "\<Plug>(completion_confirm_completion)" : "\<c-e>\<CR>" : "\<CR>"
let g:completion_enable_auto_hover = 0
let g:completion_enable_auto_signature = 0
"alphabet", change it by" possible value: "length", "alphabet", "none"
let g:completion_sorting = "length"
"none".There are three different kind of matching technique implement in
completion-nvim: substring, fuzzy, exact or all.
You can specify a list of matching strategy, completion-nvim will loop through the list and assign priority from high to low. For example
let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy', 'all']
NOTE Fuzzy match highly dependent on what language server you're using. It might not work as you expect on some language server.
g:completion_matching_ignore_case = 1
g:completion_matching_smart_case = 1
completion-nvim respect the trigger character of your language server, if you
want more trigger characters, add it bylet g:completion_trigger_character = ['.', '::']
NOTE use :lua print(vim.inspect(vim.lsp.buf_get_clients()[1].server_capabilities.completionProvider.triggerCharacters))
to see the trigger character of your language server.
augroup CompletionTriggerCharacter
autocmd!
autocmd BufEnter * let g:completion_trigger_character = ['.']
autocmd BufEnter *.c,*.cpp let g:completion_trigger_character = ['.', '::']
augroup end
let g:completion_trigger_keyword_length = 3 " default = 1
NOTE completion-nvim will ignore keyword length if you're on trigger character.
completion-nvim doesn't trigger completion on delete by default because sometimes I've found it annoying. However,
you can enable it bylet g:completion_trigger_on_delete = 1
let g:completion_timer_cycle = 200 "default value is 80
(top 24 of 29)
1,700 followers · starred May 2020
1,854 followers · starred Oct 2020
234 followers · starred Sep 2020
160 followers · starred Jun 2021