The Best Keyboard Hack Ever
The Best Keyboard Hack Ever
Join the DZone community and get the full member experience.Join For Free
There's a key on my keyboard that I have spent most of my typing career learning not to press. Right next to
A and right above
Shift, it seems impossible to avoid. It MAKES ME SOUND ANGRY when I'm not. It stops many a password from working. And I pretty much never intentionally use it. Caps Lock is just an outdated relic. Why couldn't keyboard designers have had the foresight to put it way up there with
But my feeling of Caps Lock bitterness have changed. A friend of mine introduced me to the best keyboard hack ever: Re-map Caps Lock. With a little bit of clever re-configuration, you can change Caps Lock to act like a custom function key (like
Command). And if you do it right, you get one huge advantage: Since this is non-standard, you basically get an entire keyboard of mapping possibilities. No need to worry about accidentally overriding some other app's keybindings!
On my Mac, the idea is to map Caps Lock to the chord
CONTROL-SHIFT-COMMAND-OPTION. In other words, when I press Caps Lock, it behaves as if I am holding down the control, shift, options, and command buttons all at the same time. There are no keybindings so absurd that they use that particular combination, so I can map pretty much anything I want.
While the idea is conceptually simple, the actual configuration is tricky. I followed the excellent instructions in Steve Losh's "Modern Space Cadet" blog post, and that got me going in a few hours.
With that done, I went about remapping keys. Here are some of the key combinations I started with. I've substitute "CL" for "Caps Lock":
- CL-a: Toggle my iTerm2 terminal. I use a Quake-style visor setup, so when I press CL-a, my terminal slides down from the top (or slides off the screen if it's already displayed).
- CL-s: Bring Chrome to the front.
- CL-d: Bring Dash to the foreground.
- CL-SPACE: Bring VIM to the foreground.
- CL-z: Show a list of all running apps.
- CL-x: Show a list of all of the windows for the currently focused app.
You may notice that these are mostly selected due to the ease of hitting these chords with my left hand.
CL-SPACE map to the two apps I use most often.
To get each of these working exactly the way I wanted took some work. One tool that makes setting up elaborate keybindings much easier is BetterTouchTool, which also has some great gesture support. I've also picked up just enough Applescript to be able to whip out some simple commands.
Oddly enough, the worst part of the process has been re-training my hand to hit the Caps Lock key. But it's so convenient that gaining new muscle memory is happening very quickly.
Published at DZone with permission of Matt Butcher , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.