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 _fpath is only set later in .zshrc.local. I 
moved the definition of _fpath to .zshrc.pre and it works now.
___
vcs-home mailing list
vcs-home@lists.madduck.net
http://lists.madduck.net/listinfo/vcs-home


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 this.

I do, and I was about to copy it into my own config when I discovered
that I'd already done this 4 years ago and totally forgotten about 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 contab/comtab (becomes: cdgit contrib/completion)
 
 Somebody with zsh/bash skills who already did this?

I hadn't done this before today, but it's easy in zsh:

  https://github.com/aspiers/git-config/commit/89df1d78

Of course, _gitcd needs to be somewhere on your $fpath so it can be
autoloaded.
___
vcs-home mailing list
vcs-home@lists.madduck.net
http://lists.madduck.net/listinfo/vcs-home


Re: cdgit: cd relative to git workdir root

2013-09-16 Thread martin f krafft
also sprach Thomas Koch tho...@koch.ro [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-parse--show-toplevel and then delegate to normal tab
expansion.

So now I just have

  hash -d g=$(git rev-parse --show-toplevel)

in a pre-prompt function and get the same effect.

  fishbowl:~/code/salt|develop|debian% ls ~g/debitab

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
i am not in favour of long engagements. they give people the
 opportunity of finding out each other's character before marriage,
 which i think is never advisable.
-- oscar wilde
 
spamtraps: madduck.bo...@madduck.net


digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)
___
vcs-home mailing list
vcs-home@lists.madduck.net
http://lists.madduck.net/listinfo/vcs-home