Zsh Mailing List Archive
Messages sorted by:
Re: Completion for cd
- X-seq: zsh-users 22575
- From: Jesper Nygårds <jesper.nygards@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Completion for cd
- Date: Wed, 15 Mar 2017 08:22:44 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=VJoLp6TCcqG893s/zRglaOjx1tPp73xNxncPzomN16c=; b=jFJZSHEHoY/XB4fyoNp77Dsl2arJPnFdH0ZhFgzl/VBd9x8wqjbR2jYgqpNqDdZSR0 qrDUfBlH4M5HNX6VDe4X+BRn24A0URoCKRaWUUIz9+IbOwpdc7a5iFyDiahK7WTOyN10 AdNntOgJE62EJ12CgFZ47/c+FGDbcFtuboVHLGoZAWz7uieSp9/BjwFOvd2WHLQC36Z+ wFk0WfJ6qu42aT8dXazxLYQMuL+a1cP88nQ7zQwSIiPtQMIRILwJAlpHhahQ8pjeWBTv t4/O9FZgjisZyYNlemUh08fX66SLQz4at3bGhBwPFLat6k52qr/BR+HjqHtx/RDSaFxe 817w==
- In-reply-to: <CAH+w=7YmHn1zR-mbkx-SVLyq+UcJhHvhHT3Y3RcFQ2-ELP2i3A@mail.gmail.com>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:email@example.com>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CABZhJg_McyYz8f_xyVN8c8g4xop+6J_EWj2=CUS3uu9A0SZPNA@mail.gmail.com> <170314120715.ZM10347@torch.brasslantern.com> <CABZhJg_BHrkw+DmRkNFoejDx7fF4-9pnULyYF2sV=LWOdwJP4w@mail.gmail.com> <CAH+w=7YmHn1zR-mbkx-SVLyq+UcJhHvhHT3Y3RcFQ2-ELP2i3A@mail.gmail.com>
On Wed, Mar 15, 2017 at 4:56 AM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
> The clue is at the very end of each file: In the first case [that
> ignores parents as expected], the _complete function generated the
> matches, but in the second case the _approximate function generated
> The path search correctly excludes "zaa" but then _approximate puts it
> back because it is similar enough to the string on the command line.
Thanks to your help, I managed to find a working solution, changing the
critical lines to this:
zstyle ':completion:*:complete:cd:*:*' tag-order local-directories
zstyle ':completion:*:withpath:cd:*:*' tag-order path-directories
In other words, I have added 'directories' to the first line.
However, I still don't fully understand what is going on. As per your
findings, it's the _approximate function that adds 'zaa'. But that must
mean that none of the previous completers have found any match, doesn't it?
If _complete or _complete:withpath had found even _one_ match,
_approximate would never have been called, right?
The documentation for the local-directories tag says that it and
path-directories are used if cdpath is set, instead of the 'directories'
tag. I had interpreted this to mean that the 'directories' tag does not
come into play when doing cd completion whenever cdpath is set, as in my
Furthermore, as I read the documentation of tag-order, all tags are in play
after the explicitly mentioned tags, _unless_ the list ends with a hyphen.
However, the tag-order of the second completer, 'withpath', doesn't end
with a hyphen, and I would thus have expected the 'directories' tag to be
tried even though it is not explicitly mentioned.
In short, I would have thought that 'directories' was uninteresting tag
when cdpath was set, and when it actually was in play, I would have thought
it would be tried by the withpath-completer since there is no hyphen at the
end of the tag-order. But obviously I have misunderstood something here,
since it works. I'm just curious to know where the fault in my
Messages sorted by: