bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: readline: How to unbind _all_ keys


From: Henning
Subject: Re: readline: How to unbind _all_ keys
Date: Tue, 21 May 2019 10:04:47 +0200
User-agent: Mozilla/5.0 (Windows NT 6.3; rv:56.0) Gecko/20100101 Thunderbird/56.0

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]