Sane keyboard layout for X11

So, while xterm and other X apps do (are are supposed to) support the standard unix text edit keybindings, with most PC keyboards you still will need to correct your layout.

In particular, map the worthless Caps Lock key to Control.

Because this is X11, there are about a dozen different ways to do it, all more or less equally hideous, here are some of them.

In your ~/.xinitrc or similar, run:

xmodmap -e 'keycode 66 = Control_L'
xmodmap -e 'clear Lock'
xmodmap -e 'add Control = Control_L'

or if you want to swap Caps Lock into the Ctrl key:

xmodmap -e 'remove Lock = Caps_Lock'
xmodmap -e 'remove Control = Control_L'
xmodmap -e 'keysym Control_L = Caps_Lock'
xmodmap -e 'keysym Caps_Lock = Control_L'
xmodmap -e 'add Lock = Caps_Lock'
xmodmap -e 'add Control = Control_L'

or more simple (although this seems not to work on all versions of X):

setxkbmap -option ctrl:swapcaps

iarwain in #suckless provides yet another variant:

xmodmap -e 'remove Lock = 66'
xmodmap -e 'keycode 66 = Control_L'
xmodmap -e 'add Control = Control_L