
Xdefaults file in your home directory:īeware that the syntax of the. Usually this is the default binding already.įinally, you can map keysyms to TTY characters by creating a. For example, my keyboard correctly maps keycodes 59 and 125 to BackSpace and Delete keysyms:Īnother keyboard (with keys at a different position may have the following mapping: With this information, you can use the xmodmap program to define a mapping from keycode to a keysym. You can determine the keycodes using the xev program, which diplays all X events. The mapping between keys on the keyboard and keycodes is fixed. keystrokes on the keyboard to keycode(s).To make matters slightly more complex, Xterm not only has a mapping from keys to TTY characters, but has the following mappings: If it lists erase = ^H, then you have the wrong keymapping. If it is correct, do not change the terminal settings, but instead, change the application behaviour.Īn alternative (but less reliable) way to find the keymap is to use the stty command: If it isn't, change the mapping, as explained in this section.

Make sure that you are currently using the VT220 mapping: Meaning that backspace is mapped to the DEL (127, 0x1F) character. This will print the characters that are sent to the terminal.įor example typing control-V + backspace prints: You can determine the current mapping using the "control-V trick": First press control-V, then the keystroke you like to examine. Keystroke to TTY mapping Determine Current Mapping

Your first action is to make sure you are already using the VT220 mapping. The VT220 mapping is more-or-less the default in most Linux distributions. If you read this page, you most likely have problems with your current application behaviour and want to change the keystroke and characters mappings.

The disadvantage of the change is of course that both the TTY keymapping as well as the default application behaviour had to be changed. control-F for find, or perhaps control-H for help).įor this reason, the behaviour was changed again, to the following mapping, which is now the default in most Linux distributions: The disadvantage of the X-term behaviour was that control-H could not be used by applications just like other control-shortcuts by GUI applications (e.g. This is slightly more logical, and the advantage was that the mapping of TTY character to application behaviour did not have to be changed. The X-term emulation of VT100 did it differently: So the delete key was undefined and not the backspace key but control-H was mapped to the BS (backspace) character. Originally, VT100 defined the keymapping: This is configured on the machine where the application runs (this may be a remote machine).

The mapping of the backspace and delete key to a given application behaviour has differed in the course of time, and per terminal and application. In a terminal or editor, pressing the backspace results in a delete command, or vice versa. Sometimes the backspace/delete does not work as expected.
