I reassigned left ctrl key to capslock key to use ctrl in Emacs.

Is there a way to bind right and left ctrl keys separately?

For example, I want to bind left-ctrl-a to select all and right-ctrl-a to beginning-of-line. In other words, I want to emulate ctrl and command key concept of OS X.


Unfortunately, there's just one control modifier supported in X11:

$ xmodmap -pm
xmodmap:  up to 5 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
control     Control_L (0x25),  Control_R (0x69)
mod1        Alt_L (0x40),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod4        Hyper_L (0x42),  Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

As you can see, although there are seperate key symbols for left and right Ctrl, both of them are bound to the same modifier, control. You could however bind your Ctrl_L to another modifier, not used elsewhere (in the above example, this could be mod3, for example) and configure your Emacs to use C-a (which would be your right Ctrl) as usual (beginning-of-line) but tell it to handle Mod3-a (your left Ctrl) as you prefer.

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.