Nvim Completion Menu Issue

Nvim Completion Menu Issue

I'm using lspkind and nvim-cmp with Neovim 0.7.

When <C-n> or <C-p> is pressed to scroll through the items from the list of possible completions it gets completely overwritten by the standard completion suggestions. See link for an example.

Why does it change from lspkind suggestions to basic completion? Why do I get --keyword completion (^N^P) back to original?

1 Answer

I had the same issue. I solved it by adding

['<C-n>'] = cmp.mapping(cmp.mapping.select_next_item()),
['<C-p>'] = cmp.mapping(cmp.mapping.select_prev_item()),

inside of the mapping list of the LUA config (I'm not actually sure this is a list I only use LUA for Nvim)

mapping = { ...,
['<C-n>'] = cmp.mapping(cmp.mapping.select_next_item()),
['<C-p>'] = cmp.mapping(cmp.mapping.select_prev_item()),
...

The reason for this issue coming up in the first place is that (from the config I copied) the select_next_item/select_prev_item functions simply wasn't bound so there was nothing to overwrite the standard completion.

I found these functions in the cmp documentation.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Alexander Ross
Author

Alexander Ross

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.