← Back to context

Comment by NalNezumi

14 hours ago

I think one (often forgotten) good advice to get used to the mode-switching is to move the ESC key to Capslock on the keyboard. It's tedious to learn to always go to the ESC key, upper left of the keyboard. Capslock is available from home row, and you should probably not use CAPSLOCK anyway, it's a bad practice.

Put ESC key there instead and vim becomes wayyyyyyyy more ergonomic.

Indeed! Sometime between 2010 and 2015, I used to often work with Windows computers, so I wrote a tool for myself back then to remap Caps Lock to Esc on Windows machines:

https://github.com/susam/uncap

While it was certainly possible to do that by editing Windows registry (and I have noted those techniques too in the README), registry changes couldn't be enabled or disabled without a reboot. That's what motivated me to write the above tool. And indeed, having the Caps Lock work like Esc made using Vim a much better experience!

I map 'jk' in Insert mode to <Esc>. In Insert mode, it takes me out to Normal mode. If I'm already in Normal mode, it simply moves down a line and right back up. This habit is so burned into my muscle memory that I often end up typing 'jk' into non-Vim input areas (like this HN comment box).jk

I’d recommend taking it even further and mapping capslock to escape when pressed by itself and CTRL when held in sequence with another key.

at most one y in way since Capslock is an unergonomic key in itself - it requires an unergonomic lateral movement of your weakest finger of your weaker hand