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


5 Comments, Comment or Ping

  1. Did You Know?

    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!

    June 4th, 2008

  2. Anonymous

    Hi Ola. How come you’re into tcsh?

    June 8th, 2008

  3. Nic

    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`/’

    June 29th, 2008

  4. Isao

    @Nic

    alteratively, for git checkout/co I use this: ‘n~checkout~F:.git/refs/heads~’

    it completes the branch name based on local ref filenames.

    January 7th, 2011

  5. Marc

    Note that git 1.8.1 will have a first version of support for tcsh-completion as mentioned below:
    http://marc.info/?l=git&m=135456897811682&w=2

    You can find the script, git-completion.tcsh, and the necessary accompanying bash script, git-completion.bash, here:
    https://github.com/git/git/tree/master/contrib/completion

    Some improvements are still being worked on.

    Marc

    December 6th, 2012

Reply to “Git completion in tcsh”