2

I'm using tmux 2.0 on CentOS 6.7(without X). How can I use Caps Lock instead of Ctrl in tmux?

1

Unfortunately, you cannot do it at the tmux layer. The tmux man page man tmux has a section titled KEY BINDINGS which lists the special keys that can be mapped within tmux. Caps lock is not one of them:

In addition, the following special key names are accepted: Up, Down, Left, Right, BSpace, BTab, DC (Delete), End, Enter, Escape, F1 to F12, Home, IC (Insert), NPage/PageDown/PgDn, PPage/PageUp/PgUp, Space, and Tab.

Fortunately, you should be able to do it easily at the CentOS layer.

There are a few ways of doing it, I prefer the following:

setxkbmap -layout us -option ctrl:nocaps

xmodmap -e 'clear Lock'

xmodmap -e 'keycode 0x7e = Control_R'

xmodmap -e 'add Control = Control_R'

Which you can put into your .bashrc file, or wherever commands are run on startup of your system.

There may also be a way to change the keyboard layout in a configuration program within CentOS. I'm not very familiar with it, but Caps Lock to Control is a pretty common request and you should be able to find it if you search for doing it in CentOS, Linux, or anything other than tmux.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.