tcshxterm

How to configure xterm to delete word after cursor when Ctrl+Del is pressed?


Currently, I have the below configuration in .Xresources file to delete word before cursor on Ctrl+Backspace. But, I couldn't figure out the configuration for deleting word after cursor.

xterm*VT100*translations:       #override \
    Ctrl <Key> BackSpace: string(0x1b) string(0x8)

I am using tcsh.


Solution

  • There are two steps here: First, Xterm translates a ctrl-backspace key sequence to the (ASCII) characters ESC, BS (1b, 08 in hexadecimal) and then tcsh interprets that as "delete word left". The corresponding tcsh command sequence for "delete word right" is ESC and the letter 'd' (or 'D'), so a similar translation but with string(0x1b) string(0x64) (0x64 being the ASCII code for 'D') should do it. (There is probably a shorter way of writing that, but I have not dealt with Xterm keyboard translations in over 15 years and my memory is a bit hazy on the details...)