zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users <zsh-users@sunsite.dk>
Subject: Re: Problem with fake-files style and cd
Date: Sat, 14 Feb 2009 13:39:04 -0800	[thread overview]
Message-ID: <090214133904.ZM15383@torch.brasslantern.com> (raw)
In-Reply-To: <237967ef0902141141y609b61d3i154546f6f6886c65@mail.gmail.com>

On Feb 14,  8:41pm, Mikael Magnusson wrote:
}
} 2009/2/14 Bart Schaefer <schaefer@brasslantern.com>:
} > 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?)

} 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?

It's been like that for years ... in fact originally it appears that
the local-directories style was *always* used, even if cdpath was not
set, so someone (Sven?) probably decided that it didn't make sense to
differentiate "local" if there was no possibility of "non-local".  The
ChangeLog from that time gives no hints.

I'm also sure the expectation was that cdpath is not something that
changes state frequently; it's value might change but not whether it
*has* a value.

} > I use this:
} >
} >    zstyle :completion::complete:cd:: tag-order \
} >        local-directories path-directories

This can easily be modified to deal with a flip-flop of cdpath:

    zstyle :completion::complete:cd:: tag-order \
    	'directories local-directories' path-directories

The local-directories style doc ought to mention this, I guess.

} 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/

??  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.


  reply	other threads:[~2009-02-14 21:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mikachu@gmail.com>
2009-02-14 14:22 ` Mikael Magnusson
2009-02-14 18:01   ` Peter Stephenson
2009-02-14 18:19     ` Mikael Magnusson
2009-02-14 19:13       ` Bart Schaefer
2009-02-14 19:41         ` Mikael Magnusson
2009-02-14 21:39           ` Bart Schaefer [this message]
2009-02-14 22:09             ` Mikael Magnusson
2009-02-14 23:26               ` Bart Schaefer
2009-02-14 23:35                 ` Mikael Magnusson
2009-02-15  2:28                   ` Mikael Magnusson
2009-02-15  4:59                     ` Bart Schaefer
2009-02-15  9:36                       ` Mikael Magnusson
2009-02-16  9:46             ` 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=090214133904.ZM15383@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@sunsite.dk \
    /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).