
Z - Jump to directories that you actually use. - snihalani
https://github.com/rupa/z
======
Watabou
I use fasd, which is just like z, v, autojump, only much more powerful:
<https://github.com/clvv/fasd>

~~~
rjzzleep
you get + 100 karma for posting that. I can't believe I didn't come up with
something similar in all these years

------
4ad
No tricks, just regular cd:

    
    
      % pwd
      /home/aram
      % cd mstate
      /home/aram/src/launchpad.net/juju-core/mstate
      % cd go/src
      /home/aram/go/src
      % cd plan9
      /home/aram/plan9
      %
    

It uses the $CDPATH environment variable ($cdpath in rc(1)). $CDPATH is a list
of places in which to search for the wanted directory. I put all the things I
regularly use there, and my cds are almost always short, usually just a single
name.

I don't maintain $CDPATH myself, my profile runs a one liner that descends
into certain directories and constructs $CDPATH for me within the constrains
of some rules (for example excludes leafs, excludes {bin,doc,pkg,test}, etc).

Finding about $CDPATH was a huge productivity boost to me, not only in time
saved typing, but in allowing me to change the way I work. I now rarely care
where things in the filesystem are (e.g. various source code for various
software, where the build products are, etc). I used to do a lot of moving and
symlinking around, to arrange stuff so I remember where I've put it and to
keep paths short, but now I don't care. It could be wherever, it's just one
name away. The namespace had become a big hash.

~~~
6ren
Just tried this to see if tab-completion works. It does (only for _cd_ of
course). BTW: what is "rc(1)"?

~~~
4ad
Rc(1) is the Unix v10/Plan 9 shell[1] written by Tom Duff[2], of Duff's
device[3] fame. Rc(1) is of course available in Unix as well, I use the port
from plan9port[4].

[1] <http://doc.cat-v.org/plan_9/4th_edition/papers/rc>

[2] <http://en.wikipedia.org/wiki/Tom_Duff>

[3] <http://en.wikipedia.org/wiki/Duff%27s_device>

[4] <http://swtch.com/plan9port/>

------
mathieuh
Fish-compatible version: <https://github.com/sjl/z-fish>

~~~
StavrosK
Thanks for that, added! It looks pretty promising.

------
bhudman
I've been using a tool called autojump that does a similar thing and I love
it.. <https://github.com/joelthelion/autojump>

Tools like Z and autojump are fantastic timesavers.

------
grimgrin
If you like his Z, check out his V (if you use Vim).

<https://github.com/rupa/v>

------
shawndumas
CDPATH, as desribed in man bash

'The search path for the cd command. This is a colon-separated list of
directories in which the shell looks for destination directories specified by
the cd command. A sample value is ".:~:/usr".'

------
olalonde
In case anyone else is wondering what "frecency" is:

Frecency is a portmantaeu of ’recent’ and ’frequency’. It is a weighted rank
that depends on how often and how recently something occured. As far as I
know, Mozilla came up with the term.

------
ericb
I have been using this--very handy. Is there a version that doesn't cd? It'd
be nice for ls, etc.

~~~
tehwalrus
just use an alias wrapper like:

    
    
      alias zls='z \!*;ls;cd -'
    

(with additional zll etc for ls -l or -a)

------
wahnfrieden
Is this good for zsh? Is there a preferred alternative?

~~~
jkjeldgaard
It works just fine with zsh. If you're on a mac you can easily install z (and
keep it up to date) with `brew install z`

~~~
crcastle
FYI - The caveat for how to set up z for zsh were wrong in brew. I just
submitted a pull request to fix this.

<https://github.com/mxcl/homebrew/pull/14621>

~~~
metamorfos
Great, updating brew asap!

------
chanux
Shameless plug: Bash function to jump back in path

<https://gist.github.com/1119556>

~~~
cpeterso
In bash, you can just _cd -_ to pop back to the previous working directory,
like _popd_ without the _pushd_.

I also set .bash_profile aliases to quickly cd up the directory tree with just
dots. It's silly, but surprising helpful.

    
    
      alias ..='cd ..'
      alias ...='cd ../..'
      alias ....='cd ../../..'

~~~
zaptheimpaler
I like that idea, I could definitely see it being helpful. I've type _cd.._
too many times when I meant to say _cd .._

~~~
cpeterso
me too. That's why I also:

    
    
      alias cd..='cd ..'
    

:)

------
manojlds
Posz for Powershell - <https://github.com/manojlds/posz>

------
StavrosK
Does anyone know what the initial --add is for? I'm using z-fish and I'm
wondering if I can elide it.

------
pooriaazimi
It's a wonderful little tool. I love it. Give it a try, you won't regret!

