cdgit: cd relative to git workdir root

Valodim Skywalker valodim at
Thu Sep 19 14:45:21 CEST 2013

I wrote a script a while ago which uses information from zsh's vcs_info
to maintain the root of a repository in the cdpath as long as you're in
the dir. Works with any vcs supported by vcs_info.

If you are not familiar with cdpath, it's an array in zsh which allows
specifying more paths for cd to look in for candidates to change the
working directory to. And since it's a built-in thing, you get
integration with cd and completion for free :)

This requires a prompt which calls vcs_info, since it is implemented as
a hook. The script should be self-contained and work by just sourcing it.

If you can't get it to work, setting this style
    zstyle ':vcs_info:*' debug true
might help to check if the hook is called properly.


 - Valodim

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <>

More information about the vcs-home mailing list