From: Mikael Magnusson <mikachu@gmail.com>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Dynamic named directories and completion
Date: Sat, 24 Feb 2018 20:49:14 +0100 [thread overview]
Message-ID: <CAHYJk3SKk5-jiZAVx190bLtUeLWL4uGCtjAyJHaKrNB89NzC5A@mail.gmail.com> (raw)
In-Reply-To: <20180224193420.0d7d7d5c@ntlworld.com>
On Sat, Feb 24, 2018 at 8:34 PM, Peter Stephenson
<p.w.stephenson@ntlworld.com> wrote:
> On Fri, 23 Feb 2018 09:42:37 -0500
> Scott Frazer <frazer.scott@gmail.com> 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
next prev parent reply other threads:[~2018-02-24 19:49 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-22 22:54 Scott Frazer
2018-02-23 0:29 ` [RFC PATCH] _path_files: teach zsh_directory_name Takeshi Banse
2018-02-23 1:19 ` _path_files: fix copy paste error Takeshi Banse
2018-02-23 1:30 ` _path_files: fix copy paste error (2/2) Takeshi Banse
2018-02-23 8:01 ` Dynamic named directories and completion Vincent Bernat
2018-02-23 14:41 ` Scott Frazer
2018-02-23 15:02 ` Takeshi Banse
2018-02-23 14:42 ` Scott Frazer
2018-02-24 19:34 ` Peter Stephenson
2018-02-24 19:49 ` Mikael Magnusson [this message]
2018-02-24 20:12 ` Peter Stephenson
2018-02-26 14:31 ` Scott Frazer
2018-02-26 13:53 ` Scott Frazer
2018-02-26 14:47 ` Peter Stephenson
2018-02-26 16:44 ` Scott Frazer
2018-02-26 20:08 ` Peter Stephenson
2018-02-26 21:22 ` Peter Stephenson
2018-02-26 17:49 ` Mikael Magnusson
2018-02-26 17:55 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHYJk3SKk5-jiZAVx190bLtUeLWL4uGCtjAyJHaKrNB89NzC5A@mail.gmail.com \
--to=mikachu@gmail.com \
--cc=p.w.stephenson@ntlworld.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).