Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Dynamic named directories and completion
- X-seq: zsh-users 23168
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- Subject: Re: Dynamic named directories and completion
- Date: Sat, 24 Feb 2018 20:49:14 +0100
- Cc: Zsh Users <zsh-users@xxxxxxx>
- 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 :cc; bh=0Xx7zia9CS54+STG7w9eZpFNH9kYpLtQX2fDwCYvbLo=; b=MPSciyfGrTbkrRxurujNEnaoCC6isA+DVweAFwY8OAQw3aAujmpxocL+O5PdVX2fw/ TYVeCmqoFZNs+qqyJT/Brk0ki6Oj3rKtOzbcLnHkg3KBVovmgybiJtNU4kn4ToBNRcQz VJ9tder/FGeBL83l0loeabmA7eQtW8unLhVNUuowsOTCEHOUzL5/GQ5bM1l2nLoRPGBG 2+67kDIChzWzH6uWNYxWKMKkYImWpUXyQ72015pgY2QY8WEUqs5P900tOzjkr39RoL77 Mqbj3tBB6NVfyHCIz6W+DbI4kRzTge4etrVBj9Do5cJMpR4EilwpUt4O0UxnQGoOxU9A 08Ig==
- In-reply-to: <20180224193420.0d7d7d5c@ntlworld.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>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <p6nhj1$5nv$1@blaine.gmane.org> <m3po4wnni0.fsf@luffy.cx> <p6p952$9mi$2@blaine.gmane.org> <20180224193420.0d7d7d5c@ntlworld.com>
On Sat, Feb 24, 2018 at 8:34 PM, Peter Stephenson
<p.w.stephenson@xxxxxxxxxxxx> wrote:
> 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
> good.)
I have some patches I was working on related to this, but I assume
there was still some problem, or I would have committed them...
There's two patches in this thread,
http://www.zsh.org/mla/workers/2015/msg01439.html and then I think I
never sent the third one,
diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files
index 2b0c5580a5..067f68d9d9 100644
--- a/Completion/Unix/Type/_files
+++ b/Completion/Unix/Type/_files
@@ -103,7 +103,7 @@ for def in "$pats[@]"; do
if [[ -n "$end" ]]; then
if _path_files -g "$pat" "$opts[@]" "$expl[@]"; then
ret=0
- elif [[ $PREFIX$SUFFIX != */* ]] && zstyle -a
":completion:${curcontext}:$tag" recursive-files rfiles; then
+ elif [[ ${${:-$PREFIX$SUFFIX}#\~\[[^]]#]} != */* ]] && zstyle
-a ":completion:${curcontext}:$tag" recursive-files rfiles; then
local subtree
for rfile in $rfiles; do
if [[ $PWD/ = ${~rfile} ]]; then
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author