How to remap keyboard keys

Published on Author bloggerfive

For instance, the Caps Lock key is sometimes useless for many people. This is a pity, since the key is conveniently located on the home row.

On the other hand, the Esc key is quite useful especially for Vim (Editor)users, but it is sooo far away.

Remap the Caps Lock key to behave as a 2nd Esc key.

This must be done at the OS level.

On Windows:

  • Create a .reg file with the following content:

Windows Registry Editor Version 5.00

 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]

“Scancode Map”=hex:00,00,00,00,00,00,00,00,02,00,00,00,01,00,3a,00,00,00,00,00

  • Execute the file to update the registry
  • Log out and log in again


On Linux:

  • Create a .Xmodmap file in your home directory, with the following content:


       ! Make Caps lock behave as Escape

       keycode 69 = Escape

      remove Lock = Caps_Lock

       keysym Caps_Lock = Escape

        clear lock

  • Run xmodmap ~/.Xmodmap

On MacOSX: