1

I'm in the habit of just hitting alt+[whatever] when I want to exit of insert mode (esc is just too far away - it's the one thing I can't for the life of me understand about vi/vim/etc.). This works, if I remember right, because the terminal translates this as an esc char, and then the following char.

Now I'm using a plugin for python. I have little code completion popup menus while I'm typing all the time. If I hit alt-j, or whatever, while a popup menu is open it closes the menu, types j and doesn't exit insert mode. Hitting esc always works. This is really messing with my muscle memory. Any idea why the alt trick doesn't work in this case?

1
  • 1
    You could always use <C-[
    – D. Ben Knoble
    Commented Aug 29, 2019 at 4:47

1 Answer 1

1

Ok, I guess I should not rely on how alt is interpreted? Formalizing my alt-movement as escape habit as a mapping gave me back consistent behavior. I put the following in vimrc:

" exit by using alt-movement
imap <m-j> <esc>j
imap <m-k> <esc>k
imap <m-h> <esc>h
imap <m-l> <esc>l
1
  • 2
    You probably want inoremap there.
    – D. Ben Knoble
    Commented Aug 29, 2019 at 4:46

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.