Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I have jj mapped to Esc in insert mode. If you type it quickly, the two j characters vanish and you escape out of insert mode. If you type them slowly you get two j characters in your text. I rarely need two j's in my text, of course, so it's a good escape key sequence, but pick whatever you want. I chose jj because it keeps me on home row.


Sometimes my muscle memory winds up telling me it needs. That's how I wound up mapping both jj and ;l to Esc. The first gets used when I've finished an insertion and am about to pause to think (it feels more emphatic) while the second gets used when I'm in flow and know exactly what I'm going to do next.

I once read a thread discussing the topic of Esc replacements and was astounded to learn that some people had reinvented chording: they mapped all the permutations of h,j, and k into Esc replacements and then simply banged all three at the same time to exit!


Speaking of chording, there's a pretty cool vim plugin called "arpeggio", that will allow you to map chords:

http://www.vim.org/scripts/script.php?script_id=2425


Ick, that makes for lag if you just type 'j'.


Hopefully you type fast enough that by the time your brain noticed any lag on the "j", you are already a few letters down the line.

If you are too dependent on visual feedback while typing, you'll have a difficult time typing fast in any environment.

That said, I don't think I'd ever try remapping escape. I have long fingers though.


It's just an ugly way to do a mapping. I used to have some mappings like these in my rc, but I removed them in favor of similar ones that backtrack instead. If the author wants "jj" to be <ESC>, it can be done without the lag: You just check the previous character on 'j' and then take action accordingly.


Can you show us the script you use to make this happen? Sounds interesting.


jk is faster :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: