Linux Keymapping for Programs
Applications and keycodes
Bash can be controlled with the inputrc file which is used to set up key control with the bash shell. The "/etc/inputrc" or the ".inputrc" file in the users home directory will set up key codes for bash. My /etc/inputrc file:
set meta-flag on
set input-meta on
set convert-meta off
set output-meta on
This file allows the following flags to be set on or off:
- bell-style - Possible values are audible (the default), visible, or none. This controls what happens when the Readline function wants to ring the bell.
- comment-begin - The default is #. This defines the string that will be inserted at the start of the line when the insert-comment command if received.
- convert-meta - If on (the default), characters are converted to the ASC seven bit character set.
- editing mode - May be set to emacs or vi
- input-meta - If set to on, eight bit input is enabled. If off (the default) it only passes seven bits of any character.
The following sequences are used to help define keys:
- \C- = Control
- \M- = Meta
- \e = escape character
- \\ = backslach
The below commands can be put in "/etc/inputrc" or "$HOME/.inputrc".
set editing-mode emacs
will set the default keybindings to those used by the emacs editor, and bash will recognize the delete key.
will map the <Home>, <Delete>, and <End> keys respectively to the corresponding functions. You can tell which characters are mapped by examining the keycode table.
You may need the following line if your BackSpace key sends the ASCII delete character:
For complete information, read the "Bash Reference Manual" by Chet Ramey, and Brian Fox.