Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Neat hash -d trick



* 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



Messages sorted by: Reverse Date, Date, Thread, Author