Saturday, June 14, 2008

Disable Caps Lock

The only time I use the caps lock button on my keyboard is when I accidentally press it and start typing in UPPERCASE. To disable it in Linux all you have to do is enter this on the command line:

 $ xmodmap -e "remove lock = Caps_Lock"

To set this permanently, paste the above line in your ~/.bashrc file

or if you are a vim user and you want to swap caps lock for your escape key

do the following

create the following file in your home directory

.Xkbmap

put the line below in the said file:
-option caps:swapescape

or if you don't want to swap the two keys around, instead you just want caps lock to behave the same as escape and escape key to still be the escape key.
Then put the following line in instead
-option caps:escape

The next time you log-in into an X session, the changes will take effect. Alternatively you can just run the command
setxkbmap`cat ~/.Xkbmap`
and the changes will take effect immediately.

No comments: