How to trigger autocomplete suggestion box in vim or neovim (Plugin neoclide/coc.vim)
Solution 1
I've commented in https://github.com/neoclide/coc.nvim/issues/2299#issuecomment-686293001
The suggestion box in your image is signatureHelp. If you want to reopen it, you need to trigger
triggerCharacters
in your function, usually is(
and,
. The triggerCharacters is defined by LS.
Solution 2
Yes, the answer is on the front page of CoC's github project. You need to map something to coc#refresh(). For instance, to use Ctrl + Space to trigger completion, you need to put the following in your vimrc:
inoremap <silent><expr> <c-space> coc#refresh()
There are more examples on the project's page.
Solution 3
TLDR: try this Ctrl+@
I found this in README of neoclide/coc.nvim:
" Use <c-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
The weirdness here is that, Ctrl+Space is not working, despite using neovim NOT vim.
But there is a good trick to get your desired key binding as it appears from your terminal emulator point of view:
- Enter
insert
mode - Press Ctrl+v
- Then press your keys you want to bind, Ctrl+Space
It seems that my terminal doesn't recognize using Ctrl and Space. "I think this is the real problem!"
Edit
Steps to solve it:
- I changed the default coc config a little bit:
inoremap <silent><expr> <c-space> coc#refresh() inoremap <silent><expr> <c-@> coc#refresh()
- I tried bash as I was using zsh as a shell, but the problem is still there.
- Then I tried another terminal emulator and the problem is solved, alhamdulilah.
dev-stefancho
Web developer, Frontend Developer. Language Korean, English
Updated on June 14, 2022Comments
-
dev-stefancho almost 2 years
I'm Neovim user
and I use Plugin neoclide/coc.vim for autocompletion
but when my cursor focus out, I can not get suggestion box again
(How can I call this box? suggest box or hint box? I want to know this box name)I want to trigger it and see again, Is there any command or variable for this?