When vim suggests completions, I can discard them without accepting with Ctrl+y
I would like to remap that shortcut to Escape
while keeping the usual behavior of Escape
(exit insert mode) when no suggestion box is visible.
The answer provided here https://stackoverflow.com/a/50033076/13801624 lead me to try inoremap <expr> <Esc> pumvisible() ? "<C-y>" : "<Esc>"
however this just makes Escape
do nothing when a suggestion box is visible.
C-E
to end completion (see here: github.com/vim/vim/blob/master/runtime/doc/…)Tab
to scroll through the suggestions, thereforeC-y
allows me to close that box and be able to useTab
to insert a tab. The interesting part is thatC-y
does what I want, but I am unable to remapEsc
to replicate that sequence