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

Re: Dynamic named directories and completion

On Fri, 23 Feb 2018 09:42:37 -0500
Scott Frazer <frazer.scott@xxxxxxxxx> wrote:
> >> cd ~[ccc]/<TAB>
> >>
> >> zsh doesn't give me options for directories under ccc, it thinks '/' is
> >> the command I'm trying to complete.  Is there a way to make this work?  
> > 
> > I don't see anything wrong in your code and for me, it works as you
> > expect (zsh 5.4.2). Does "echo ~[ccc]" returns the right value?
> >   
> Yes, "echo ~[ccc]" works correctly.  I'm using zsh 5.3 so maybe there is some
> difference there.  Perhaps there is some difference in options/modules/etc.  If
> I cut my .zshrc down to a minimum:  

There's something screwy here, certainly.  I don't think it should be
necessary to modify _path_files in 5.3, though, there are certainly
cases where you get the right answer, and I think the logic that currently
handles ~ at the start should do the right thing here.

I've a theory it's down to the completion widget in use, i.e. how
completion gets started up.  If instead of hitting tab, you type <Esc>x
complete-word<Enter> --- or instead bind that widget,

bindkey '^i' complete-word

and then use tab --- does it start working?  The default is
expand-or-complete, and I believe the expand bit is nixing the
completion in this case.  (Except we don't really have the word "nix"
this side of the Atlantic, so I may be talking nonsense, but it sounded


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