Allow using a different completion pager

2021-01-07 Thread 積丹尼 Dan Jacobson
$ man bash
   page-completions (On)
  If set to On, readline uses an internal more-like pager to  dis‐
  play a screenful of possible completions at a time.

OK, and it looks like:

final.target
first-boot-complete.target
fstrim.service
fstrim.timer
--More--


But if I could use less(1), then I could do
/nerbleblatz
string searches, etc.



bind documentation needs example for variables too, not just keys

2021-01-07 Thread 積丹尼 Dan Jacobson
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 
Display all 169 possibilities? (y or n)
$ bind set 
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 
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!



Re: Allow using a different completion pager

2021-01-07 Thread Chet Ramey

On 1/6/21 11:44 PM, 積丹尼 Dan Jacobson wrote:

$ man bash
page-completions (On)
   If set to On, readline uses an internal more-like pager to  dis‐
   play a screenful of possible completions at a time.

OK, and it looks like:

final.target
first-boot-complete.target
fstrim.service
fstrim.timer
--More--


But if I could use less(1), then I could do
/nerbleblatz
string searches, etc.


This has come up before. I'm not really in favor of allowing readline, as a 
library, to fork and exec other processes.



--
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



Re: bind documentation needs example for variables too, not just keys

2021-01-07 Thread Chet Ramey

On 1/7/21 1:58 AM, 積丹尼 Dan Jacobson wrote:

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.


Thanks for the report.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



skip-completed-text "on" should be the default

2021-01-07 Thread 積丹尼 Dan Jacobson
My experiments,
https://github.com/scop/bash-completion/issues/489
"prove" that
set skip-completed-text on
should be the default, not off.