Fallback actions in `c` mode might be bugged for `Esc`
So I'm trying to configure cmp in the following way:
- The completion is supposed to appear as I type (works with
autocomplete = true); - Navigate down/up the list by using
C-jandC-k(this works correctly); - Confirm using
Tab(also works correctly); - Close the menu using
Esc, if there is an item selected. Otherwise, run the defaultEscaction (go to normal mode for insert mode, or cancel the command in prompt mode).
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.
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
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