cdgit: cd relative to git workdir root

Valodim Skywalker valodim at mugenguild.com
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 :)

https://github.com/Valodim/zshrc/blob/master/modules/96-vcs_info-cdpath.zsh

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.

Cheers,

 - Valodim

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.madduck.net/pipermail/vcs-home/attachments/20130919/9322faae/attachment.pgp>


More information about the vcs-home mailing list