Regarding mapping function keys in vi readline, I have read these two stackexchanges:
I have a MacBookPro with a touchbar. The function keys are always on, but unlike physical keys, the virtual touch bar function keys are tempermental and frequently inject junk into the commands i'm typing (this is particularly a problem when attempting to type an underscore...i get a lot of F9, F10, and maybe some F11). I don't use these keys...so i wish i could disable them. But, let's say that i could make them simply go to the end of the line.
This is one of my many attempts to map to go to the end of the line (when in insert mode):
set editing-mode vi
$if mode=vi
set keymap vi-insert
"<F9>": end-of-line
$endif
the result of typing "asdf" at a prompt is as follows:
TT->~$ [] (arg: 20)
I have placed "[]", above, where the cursor remains after pressing <F9>, in case that is any help.
The variations i have tried are as follows:
"<F9>": end-of-line<F9>": end-of-line20: end-of-line"20": end-of-line"arg: 20": end-of-line(arg: 20): end-of-line"(arg: 20)": end-of-line
Update: the following .inputrc is now working to "ignore" :
set keymap vi-insert
"\e[20~":redraw-current-line
"<F9>"works in readline. To see whatF9really turns into, runcatin your terminal and then press theF9key. You should see something like^[[20~. Once you have established the exact escape, bind it toredraw-current-line:bind '"\e[20~": redraw-current-line'(or whatever command you like). You should, of course, use just the"\e[20~": redraw-current-linein~/.inputrc."^[[20~": redraw-current-lineafter cat showed me the^[[20~output. Unfortunately i'm still getting(arg: 20). Could this be related to it being the MBP touch bar? Doesbind '"^[[20~": redraw-current-linego in.bash_profile?"\e[20~"or"\033[20~", not"^[[20~".^[is how escape (ASCII 27) is echoed back by the terminal when itsechoctlflag is on.\e[20~:redraw-current-line: command not found~/.inputrcis not a shell script, you could notsourceit. To test if the binding works, either runbind '"\e[20~": redraw-current-line'in your current shell, or add just the binding the~/.inputrcand start a new shell. If you're using the emacs keybindings, you can also re-source the~/.inputrcfile by pressingCtrl-x Ctrl-r.