1

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>.

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.