Remapping Caps Lock to Control and Escape in macOS Big Sur

For more better text editing and great success.

I’m a big fan of VIM modal editing and keeping keyboard shortcuts as close to the home row as possible. This philosophy allows fluid text editing and staying in the “programming flow state”.

Remapping the Caps Lock key to Control and Escape is a big part of this workflow. Pressing and releasing sends the Escape key, while pressing and holding emulates the Control Key.

In macOS, I’d been using Karabiner Elements to enable this remapping, however with macOS Big Sur I could no longer get the configuration to work. This was a serious annoyance, since the VIM shortcuts are burned into my fingertips.

Enter HammerSpoon! Using the ControlEscape plugin, I am now back in remapping bliss. Below are the System Preference settings required to make this setup work.

Troubleshooting

If you use multiple keyboards with your mac, for example an Apple Magic bluetooth keyboard, the modifier keys are configured individually for each one – so make sure the correct keyboard is chosen in the “Select keyboard” dropdown:

Leave a comment