Often, insert-mode completion can take some time (e.g. <C-x><C-l>
on a common prefix in your project). <C-c>
interrupts this. I'd like to map another key to also have this interrupt behaviour, like so:
inoremap <C-k> <C-c>
However, it seems that on <C-k>
, the mapping only gets processed after the completion finishes, contrary to <C-c>
.
How can I make my mapping also interrupt insert mode completion?
Edit:
To clarify, the problem is not about detecting whether we are in completion-mode. This can be achieved with pumvisible()
or complete_info()
. The problem is that before the popup menu appears, that is, when vim is (slowly) scanning a completion, the mappings don't trigger until scanning completes, unlike <C-c>
(defeating the purpose of mapping something to <C-c>
), which immediately interrupts the scanning without waiting for scanning to finish.