I've been mapping my caps lock key on windows machines to various keys (I have tried both Backspace, which I have never gotten used to due to deeply ingrained habit, and Esc, which will take time to get me to transition to with Vim) and I'm looking to map my caps lock to a custom function now, so that I can differentiate it from Esc.

I find that the keyboard shortcuts on the left-side of the keyboard (e.g. Ctrl+A, Ctrl+F) are more "valuable" in a sense because they can be easily dispatched without the right hand present. This is the reasoning for trying to make better use of the caps lock key.

While I intend to transition from the Esc key to the caps lock key for Vim, I don't want to leave the caps lock key mapped to Esc because that effectively wastes a key. Furthermore, the chord Ctrl+Esc (prime ergonomic real estate: ctrl and caps lock) will simply trigger Windows' Start menu.

I can most likely map some arbitrary key to do the function of Esc within Vim, and I'd also like to make use of Ctrl+Capslock in the terminal for Tmux (for toggling to the last active pane).

So the question is, what's a good key that (in order of importance)

  • is not Esc
  • can be used to map to Esc for Vim
  • can be recognized and differentiated from its ctrl chord by the terminal
  • all of the above, but on OS X as well (using iTerm)
  • is not indistinguishable from some other key already present on the typical keyboard
  • can perform some kind of useful task (or at least do nothing) under normal OS usage

that I can map my Caps Lock to via the Registry on Windows, and hopefully I can do the same on OS X?

Currently it appears that I may be able to map it to F13 on Windows. I'll work through my checklist and post back.

Update: Could not get PuTTY to play nice with my F13 mapping, so I resorted to mapping to F11. It sends the sequence recognized by tmux's F11 binding, so a single press of caps lock toggles panes in tmux now. Now the answer I'm looking for is how to get any of the F keys to be differentiable for PuTTY when Ctrl is used.

2 Answers 2


I guess you could also map it to F13 on OS X (using PCKeyboardHack). If you for example want F13 to focus the location bar in Chrome, you can add this to private.xml in KeyRemap4MacBook:

<autogen>__KeyToKey__ KeyCode::F13, ModifierFlag::NONE, KeyCode::L, ModifierFlag::COMMAND_L</autogen>

This repository has solutions that work for Linux, OS X and Windows:

The purpose is to have capslock as ESC when clicked and as CTRL when chorded with another key (e.g. CTRL + a).

The solutions given there I do use in all three operating systems without issues.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .