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

Re: Problem completing variables that contain spaces

On Wed, 28 Mar 2001, Sven Wischnowsky wrote:
> Wayne Davison wrote:
> > I noticed that the new completion code in the latest zsh code is
> > having trouble completing a variable that expands to a value that
> > contains spaces.  For instance, I was trying to complete $PWD in
> > a directory path that contained a space:
> >
> >  % mkdir 'two words'
> >  % chdir 'two words'
> >  % touch 1 2
> >  % ls -l $PWD/<TAB>
> >
> > Instead of $PWD remaining unexpanded and starting menu completion, it
> > expands to something strange like:
> >
> >     $PWD/full/path/goes/here/two\ words/
> I can't reproduce this.  Can you try to make it do that starting with
> -f and tell us the setup?

The critical bit appears to be:

zstyle ':completion:*' completer _expand _complete
zstyle ':completion:*:expand:*' suffix false

(Of course you need to call compinit and bindkey TAB to complete-word.)

I can't remember why I set suffix to false, though.  It was probably
back during the time that I didn't want $VAR/*<TAB> to expand the $VAR
(or something like that).  However, with this set:

zstyle ':completion:*:expand:*' keep-prefix true

the behavior of "suffix false" works exactly like "suffix true".
Note that the keep-prefix line isn't required to duplicate the bug.
In fact, you can tickle the bug without setting "suffix false" if you
add a wildcard:

 % ls -l $PWD/*<TAB>


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