zsh-users
 help / color / mirror / code / Atom feed
From: Jean-Rene David <jrdavid.ml@magma.ca>
To: zsh-users@zsh.org
Subject: Re: Neat hash -d trick
Date: Wed, 27 Oct 2010 11:45:18 -0400	[thread overview]
Message-ID: <20101027154518.GS11455@lefuneste.homelinux.org> (raw)
In-Reply-To: <AANLkTikBOSBNfBHXDFdfiCkijVt5G5+-1UVFz_VqY3wZ@mail.gmail.com>

* Nikolai Weibull [2010.10.21 18:40]:
> I came up with this just now:
> 
> for ((i = 1; i < 9; i++)); do
>   hash -d .$i=${(j:/:)${(l:2::.:)${(s::)${(l:i::.:)}}}}
> done
> 
> It allows you to write
> 
> cd ~.4/dir
> 
> which would cd to ../../../../dir, given that that directory exists.
> 
> If someone could come up with a simpler expansion that would be sweet.

Once, a long time ago, I bound "\C-k" to "cd .."
and I never looked back. It's easy to type and
easy to repeat. And with the current directory in
the prompt (RPS1 in my case) it's very easy (and
very fast) to go up high enough but no further in
the directory tree (without having to count
directories).

Neat trick though... :-)

-- 
JR


      parent reply	other threads:[~2010-10-27 16:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-21 22:34 Nikolai Weibull
2010-10-22  4:05 ` Bart Schaefer
2010-10-22  7:28   ` Mikael Magnusson
2010-10-22  8:09     ` Julien Nicoulaud
2010-10-22  8:39     ` Jérémie Roquet
2010-10-22 10:29   ` Nikolai Weibull
2010-10-22 14:24   ` Oliver Kiddle
2010-10-27 15:45 ` Jean-Rene David [this message]

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=20101027154518.GS11455@lefuneste.homelinux.org \
    --to=jrdavid.ml@magma.ca \
    --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).