The following function, when at the prompt, if one presses <Esc>, then it will print EXIT.
function! Testinput()
let g:searchString = input("Enter search string: ", 'default', 'syntax')
if g:searchString == '' || g:searchString == '\n'
echom "EXIT"
else
echom "CONTINUIE"
endif
endfun
call Testinput()
I mapped <C-[> to <Esc> because when multiline appending or inserting, if one presses <Esc>, then all the line are updated, however if one press <C-[>, then they arent. I tried to fix that inconsistent behaviour with the following mapping to my init.vim:
noremap! <C-[> <Esc>
However when one tries to abort the above function, it always says "CONTINUE". I remapped <C-[>, didnt change <Esc>.
Ctrl-[to Escape and Disable<Esc>but keep<C-[>. – filbranden Apr 29 '20 at 22:07