The utility would be:
showkey (1) - examine the codes sent by the keyboard
but this seems to be missing on mac-os...here it is "Key Codes"...?
Or you type ctrl-V (qouted insert) and then some special key. In bash, this prints
^[OP in xterm and
^[[[A in the console for the F1 key.
The readline variable:
is the timeout to use for a half-finished sequence.
Underneath this, there must be a sort of keymap file, where the keys get translated to symbols. This is from
/usr/share/kbd/keymaps/mac/ on linux:
keycode 51 = Delete Remove
alt keycode 51 = Meta_Delete
shift alt keycode 51 = Meta_Delete
control keycode 51 = Remove
keycode 53 = Escape
alt keycode 53 = Meta_Escape
shift alt keycode 53 = Meta_Escape
keycode 54 = Control
keycode 55 = Alt # Command/Apple key
keycode 56 = Shift
keycode 57 = Caps_Lock
keycode 58 = AltGr # Alt/Option key
You see the flexibilty! The Meta-Delete symbol could become kill-word...
bind '"^[f": kill-word
^[ must be a
\e, or a ctrl-V, then Escape: one byte, not circumflex plus bracket.
It is like saying: ^C means control-C, not a Shift-6 and then a Shift-c...in the shell (bash) or in vim when I type ctrl-v and then Esc I get
^[, but it is just one character when you step back over it. Together with these meta-flag options in readline it can get complicated...I just illustrate the whole chain:
keymap "default.map" (translates scancode and modifier to keysymbols)
keycode 105 = Left F150 F151
string F150 = "\033[150"
string F151 = "\033[151"
keycode 106 = Right F154 F155
string F154 = "\033[154"
string F155 = "\033[155"
The F150 and F151 after default "Left" mean shift- and control-left-arrow. In a second step you can define a string, an escape sequence in this case. Here,
\e did not work, but the octal 033 is ascii 27 is control-[ is Escape...this keymap is linux specific, but X Windows has a similar logic.
And in .inputrc:
This works very nice in the linux console. In xterm under X Windows (Xorg): not at all: Xorg scans the keys itself.
backward-word can be invoked via "\e[150", "\e[1;2D", "\e[1;3D", "\eb".
The two in the middle with semicolon are VTxxx style modified left arrows. This was preconfigured, and also gets bound to
fwork? Since (at least on my Linux)
\M-fis already bound to
forward-word, perhaps that's causing a conflict.
bind -q forward-wordresults in
forward-word can be invoked via "\e[1;3C", "\e[1;5C", "\ef".
\Cas special prefixes?
M-f. Does it work if you use another letter?
fto the program inside the terminal when you press Option + F or whatever. Or it can be configured to do that.