Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: glob completion without menu style completion



On Sep 15, 10:00pm, Andrej Borsenkow wrote:
> Subject: RE: glob completion without menu style completion
> >
> > If I don't have setopt glob_complete and I do
> >
> > rmdir *TAB
> >
> > the * gets replaced with all files in the directory that would be
> > matched by * if I were to just hit return at that moment.
> >
> > Is there a way to get it so that when I type
> >
> > rmdir *TAB
> >
> > the * gets replaced with all the choices that the completion system
> > returns at that time
> 
> Yes, I can reproduce it. It happens, because by default TAB is bound to
> expand-or-complete widget that tries expansion if it sees glob pattern
> *before* it tries completion. So, it seems, that completion system sees
> input line with already expanded '*' ... I personally consider it a bug,
> but Sven should answer it when he is back.

It's not a bug, it's the defined behavior of expand-or-complete.

> You are better off if you redefine TAB to simple expand-word like
> 
> bindkey '^I' expand-word

You mean "complete-word", not "expand-word".  And if you run "compinit"
*after* setting your styles with zstyle, *and* you have used the _expand
completer, then compinit rebinds TAB to complete-word for you, for just
this reason.

> In general, it is always good idea to use plain complete-word with new
> completion system, because then you have much better control over possible
> interpretation of patterns.

Exactly.



Messages sorted by: Reverse Date, Date, Thread, Author