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"
        echom "CONTINUIE"
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>.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.