Re: doing completion and menu-completion with just one key

2014-01-19 Thread Chet Ramey
On 1/4/14, 8:09 AM, Ernest Adrogué wrote:

> One solution is first use completion to narrow down completions and in the
> end use menu-completion, but I think it would be much better to use just one
> key.  In my opinion the best solution would be this: the first TAB does
> completion and successive TABs do menu-completion.  Currently I don't think
> it is possible to configure Readline to do this, is it?

This is an issue when there is more than one possible completion.  I will
assume that you mean that when you say you want "completion" on the first
TAB, you want the longest common prefix displayed, then subsequent TABs to
cycle through the possible completions as menu-complete usually behaves.

If this is the behavior you want, bind TAB to menu-complete and set the
readline variable `menu-complete-display-prefix'.

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



Re: doing completion and menu-completion with just one key

2014-01-19 Thread Ernest Adrogué
Hi,

2014-01-19, 14:04 (-0500); Chet Ramey escriu:
> On 1/4/14, 8:09 AM, Ernest Adrogué wrote:
> 
> > One solution is first use completion to narrow down completions and in the
> > end use menu-completion, but I think it would be much better to use just one
> > key.  In my opinion the best solution would be this: the first TAB does
> > completion and successive TABs do menu-completion.  Currently I don't think
> > it is possible to configure Readline to do this, is it?
> 
> This is an issue when there is more than one possible completion.  I will
> assume that you mean that when you say you want "completion" on the first
> TAB, you want the longest common prefix displayed, then subsequent TABs to
> cycle through the possible completions as menu-complete usually behaves.
> 
> If this is the behavior you want, bind TAB to menu-complete and set the
> readline variable `menu-complete-display-prefix'.

Yes this is what I meant, I think.  To be more specific:

* On the first TAB, I want the longest common prefix inserted and a list of
  possible completions displayed.

* On subsequent TABs, I want to cycle through possible completions.

If I bind TAB to `menu-complete' and set `menu-complete-display-prefix', the
first TAB displays a list of possible completions, which is what I wanted,
but it also inserts the first entry from the list of possible completions,
which is not what I wanted.

For example, if I do:

$ cd 

it displays the possible completions:

bar/  fooa/ foob/

and inserts `bar/'.  But `bar/' is not the longest common prefix, the empty
string is.

Regards.