Hacker News new | past | comments | ask | show | jobs | submit login

I've found a system wide mapping of 'Caps Lock' to 'Esc'(and vice versa) a much better use of keyboard estate / ergonomics.

Although the mapping was prompted by Vim usage, it's surprisingly useful for general computing as well.




Me too. I put escape on my caps lock key on my Ergodox and it's awesome. I miss it whenever I use another keyboard. Escape gets a lot of use everywhere and is in kind of an awkward spot, while for me at least caps lock is literally never used and is in a very comfortable spot.


Me too. When I get a new system, the first thing I do is map CapsLock to Escape.

On Windows, I use the Uncap [ https://github.com/susam/uncap ] tool because it does not require install or restart. The tool has good documentation to map CapsLock to Escape for Linux and MacOS too.

On the flip side, I struggle to use Vim when I need to do so someone else's computer. :-D


IMO making it a control key is a better choice (I tried both at some point) because chording with awkward keys is worse than just pressing them, and the control keys are placed awkwardly on most keyboards. Since you can end insertion mode with ^[ you then have a pretty comfortable chord that doesn't stray far from the home row to replace the escape key.

I had a tool on a mac that would make caps lock equivalent to escape if it was pressed and released alone, and control if it was chorded. Sounded great on paper but I underestimated how often i press control before realizing I don't want to perform a chord.


Make it both! From http://www.economyofeffort.com/2014/08/11/beyond-ctrl-remap-...

  xcape -e 'Caps_Lock=Escape;Control_L=Escape;Control_R=Escape'


Karabiner Elements is great for doing this kind of remapping on macOS

https://pqrs.org/osx/karabiner/

The equivalent for Windows would probably be AutoHotkey

https://www.autohotkey.com/


OS X can natively set Caps Lock (or any of the other modifiers) to CTRL,ALT,CMD,Esc,Caps. in the Keyboard Pref Pane at least as of 10.13.

Of course Karabiner can do quite a bit more than that. But if you can't or don't want to install more software it's a choice available to you.


That's an interesting idea as well. I've always found reaching for the 'Esc' key to be more awkward than the 'ctrl' key, but undoubtedly I use the 'ctrl' key more often than the 'esc' key outside of Vim, so perhaps the sheer volume of use would make it worth it.


My favourite mapping for 'Esc' usage is to map kj to Escape ... super handy

noremap! kj <esc>

https://github.com/patrickdavey/dotfiles/blob/058950c2f470a1...


I found jk to be the best. If I use it in normal mode it is a no op (cursor up and down). The english language (and most all programming languages) don’t have words with a jk sequence in them (unlike kj). It works universally across all keyboards and terminals. My fingers are already there (unlike esc which is just as bad as lifting my hands to use the mouse). Plus in the rare case I do need jk inputed (very very rare) first the default is a safe default (esc) and second the mental load to pause while typing (pressing j wait past the half second timeout then press k) is no different then the mental load to choose to accept the expansion of abbreviations or delay typing to get around the auto expansion triggers.

Jk for the win!!! (Also jj works well to).

I also set my mapleader to <Space> you would be surprised how useful that is. Not to mention , (comma) is a valid and useful vi movement key.


Heh, kj is a no-op too of course (down then up).

I have literally never found myself needing to pause to wait for a k and then a j. What are these words with "kj" in them that you're wary of? I'm genuinely curious :)


Blackjack? In english there are words that end in k while I don’t know of any that end with J.

However my vim set up maps jk, kj, jj, and kk to Esc to in reality it is safe to just mash those two keys and one of the maps will work.


What if you need to type something like blackjack?


The remapping would trigger <esc> when both j and k are held down at the same time, so typing "blackjack" could be an issue if it were typed quickly and/or chorded.


If you needed to type it, you'd have to pause after typing the k (about a second?) then type the j.




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

Search: