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?.