Re: cdgit: cd relative to git workdir root

2013-09-19 Thread Valodim Skywalker
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

Re: cdgit: cd relative to git workdir root

2013-09-17 Thread Thomas Koch
On Tuesday, September 17, 2013 09:44:48 PM Thomas Koch wrote: > Unfortunately the auto completion does not seem to work for me. It just > completes the files of the current dir as if it would not see the _gitcd > file. Sorry! I had the answer one second later: compinit is called in .zshrc but _fp

Re: cdgit: cd relative to git workdir root

2013-09-17 Thread Thomas Koch
On Monday, September 16, 2013 11:36:46 PM Adam Spiers wrote: > https://github.com/aspiers/git-config/commit/89df1d78 Thank you! How about this for gitcd: #autoload git rev-parse --show-toplevel | read root [ $? -eq 0 ] || return $? cd "$root/$1" Unfortunately the auto completion does not see

Re: cdgit: cd relative to git workdir root

2013-09-16 Thread martin f krafft
also sprach Thomas Koch [2013.09.16.2101 +0200]: > shell alias cdgit = cd $(git root) I've tried to make this happen many years ago, but I never finished the ZLE widget that did it. The idea was to bind 'tab' to a function that would replace an occurrence of ~g in $LBUFFER with the output of rev-

Re: cdgit: cd relative to git workdir root

2013-09-16 Thread Adam Spiers
On Mon, Sep 16, 2013 at 09:01:14PM +0200, Thomas Koch wrote: > Hi, > > I frequently have the need to cd back to the root of the current git workdir > and created to alias for this: > > git alias root = rev-parse --show-toplevel > > shell alias cdgit = cd $(git root) > > Maybe somebody likes th

Re: cdgit: cd relative to git workdir root

2013-09-16 Thread Vincent Demeester
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/