Sunday, March 15, 2009

How to Swap Control and Caps Lock on Windows

A lot of programmers like to swap caps lock and control. This is especially big with Emacs users, so they can avoid "emacs pinky" from constantly holding down the control key at the bottom corner of the keyboard. The caps lock location is much easier to reach and can make a huge difference if you use a lot of control key combinations. Swapping these keys is pretty easy on Linux, but on Windows, you have to hack the registry.
Create the following file, then double-click it to import it into the registry.

caps-ctrl-swap.reg:
REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,1d,00,3a,00,3a,00,1d,00,00,00,00,00
You can also navigate to that part of the registry and add that value.

The only problem with this is that when someone else using the computer needs to use the control key, they use the default one, not realizing that they are swapped. This is followed by confusion, questions, explanations, weird looks, etc...

So, another option is to change only the caps-lock key, leaving you with 2 control keys on the left-hand side of the keyboard. That registry value looks like this:


REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00

No comments: