bug-bash
[Top][All Lists]
Advanced

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

bind documentation needs example for variables too, not just keys


From: 積丹尼 Dan Jacobson
Subject: bind documentation needs example for variables too, not just keys
Date: Thu, 07 Jan 2021 14:58:26 +0800

Man bash says

   Readline Variables
       Readline has variables that can be used to further customize its behav‐
       ior.  A variable may be set in the inputrc file with a statement of the
       form

              set variable-name value
       or using the bind builtin command (see SHELL BUILTIN COMMANDS below).

That's what I intend to do today. Use the bind command to set a variable.

OK, reading further, none of these

       bind [-m keymap] [-lpsvPSVX]
       bind [-m keymap] [-q function] [-u function] [-r keyseq]
       bind [-m keymap] -f filename
       bind [-m keymap] -x keyseq:shell-command
       bind [-m keymap] keyseq:function-name
       bind [-m keymap] keyseq:readline-command

Show how to set a readline variable.

              Display  current  readline key and function bindings, bind a key
              sequence to a readline function or  macro,  or  set  a  readline
              variable.  Each non-option argument is a command as it would ap‐
              pear in .inputrc, but each binding or command must be passed  as
              a separate argument; e.g., '"\C-x\C-r": re-read-init-file'.  Op‐
              tions, if supplied, have the following meanings:

OK, so the syntax is probably one of
$ bind set skip-completed-text on
or
$ bind skip-completed-text off

Yes, even after using

              -v     Display  readline variable names and values in such a way
                     that they can be re-read.
              -V     List current readline variable names and values.

it is not clear. (But Junior (me) finally did figure it out below.)

Hmmm,
    $ bind -v|wc -l
    45
    $ bind <TAB>
    Display all 169 possibilities? (y or n)
    $ bind set <TAB>
    Display all 169 possibilities? (y or n)
    45!=169

    $ bind  -v|grep skip
    set skip-completed-text off
    $ bind skip-completed-text on
    readline: skip-completed-text: no key sequence terminator
    readline: on: no key sequence terminator
    $ bind set skip-completed-text on
    readline: : unknown variable name
    readline: skip-completed-text: no key sequence terminator
    readline: on: no key sequence terminator

    $ help bind
    bind: bind [-lpsvPSVX] [-m keymap] [-f filename] [-q name] [-u name] [-r 
keyseq] [-x keyseq:shell-command] [keyseq:readline-function or readline-command]

A glimmer of hope appears. Maybe "name" means variable. (It doesn't. So
really should be written [-q function-name] [-u function-name] as they
are below.)

    Set Readline key bindings and variables.

    Bind a key sequence to a Readline function or a macro, or set a
    Readline variable.  The non-option argument syntax is equivalent to
    that found in ~/.inputrc, but must be passed as a single argument:
    e.g., bind '"\C-x\C-r": re-read-init-file'.

Wait! I see, I need to do
$ bind 'set skip-completed-text on'
$ bind  -v|grep skip
set skip-completed-text on
It worked!

Conclusions:

$ bind 'set <TAB>
should show those 45 completions!

And, the example
     bind '"\C-x\C-r": re-read-init-file'
is only for those (169) keys. Please add a second example, for those (45) 
variables:
     bind 'set skip-completed-text on'
Thanks!



reply via email to

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