zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <Peter.Stephenson@csr.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: possibly useful zsh_directory_name implementation
Date: Fri, 11 Mar 2011 10:44:02 +0000	[thread overview]
Message-ID: <20110311104402.6a411b10@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <AANLkTin+cCxFRYtwZXGSUWyLjfe7NV-eDx1mcS9sSau0@mail.gmail.com>

On Fri, 11 Mar 2011 02:06:45 +0100
Mikael Magnusson <mikachu@gmail.com> wrote:
> function zsh_directory_name () {
>...
> }
> 
> With this, /home/mikachu/some/directory/somewhere% cd ~[/some], will
> take you to /home/mikachu/some/, and cd ~[.foo] will take you to foo/
> in whatever parent directory has a subdirectory foo, for example it
> could be /home/foo/.

I've been meaning to add a zsh_directory_name hook, so you can have
multiple functions implementing this and the function here would
interact nicely with other functions that implemented naming without the
"/" or "." at the start.  However, I need to think about the
consequences --- it's more complicated than the existing hooks.

(Just to state the obvious, you can get a less controllable effect of
this using cdpath, although I find life's a bit too complicated to rely
on cdpath these days.  My zsh_directory_name implements a hierarchical
scheme where, for example, [p:c:p=main] specifies which Perforce client
I'm using, which project within the client, and which private branch
within the project.  It might be interesting to generalise this to
something configurable with associative arrays.)

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


  parent reply	other threads:[~2011-03-11 11:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-11  1:06 Mikael Magnusson
2011-03-11  1:15 ` Mikael Magnusson
2011-03-11 10:44 ` Peter Stephenson [this message]
2011-03-11 12:06   ` Mikael Magnusson
2011-03-11 12:17     ` Peter Stephenson
2011-03-11 12:32       ` Mikael Magnusson
2011-03-11 16:25   ` Peter Stephenson
2011-03-11 16:33     ` Peter Stephenson
2011-03-11 17:09       ` Mikael Magnusson
2011-03-11 18:24         ` Peter Stephenson
2011-03-11 17:44 ` Jérémie Roquet

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=20110311104402.6a411b10@pwslap01u.europe.root.pri \
    --to=peter.stephenson@csr.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).