Smart Caps Lock: Remap Caps Lock to Escape AND Control

Photo of author

As a Vim user, I hit the Escape key to switch to normal mode. The Escape key is unfortunately located at the top left corner, so hitting it requires lifting your hand from the keyboard, which is non-ideal. So I converted the Caps-Lock key to the Escape AND Control key following this guide: Remap Caps Lock.

Now, when I press my Caps Lock key, it acts as the Escape key and if I press and hold my Caps Lock key, it acts like the Ctrl key 🤯.

If you think about it, this makes perfect sense!

  • Caps Lock: There is no need for the Caps-Lock key in this modern age. NOBODY WRITES IN ALL CAPS ANYMORE, unless they need to shout. For the occasional capitalization need, we use the Shift key.
  • Escape: You always use the Escape key by pressing it once. There is no need to hold it in a pressed state.
  • Control: The Ctrl key is always used by pressing and holding it, while another key is pressed together with it. There is no use case for a single tap.

All of this above is combined into one single key: the Smart Caps Lock key 🎊.

Commands to Remap Caps Lock on Linux

On Linux, it’s as simple as:

# Install XCAPE: A Linux utility to configure modifier keys to act as other keys
# when pressed and released on their own.
sudo apt-get install xcape

# make CapsLock behave like Ctrl:
setxkbmap -option ctrl:nocaps

# make short-pressed Ctrl behave like Escape:
xcape -e 'Control_L=Escape'

Add the commands to your auto-start config to remap Caps Lock when you connect to your X session. I use X11 so I updated my .xinitrc file.

What about Mac and Windows?

The guide has instructions for remapping Caps Lock on Mac and Windows too. It didn’t seem as simple as Linux though. Or maybe I am just more used to Linux.

Conclusion

IMO, it’s a game-changing hack. It should be useful for non-vim users too (probably). Remapping Caps Lock should save you significant time since you won’t need to lift your hand to hit the Escape key anymore. Well, at least that’s what I like to believe, but maybe that borders on being delusional.

🗞️ Don’t miss the latest posts!

Subscribe to the Weekly Newsletter

I won't spam. Promise!

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments