I would like to know how to remap some of the default keys for x-term.

Specifically I would like to remap the Cntrl+leftArrow and Cntrl+rightArrow keys to move a word forward or backwards. I would also like to remap Alt+leftArrow and Alt+rightArrow keys to move to the start and the end of a line.

I have managed to install and get rxvt keys remapped by editing the .inputrc however I believe that x-term does not use this file. I think I need to edit the ~.Xresources file and edit the VT00 translations but I don't really understand how the values for corresponding key mappings work.

Thanks for your help


Instead of remapping the keys (presumably to Ctrl+A and some such), and thereby making them indistinguishable from the combinations they're mapped to, you can bind their keycodes in the readline configuration file ~/.inputrc, like so:

"\e[1;5C": forward-word
"\e[1;5D": backward-word
"\e[1;3C": end-of-line
"\e[1;3D": beginning-of-line
| improve this answer | |
  • My issue is that I have added this declaration to .intputrc, which works for rxvt however doesn't for x-term. – binarycreations Nov 27 '11 at 22:57
  • Rxvt uses different keycodes for modified arrow keys than xterm does. So do try the bindings I showed there. – ak2 Nov 28 '11 at 0:54
  • Different terminals use different values for keycodes! Is this because they try to emulate different types of old fashioned terminals? How are you supposed to find out about these values? – binarycreations Nov 28 '11 at 16:55
  • This worked, bit would you be able to answer my previous question. – binarycreations Nov 28 '11 at 22:38
  • I think that's a good question for unix.stackexchange.com. – ak2 Nov 29 '11 at 5:32

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.