Map CapsLock key to Esc
From Vim Tips Wiki
[edit] Duplicate tip
This tip is very similar to the following:
These tips need to be merged – see the merge guidelines.
Tip 1083 Previous Next Created: December 23, 2005 Complexity: basic Author: Ralf Holly Version: 5.7
TO DO
- Merge info from comments to some relevant place.
- The original tip (now removed) used a registry file to remap CapsLock to Esc. The file was wrong (it used "ControlSet001" instead of "CurrentControlSet"), and was a duplicate of VimTip75.
[edit] Comments
In Linux, you can change the keyboard-layout using a tool called xmodmap.
Write the following line into a file (e.g. ~/.xmodmap-esc)
clear Lock keycode 0x42 = Escape
and load it by running
xmodmap ~/.xmodmap-esc
or you can just run
xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'
in your X start up file.
I know how to turn caps off in Tiger (or turn it into a Ctrl key):
- Open System Preferences
- Goto Keyboard & Mouse
- At the bottom of the panel there is a "Modifier Keys..." button, click it
- Choose "No Action" or "^ ctrl" for caps-lock
For Panther one can look at uControl (http://gnufoo.org/ucontrol/ucontrol.html).
On any X windows implementation you can use:
xmodmap -e 'keycode 66 = Control_L' xmodmap -e 'clear Lock' xmodmap -e 'add Control = Control_L'
to make your caps lock work as control, like on Sun keyboards. Which is a little easier to use IMHO.
For X11, it's convenient to use this xkb configuration:
Option "XkbOptions" "grp:alt_shift_toggle,ctrl:nocaps,grp_led:scroll"
ctrl:nocaps is the trick.
This is for mapping caps lock to control, of course. Then use ctrl-[ to send escape.
