Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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
share|improve this answer
    
My issue is that I have added this declaration to .intputrc, which works for rxvt however doesn't for x-term. –  Graham 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? –  Graham Nov 28 '11 at 16:55
    
This worked, bit would you be able to answer my previous question. –  Graham 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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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