Vim Tips Wiki

Swap caps-lock and control keys using MS Windows Registry

Revision as of 09:32, May 26, 2009 by JohnBeckett (Talk | contribs)

1,619pages on
this wiki

Obsolete tip

This tip has been merged into another tip.
See VimTip75 for the current tip.

Please do not edit this tip, and do not edit the discussion page.
If anything needs to be improved, please fix VimTip75.

Tip 353 Printable Monobook Previous Next

created October 29, 2002 · complexity basic · author Jacques Petit · version 5.7

On Windows systems, you can edit the registry to change the code produced when a key is pressed. This tip shows how to change the keyboard layout so that the CapsLock key acts as a Ctrl key.

Replacing CapsLock with Ctrl

Place the following text into a text file with the extension *.reg and update your registry by double-clicking the file:

[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

You will probably need to reboot your machine for this system change to take effect.

Undoing the change

The verified way to reverse this setting is to delete the new scan codes key that was added.

(tested this on one of my machines)

Swapping keys rather than replacing CapsLock

The registry entry above sets CapsLock to Ctrl. The following registry entry swaps the CapsLock and Ctrl keys on your keyboard. Useful if you sometimes use CapsLock.

[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

Setting the key layout for the current user

If the machine has multiple users who might not like the new layout, instead of using [HKEY_LOCAL_MACHINE\....] you can specify [HKEY_CURRENT_USER\Keyboard Layout]. This will make the changes for one user account only. Additionally, simply logging off and back on will apply the changes (no need to reboot).


Some explanation is here.

A more detailed explanation and reference can also be found here.

Around Wikia's network

Random Wiki