The man page for bind appears not to link to a syntax explanation, so while attempting to convert bind -p
into human readable format I can filter out the garbage from 483 down to 109, but then am only able to understand 73;
bind -p 2>/dev/null \
| grep -vP "digit-argument|do-lowercase-version|not bound|self-insert" \
| perl -pe 's/\\e/[alt]/g;s/\\C/[control]/g' \
| grep -P "[\-\]].\""
"[control]-g": abort
"[control]-x[control]-g": abort
"[alt][control]-g": abort
"[control]-j": accept-line
"[control]-m": accept-line
"[control]-b": backward-char
"[control]-h": backward-delete-char
"[control]-?": backward-delete-char
"[control]-x[control]-?": backward-kill-line
"[alt][control]-h": backward-kill-word
"[alt][control]-?": backward-kill-word
"[alt]b": backward-word
"[alt]<": beginning-of-history
"[control]-a": beginning-of-line
"[alt]c": capitalize-word
"[control]-]": character-search
"[alt][control]-]": character-search-backward
"[control]-l": clear-screen
"[control]-i": complete
"[alt]!": complete-command
"[alt]/": complete-filename
"[alt]@": complete-hostname
"[alt]{": complete-into-braces
"[alt]~": complete-username
"[alt]$": complete-variable
"[control]-d": delete-char
"[control]-x[control]-v": display-shell-version
"[alt]l": downcase-word
"[alt][control]-i": dynamic-complete-history
"[control]-x[control]-e": edit-and-execute-command
"[alt]>": end-of-history
"[control]-e": end-of-line
"[control]-x[control]-x": exchange-point-and-mark
"[control]-f": forward-char
"[control]-s": forward-search-history
"[alt]f": forward-word
"[alt]g": glob-complete-word
"[alt]^": history-expand-line
"[alt]#": insert-comment
"[alt]*": insert-completions
"[alt].": insert-last-argument
"[alt]_": insert-last-argument
"[control]-k": kill-line
"[alt]d": kill-word
"[control]-n": next-history
"[alt]n": non-incremental-forward-search-history
"[alt]p": non-incremental-reverse-search-history
"[control]-o": operate-and-get-next
"[alt]=": possible-completions
"[alt]?": possible-completions
"[control]-p": previous-history
"[control]-q": quoted-insert
"[control]-v": quoted-insert
"[control]-x[control]-r": re-read-init-file
"[control]-r": reverse-search-history
"[alt][control]-r": revert-line
"[alt]r": revert-line
"[control]-@": set-mark
"[alt] ": set-mark
"[alt][control]-e": shell-expand-line
"[alt]&": tilde-expand
"[control]-t": transpose-chars
"[alt]t": transpose-words
"[control]-x[control]-u": undo
"[control]-_": undo
"[control]-u": unix-line-discard
"[control]-w": unix-word-rubout
"[alt]u": upcase-word
"[control]-y": yank
"[alt].": yank-last-arg
"[alt]_": yank-last-arg
"[alt][control]-y": yank-nth-arg
"[alt]y": yank-pop
the remanding 36 I have not deciphered yet;
bind -p 2>/dev/null \
| grep -vP "digit-argument|do-lowercase-version|not bound|self-insert" \
| perl -pe 's/\\e/[alt]/g;s/\\C/[control]/g' \
| grep -vP "[\-\]].\""
"[alt]OD": backward-char
"[alt][D": backward-char
"[alt][alt][D": backward-word
"[alt][1;5D": backward-word
"[alt][5D": backward-word
"[alt]OH": beginning-of-line
"[alt][1~": beginning-of-line
"[alt][H": beginning-of-line
"[alt][200~": bracketed-paste-begin
"[control]-xe": call-last-kbd-macro
"[alt][alt]": complete
"[alt][3~": delete-char
"[alt]\\": delete-horizontal-space
"[control]-x)": end-kbd-macro
"[alt]OF": end-of-line
"[alt][4~": end-of-line
"[alt][F": end-of-line
"[alt]OC": forward-char
"[alt][C": forward-char
"[alt][alt][C": forward-word
"[alt][1;5C": forward-word
"[alt][5C": forward-word
"[control]-x*": glob-expand-word
"[control]-xg": glob-list-expansions
"[alt]OB": next-history
"[alt][B": next-history
"[control]-x!": possible-command-completions
"[control]-x/": possible-filename-completions
"[control]-x@": possible-hostname-completions
"[control]-x~": possible-username-completions
"[control]-x$": possible-variable-completions
"[alt]OA": previous-history
"[alt][A": previous-history
"[alt][2~": quoted-insert
"[control]-x(": start-kbd-macro
For example I know one of these 3 must be alt→;
bind -p | grep forward-word | grep \\[
"\e\e[C": forward-word
"\e[1;5C": forward-word
"\e[5C": forward-word
but I know not which one, or what the others are. Is there a list of what these 36 typically map to?
[EDIT1]
Thanks to @undercat for the ^V
tip I was able to get my unknowns down to 7.
bind -p 2>/dev/null \
| grep -vP "digit-argument|do-lowercase-version|not bound|self-insert" \
| perl -pe 's/\\e\[A/[up]/g' \
| perl -pe 's/\\e\[B/[down]/g' \
| perl -pe 's/\\e\[C/[right]/g' \
| perl -pe 's/\\e\[D/[left]/g' \
| perl -pe 's/\\e\[1;5A/[control]-[up]/g' \
| perl -pe 's/\\e\[1;5B/[control]-[down]/g' \
| perl -pe 's/\\e\[1;5C/[control]-[right]/g' \
| perl -pe 's/\\e\[1;5D/[control]-[left]/g' \
| perl -pe 's/\\e\[2~/[control]-[insert]/g' \
| perl -pe 's/\\e\[3~/[control]-[delete]/g' \
| perl -pe 's/\\e/[alt]/g;s/\\C/[control]/g' \
| grep -P "\[[^\]]*\"" \
| perl -pe 's/\[alt\]/\\e/g;s/\[control\]/\\C/g'
"\e[5D": backward-word
"\e[1~": beginning-of-line
"\e[H": beginning-of-line
"\e[200~": bracketed-paste-begin
"\e[4~": end-of-line
"\e[F": end-of-line
"\e[5C": forward-word
[EDIT2]
Thanks to @JdeBP for the nosh and printf
tips, but the output of decode-ecma48 (from nosh-terminal-management_1.39_amd64) is equally indecipherable to me;
... \
| perl -pe 's/:.*//g;s/"//g;s/^/\\/g' \
| xargs -I {} printf '{}' \
| ./console-decode-ecma48
CUB 5
DEC FIND
CUP 0
DEC FNK 200;1
DEC SELECT
CPL 1
CUF 5
Can JdeBP or someone translate those vintage abbreviations to full length modern (example 1, example 2, vs an ancient example) keys (if they even map to a modern keyboard)?