0

I am working on RHEL 6.4.

In my old system running on RHEL 5.3, the Home is mapped to ^[[1~ and End is mapped to ^[[4~.

In the new system, Home is mapped to ^[[H and End is mapped to ^[[F, which is causing some undesirable behaviour in my application.

Please tell me how can I change this?

terdon
  • 242,166
stany
  • 591

2 Answers2

2

You will need to modify the keymap in xterm's X resource.

*XTerm*VT100.translations:      #override \n\
        None<Key>Home: string(0x1b) string("[1~") \n\
        None<Key>End: string(0x1b) string("[4~") \n
0

While you can change keys using the translations resource, there are pros/cons. If you do not use that resource, by itself xterm provides several other resources (including some that can be switched via menu entries). If you use the resource, the keys cannot be switched via the menu entry.

The Home and End keys can be switched between "PC-style" ^[[H and ^[[F to "VT220-style" ^[[1~ and ^[[4~ using the VT220 Keyboard menu entry.

In addition to the menu entry, the same switching can be done using a control sequence:

CSI ? Pm h
          DEC Private Mode Set (DECSET).
            Ps = 1 0 6 1  -> Set VT220 keyboard emulation.
CSI ? Pm l
          DEC Private Mode Reset (DECRST).
            Ps = 1 0 6 1  -> Reset keyboard emulation to Sun/PC style.

which you could use in a script:

printf '\033[?1061h

changing the keyboard type to VT220.

These features predate RHEL5, by the way. Red Hat used to override the xterm resources, as mentioned in the FAQ Why can't I use the home/end keys?.

Thomas Dickey
  • 76,765