hrsh7th / nvim-cmp

A completion plugin for neovim coded in Lua.
MIT License
8.08k stars 400 forks source link

Minimum number of chars for completion #1922

Open AllergicMushroom opened 6 months ago

AllergicMushroom commented 6 months ago

I am trying to construct my Neovim setup with nvim-cmp and I want to configure it so that the floating window of propositions only opens after two letters of the word are typed.

I tried the following :

require('cmp').setup({ ... completion = { keyword_length = 2 } })

It almost worked. If I type two letters, the floating window appears with useful suggestions. If I type one letter, the floating window does not appear. If I type nothing, the floating window appears with a lot of bloat. I'm trying to get rid of this case as well.

Because I use nvim-cmp and copilot, both with the same key for confirming, the floating window appearing when nothing is typed is extremely cumbersome.

Is there another setting for the floating window appearing only after x letters have been typed ?

MariaSolOs commented 2 months ago

I think you have to set the keyword_length on each completion source.

AllergicMushroom commented 2 months ago

I tried doing that, to no avail.

However, I just noticed that what I first tried works perfectly, except when I also load the cmp-cmdline package.

I think this issue can be closed.