Hacker News new | ask | show | jobs
by eridius 3551 days ago
Maybe you should wait until the products are released before judging them.

Also, a VIM user that actually uses the escape key? I don't know how you tolerate that. I bound jk to escape years ago, and in the rare case where I'm ssh'd into a machine that doesn't have my vim config I still find ^[ easier to type than escape (which is probably because I bound caps lock to control so ^[ is easy to type).

2 comments

I don't use VIM a lot, mostly when committing stuff in git, so I'm quite naive about it.

How would you get out of insert mode by writing jk? Or, how would you write jk in insert mode without exiting?

Add the following to your .vimrc:

  if !&insertmode
    inoremap jk <esc>
    snoremap jk <esc>
  endif
(the insertmode bit can probably be dropped, but it's technically correct)

With this mapping, typing "jk" in insert mode acts as if you'd hit escape instead (so it doesn't type the j or the k). To type jk in insert mode without exiting, you either wait a second after hitting the j (once it shows up on screen you're good) before hitting the k, or if you're impatient you hit another key and then hit delete before the k, e.g. "jj<delete>k". The reason this mapping is popular is because "jk" is extremely rare to type in insert mode; you usually only type it if you're typing out the alphabet, or if you're talking about how you map jk to escape.

The only annoyance here is if you type j by itself, you don't actually see the letter show up immediately. This is because Vim is waiting to see if you're going to type a k. If you type nothing, after a second Vim will timeout and decide you're not invoking the jk mapping after all (and will then show the j). Or if you hit anything besides k then you're obviously not triggering the mapping. You can observe this behavior with any other multi-character mapping you might have as well (e.g. anything with <leader> or <localleader>).

Using the escape key doesn't bother me at all. I'm not sure why. Just feels second nature at this point.