I generally run Linux. I use Vim a lot, so the Escape key is extremely important. I also use other keyboard shortcuts a lot, so Control is "key" as well. On Linux, I've solved this by using xcape to map the Caps lock key to Escape if pressed by itself, or Control if pressed in combination with another key. This puts the best of both worlds within quick reach of my pinky finger. Is there any way I can do this on a Mac?
First, go into the Keyboard preference pane, click "Modifier Keys…", and change Caps Lock to Control. Then, go into Karabiner and search for this option:
Control_L to Control_L
(+ when you type Control_L only, send Escape)
Check that, and you're done. With Karabiner you can do lots more interesting things, like mapping your (now kind of useless) Escape key to a Hyper key with even more keybindings.
Karabiner is currently incompatible with MacOS Sierra. Another, Sierra-friendly solution, is with Keyboard Maestro (it is not free). Change the behavior of the Caps-Lock key to Control through
System Preferences ->
Modifier Keys as others have suggested.
Then within Keyboard Maestro, setup a macro as follows:
- Triggered by
USB Device Key Trigger
- Press the Caps-Lock key on your keyboard
- is tapped once
- with these modifiers:
- (you will need to repeat the previous trigger for each USB keyboard you use)
- Then add an action
Type a keystroke
- Press Esc