Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Completion for cd
- X-seq: zsh-users 22576
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Completion for cd
- Date: Wed, 15 Mar 2017 10:00:37 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=8RUskYN4tyoAOUpsYLQejZp0FXPnkaY/FmN0rfA4p2U=; b=tIdunp35o7d3ZEmH+Prt2OPdQ1MkIEp53ViSe6sinVaZDe3e0w0aMybg/uL3/+9yys ACYmqyOQXPEzlVWFSALxsXUCFtD3r87MNv2Pn+CBHrfEbfCqMdJdhWrhAGe5OtwmH8bc kliFnlLsjn96s7yZc5EVJoR+FRlkWOW+eWmXrqd7A6xe6M7sMVkB2Y5fSGV++GynivNC 277H5auoDDb36T82x9hezjrUG7pqEH3/e9E+wZ0P4Wbig/9xYw6dydF1BRrtLXw3UCJV 3Mck62+Nn07uYKn3/jW8meVVXsB6ZX4hlRoWcTUtAhyMes8nQy7mlOL7K8sM4DkT6mJR WV7g==
- In-reply-to: <CABZhJg98p2bH6yAQ-zw4j2wEY1FVQ-Qr-NKRsJQW2StU_65izA@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- 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> <CABZhJg98p2bH6yAQ-zw4j2wEY1FVQ-Qr-NKRsJQW2StU_65izA@mail.gmail.com>
On Mar 15, 8:22am, Jesper Nygards wrote:
}
} 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
} 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.
I believe your style settings are wrong. You have:
zstyle ':completion:*:*:cd:*:*' completer _expand _complete \
_complete:withpath _prefix _approximate _ignored
zstyle ':completion:*:withpath:cd:*:*' tag-order path-directories
But _complete:withpath sets the context to "completewithpath" not
to "withpath" so the path-directories tag-order will never match.
(This is why the example uses _complete:-foo so that the context
is complete-foo with the hyphen.)
In light of that --
>> I then go to '/tmp/zaa' and write 'cd ../z<tab>'.
"../z" is not a prefix of a local directory, so the local-directories
tag finds nothing. (Anything starting with "/" or "../" is treated
as a non-local path.)
So it falls on through to _approximate.
When you add back "directories", _complete finds candidates in "../"
and ignore-parents kicks in.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author