hrsh7th / nvim-cmp

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

Fallback actions in `c` mode might be bugged for `Esc` #1814

Open AntonC9018 opened 5 months ago

AntonC9018 commented 5 months ago

So I'm trying to configure cmp in the following way:

I have been able to achieve this last point, but only for insert mode. For command mode, the fallback action confirms the command instead of cancelling it like it's supposed to work. The relevant code is here: https://github.com/AntonC9018/nvim-config/blob/d24755721dd361038c4311e42c2a9d60fdad78a0/init.lua#L660-L672 It then goes ahead and transforms those keys from { '<Esc>' = ... } into { c = { '<Esc>' = ... } } and assigns them here: https://github.com/AntonC9018/nvim-config/blob/d24755721dd361038c4311e42c2a9d60fdad78a0/init.lua#L765

This might be a bug? I'm not sure. But it's not intuitive for sure. I've spent more than a day just on this already, so I'm really desperate for some help.

AntonC9018 commented 5 months ago

I guess that <C-c> is defined in c mode implicitly, which cancels the command, so the following is a workaround I just discovered https://github.com/AntonC9018/nvim-config/blob/d00bde82a02ccf01b615c663a544dbbb8cfdf4d1/init.lua#L752-L776

Sam-programs commented 4 months ago

This intended behavior for mapped escape in vim and no one really knows why it is the way it is. https://github.com/neovim/neovim/issues/21585