onsdag, juni 04, 2008

Git completion in tcsh

So I've been a bit envious at the lovely git completion bash users have - but obviously I can't just switch to bash. Anyone who is in the same kind of situation might like the fact that I've started a project to provide this functionality for tcsh.

The first thing you need to do is download the source for tcsh 6.15, and apply the patch you can find here: http://bugs.gw.com/bug_view_advanced_page.php?bug_id=60. Without it it won't work. Compile and install the new tcsh version. The next step is to check out the project from github, at http://github.com/olabini/git_complete_tcsh. Make sure that git_complete is executable and on your path. You need to have Ruby installed for this, btw.

The final step is to modify your .cshrc to add something like this: complete git{,-*} 'p/*/`git_complete`/'.

Now git completion should work, although most of the commands aren't implemented yet. I'll get to them in time. The whole project is a port of the bash completion for git

3 kommentarer:

Anonym sa...

hi! do you know to how to program in java programming language? because java is our major subject and i found this blog about programming. I'll visit here everyday but if you have java tricks, can you post it here? thanks!

Anonym sa...

Hi Ola. How come you're into tcsh?

Nic sa...

If you just do this you get completion of command names, branches, and remotes:

set gitcmds= ( `ls /usr/local/bin/git-*|sed 's/\/usr\/local\/bin\/git-//g'` )
complete git "p/1/($gitcmds)/" 'n/branch/`git branch|cut -c 3-`/' 'n/co/`git branch|cut -c 3-`/' 'n/remote/(show add rm prune update)/' 'N/remote/`git remote`/'