On 5/21/19 5:33 PM, Dennis Williamson wrote: > On Tue, May 21, 2019 at 3:04 AM Henning <xa...@t-online.de> wrote: > >> On 20/05/2019 15:38, Chet Ramey wrote: >>> On 5/19/19 10:43 AM, Henning wrote: >>>> I don't like to have dozens of key bindings I never use. Currently I >>>> am issuing lots of lots of bind -r/-u commands to get rid of the >>>> default bindings. This slows down console startup unnecessarily. >>>> >>>> I would really like to have an inputrc command like $removeall or >>>> something like bind -r/-u all. >>>> Or is there something undocumented for this purpose? >>> >>> There is not, and I don't see much point to adding one. If you want to >>> remove the bindings for all keys, something like this should work: >> >> Sorry, the subject of my mail should have been "... all non-self-insert >> kes. >> >>> >>> for ((f=0; f < 256; f++ )) >>> do >>> bind -r \\$(printf "%03o" $f) >>> done >>> >> >> smiling ... >> >> The following variant does what I want: >> >> K=( ' ' ! '\"' \# $ % \& \' \( \) \* + , - . / >> 0 1 2 3 4 5 6 7 8 9 : \; \< = \> \? >> @ A B C D E F G H I J K L M N O >> P Q R S T U V W X Y Z \[ '\\' \] ^ _ >> \` a b c d e f g h i j k l m n o >> p q r s t u v w x y z \{ \| \} \~ ) >> >> for ((k=0; k<95; k++)); do >> bind -r "\e${K[k]}" >> bind -r "\e\C-${K[k]}" >> bind -r "\C-x\C-${K[k]}" >> bind -r "\C-x${K[k]}" >> bind -r "\C-${K[k]}" >> done >> >> for k in O{A,B,C,D,H,F} \\e [200; do >> bind -r "\e$k" >> done >> >> bind -f /0/e/inputrc >> >> unset k K >> >> But this means nearly 500 bind -r commands. And that was the reason for >> my original mail, the question, if there is a less expensive way to get >> what I want. >> >> And another problem: after removing all \C-x sequences I used bind -x >> to bind a shell command to \C-x proper. The result, when hitting \C-x, >> is the following error message: >> >> bash_execute_unix_command: cannot find keymap for command >> >> Using a sequence other than \C-x works as expected. >> My guess is that \C-x can't be used alone. And that this can only be >> changed in the source code. >> >> Henning >> >> >> > Why don't you unbind the keystrokes that are actually bound? > > while read -r b; do bind -r "$b"; done < <(bind -p | awk -F ':' '/./ > && !/self-insert|accept-line|^#/ {gsub("\"", "", $1); print $1}') > > On my system, that takes 0.011 seconds to run and it's not iterating > through a bunch of key sequences that aren't there. > > It does seem to leave behind a few, some of which match cchars (control > characters) in stty -a > > "\C-?": backward-delete-char > "\C-v": quoted-insert
> "\C-u": unix-line-discard > "\C-w": unix-word-rubout These are all auto-bound to their stty equivalents, which is controlled by the `bind-tty-special-chars' variable. There is a problem with attempting to unbind "\C-@", since that translates to 0. I'll fix that today. I don't see any problem attempting to unbind "\e " (or "\M- " if you have the right variables set to translate the meta prefix to ESC). -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/