0

I have just started using VIM. The one thing that stains me most while using VIM is the Esc key. So after some googling I found this link: Avoid the escape key and used it to map jk to Esc. I put this command in _vimrc file:

imap jk <Esc>

It's working fine. But now my question is if I need to type jk in vim, how should I do it. One way is to type something like jik then remove the i. But is there any better way of doing it?

1
  • 1
    Type the j then wait then type k.
    – FDinoff
    Nov 18, 2013 at 5:18

3 Answers 3

1

If you don't want to wait for the timeout, an alternative is pressing Ctrl + V somewhere, i.e. either <C-V>jk or j<C-V>k. This key combination means "insert next char literally". (On Windows, you often need to use <C-Q> instead.)

1
  • Wait more than timeoutlen milliseconds (:help timeoutlen, :set timeoutlen?)
  • Do something else in the meantime (as you suggest)
  • Don't map key sequences that you're likely to type

jk is a common choice because no English words contain it. If your language does, don't use it, or change it to something you are not likely to bump into.

1
  • sometimes the obvious things just stare you at your face and yet you don't know what to do. Btw, what unit does the timeoutlen uses, milisecond?
    – th1rdey3
    Nov 18, 2013 at 6:43
1

You can type Ctrl[. For me this is easier than reaching for the escape key. See:

:h i_CTRL-[

1
  • I am using VsVim, Ctrl+[ doesn't work for some reason there.
    – th1rdey3
    Nov 18, 2013 at 11:07

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.