Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Problem with fake-files style and cd
- X-seq: zsh-users 13854
- 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 20:41:45 +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=YKY4PxJXUfyYYq/cH7MdU1Ye49E3Ga6MUz1DD9FP4b0=; b=mqAfBhAvUyOOECw3OQF4/pv5eFo9VRUMS3066FL01t+lDFipoSkauITxAD5Whsv4FZ BpwJibqFmsyTcLzT7rEnL4rk1a/keBM4SVG5iGA9ti07NOxsAdZlVG8uaZjpkf4Md/Mh j+qxqcICoPG9pHjcDrXxNaIdfcfzaf5XuZIxs=
- 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=Ibz6OkcE4UCMvvoG32E6YBKsEUH6alwcqB65PVxm07cztnJeEaLxYoXCbaXznOdSdE vof55qjqXf9vlqfQLAv1L88GAJUqV4AHS2p4rhc/SttJG9S22YADpr92eu5eXQr/s1ty EiCKTCM7PEguvcgEIrtoVTmRbPqGJ2eZJFoi8=
- In-reply-to: <090214111316.ZM15188@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <mikachu@xxxxxxxxx> <237967ef0902140622s7389d2c8h5a0c786dcf207422@xxxxxxxxxxxxxx> <200902141801.n1EI1E2l003603@xxxxxxxxxxxxxxxxxxx> <237967ef0902141019t30118690m30116c9413015d96@xxxxxxxxxxxxxx> <090214111316.ZM15188@xxxxxxxxxxxxxxxxxxxxxx>
2009/2/14 Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>:
> On Feb 14, 7:19pm, Mikael Magnusson wrote:
> }
> } (No, I've modified the _cd completer a bit to only add $cdpath things
> } if the first component is already typed out, because when I'm sitting
> } in a dir with only one subdir and type cd <tab> i would like that
> } directory completed and not the 50 ones in my cdpath. [...])
>
> Well, that was your first mistake. :-) You should be able to get the
> effect you want using styles.
>
> } Of course, my real question should have been if I can make the
> } completion listing remove duplicate entries when I have both a real
> } directotry and an entry in cdpath that matches, but I guess if you
> } have a real dir foo/bar and a cdpath dir foo/baz you want to be able
> } to complete to foo/baz too. Maybe it doesn't have to show up as a
> } cdpath entry at the foo point though, since the cd builtin won't
> } actually go there anyway?
>
> 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. After thinking for a few minutes
I realized I can find the strings "local-directories" and
"path-directories" with the _complete_help keybind I have on alt-f9,
or reading through the rest of the documentation in its entirety,
unless I had stumbled across the "Standard Tags" section by chance. In
the context of having read your mail it is very helpful though :). It
is a tiny bit confusing why the name of the "directories" tag is
changed to local-directories only when $cdpath is set, is it for any
other reason than to break all your styles when you set/unset cdpath?
> I use this:
>
> zstyle :completion::complete:cd:: tag-order \
> local-directories path-directories
>
> This says to complete only local directories if there are matches for
> those, and if there are no local matches then complete only directories
> that are found in the cdpath. Look at the documentation for "Standard
> Tags" to find explanation of local-directories and path-directories.
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 don't expect anyone to do
anything about this, I'm just saying it would be nice :).
Thanks a lot for your and Peter's help.
> If you want to complete directories in both places but only show the
> local ones in listings, you can use the "hidden" style like so:
>
> zstyle :completion::complete:cd::path-directories hidden yes
>
> (That's not very clear from the documentation for the "hidden" style.)
> You probably don't want to use both tag-order and hidden in this case,
> but there might be contexts in which you would.
I tried this but it seemed less useful.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author