cdgit: cd relative to git workdir root
Vincent Demeester
vincent at demeester.fr
Mon Sep 16 22:00:33 CEST 2013
Hi,
I have the same need, and thanks for the aliases, now I can do it :).
>
> Now it would be cool, to have an alias to cd into a specific subdir of the git
> worktree and have zsh (or bash) auto completion for this like
>
> git clone git://git.kernel.org/pub/scm/git/git.git
> cd git/gitweb/static/js/lib (just to be somewhere deep)
> cdgit con<tab>/com<tab> (becomes: cdgit contrib/completion)
>
> Somebody with zsh/bash skills who already did this?
>
I'm no zsh expert but a potential solution on zsh could be the use of
*hashes*. An hash is a shortcut in zsh. For example, having the following :
hash -d github=$HOME/src/github
You can use do things like :
cd ~github/vdemeester
And zsh completion work as usual.
Having a code in zshrc that update the hash for the current git root
directory (or clean it if not in a git working directory) would do the
trick.
But it's zsh-only and I'm not sure if it would be better or worst in
term of performance
Regards
--
__o Vincent Demeester
_<_\,_ http://vincent.demeester.fr
(_)|'(_) GPG: 68FDEBFE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <http://lists.madduck.net/pipermail/vcs-home/attachments/20130916/2a11890e/attachment.pgp>
More information about the vcs-home
mailing list