Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Problem with fake-files style and cd
- X-seq: zsh-users 13856
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-users <zsh-users@xxxxxxxxxx>
- Subject: Re: Problem with fake-files style and cd
- Date: Sat, 14 Feb 2009 23:09:56 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=slp0FoPhROrYNTBt9J9bjIk+HbwEgK0tKUksqRfdPGY=; b=ihCTZ1PwvbSwTwZ2YIi5irsm3MqTRHfqE5zk79k9FdTEdeME1loWveAbatNUUJxw/D PtDzg843UHUiQ+RM8UX4VmNhHs+X9x/+kjKnXb05z41lsWwfed9D9hKI3hgsrd/ilTbQ r88N6pEgG8PNTHuic1pw5mZNFTHN0kWzD3lLE=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=ircMuMSC+mL/boowzi77DoviWvQqmQ3H2TtyITA9tqGlapDIyuuldTwlAF3swo0j6y LxXppMH0emm7EOx8CJbcvalUMnUdrwB78jGHxMOfuml13+R9nLQP5XsH/4Wam0laMpYM PISgKlUJGth5+Mc3+pmK1tDfVolt1ExReT6OY=
- In-reply-to: <090214133904.ZM15383@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <mikachu@xxxxxxxxx> <237967ef0902140622s7389d2c8h5a0c786dcf207422@xxxxxxxxxxxxxx> <200902141801.n1EI1E2l003603@xxxxxxxxxxxxxxxxxxx> <237967ef0902141019t30118690m30116c9413015d96@xxxxxxxxxxxxxx> <090214111316.ZM15188@xxxxxxxxxxxxxxxxxxxxxx> <237967ef0902141141y609b61d3i154546f6f6886c65@xxxxxxxxxxxxxx> <090214133904.ZM15383@xxxxxxxxxxxxxxxxxxxxxx>
2009/2/14 Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>:
> On Feb 14, 8:41pm, Mikael Magnusson wrote:
> }
> } 2009/2/14 Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>:
> } > I'm not sure I'm following the last part of that, but what you need to
> } > look at is the documentation for the tag-order zstyle.
> }
> } Even if I had accidentally read that whole section, it would not have
> } occurred to me it could be used here.
>
> Next you need to read chapters 10 and 15 of "From Bash to Z Shell". :-)
>
> (Hey, Peter and Oliver ... any updated revision of the book planned?)
>
> } Thanks, with my hack to _cd removed, I think this does more or less
> } exactly what I want. I wouldn't mind if it was on a per-completion
> } entry, ie it would be nice if I got this:
> } % mkdir -p local/code/foo
> } % mkdir -p path/code/bar
> } % cdpath=$PWD/path
> } % cd local
> } % cd code<tab>
> } ---- local directory
> } foo/
> } ---- directory in cdpath
> } bar/
> }
> } which is what I get without the above style set. However,
> } % mkdir arg
> } % cd <tab>
> } ---- local directory
> } arg/ code/
> } ---- directory in cdpath
> } code/
> }
> } I don't want the cdpath to appear in this case, only once I'm actually
> } completing at a place where they differ.
>
> I'm not entirely sure, but I think what you're asking for is to have
> duplicate completions removed from the listing even when the duplicates
> are in different tag groups. Suppose we add
>
> % mkdir -p path/other/thing
>
> to the above. Is what you'd like to see:
>
> % cd <tab>
> ---- local directory
> arg/ code/
> ---- directory in cdpath
> other/
>
> ??
Yes, but
> That isn't something that's supported in the internals, but for a
> specific case like this we can the the same effect like so:
>
> zstyle -e :completion::complete:cd::path-directories ignored-patterns \
> 'reply=( *(/) )'
>
> This says that when completing in the cdpath, ignore any name that matches
> the name of a directory in the current directory.
>
> In fact I like that so much I might even replace my tag-order with it.
while the above appears to work, it really doesn't:
% mkdir path/code/foo
% cd code/<tab>
---- local directory
foo/
---- directory in cdpath
bar/ foo/
Presumably this is because *(/) (which I changed to *(-/) (not in the
above testcase though)) only matches one segment and that *(/) is run
in $PWD, not $PWD/$PREFIX? I have not yet fully understood how this
works, can you access the string being completed in that code snippet,
or can you work around it without doing that? (This time I read both
the ignored-patterns and zstyle -e docs :) ).
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author