How do I turn Caps Lock into an extra Control key? [duplicate]

I'd like to remap my keys such that Ctrl behaves as the Caps Lock key and vice-versa. Also, if possible I'd like the settings to be available only within the currently logged-in user. How can I achieve this?

I'm a vim user, unlike the other people who use this machine, so I'd like those settings only for my account.


13.10+:

Install and use gnome-tweak-tool > Keyboard & Mouse > Keyboard > Additional Layout Options > Caps Lock behavior.

Pre 13.10:

Open the Keyboard Preferences dialog (System -> Preferences -> Keyboard). On the layout tab, click the Options... button. Expand the Ctrl key position section and select Swap Ctrl and Caps Lock.

Those settings should be applied each time you log in, and will only affect your user account.


Here's a way to do it without installing extra software:

setxkbmap -layout us -option ctrl:swapcaps

Source:

  • http://www.noah.org/wiki/CapsLock_Remap_Howto