(updated ) by

Map Capslock to Escape on Linux

If you do VIM you may want to remap your escape key to capslock. I personally never use capslock but it is easier to reach than ESC.

X Keyboard Extension

If you use X11/Xorg you should have XKeyboard installed. This gives you access to the setxkbmap program.

setxkbmap

setxkbmap -option caps:escape

Note: setxkbmap only sets the current xorg session.

If you want it to set on starting xorg (startx) then you should put it in your startup scripts for xorg.

  • ~/.xinitrc - Basic initial startup for xorg
  • ~/.Xmodmap - Mappings map for xorg. May not be loaded by default.
# Map capslock key to escape
setxkbmap -option caps:escape