Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I just switched from bash to using zsh 4.3.4 on Ubuntu Hardy. I'm developing with git and I find myself constantly fighting with the default git completions: filename completion tries to be smart by detecting what you've added or removed (using git-ls-files) but sometimes it gets things wrong---e.g., if you are in a sub-directory. It also doesn't know about my custom git aliases (e.g., git ci as an alias for commit).

zsh superusers, how should I improve this situation?

Here are some of my thoughts, though I don't know how to implement them as I'm new to zsh, so maybe you can help or offer your own:

  • Disable git filename completion, leaving just branch/tag/command-name/command-option completion.
  • Replace the "smart" filename completion with the regular zsh filename completion.
  • Get a newer _git completion file, if it fixes these bugs, and override the system one.

Thanks!

share|improve this question
    
Have you tried github.com/robbyrussell/oh-my-zsh –  ukanth Oct 6 '09 at 15:34
    
Yes, as far as I can tell, it just adds a git prompt and doesn't tweak the underlying completions. –  Emil Sit Oct 6 '09 at 18:42
    
Can someone just tell us how to disable all the "smart" completion for all git commands? They do too much IO. The shell needs to respond instantly. I just want to go back to good old simple filename completion for git commands. Every time I do a web search for this I just get a maze of generic zsh man page info. –  Peter Lyons Jul 13 '10 at 19:58
2  
FYI for anyone who wants to just disable the annoying git completion that causes the shell to block doing IO, on Ubuntu 10.04, I just did this: sudo mv /usr/share/zsh/functions/Completion/Unix/_git /usr/share/zsh/functions/Completion/Unix/OFF_git –  Peter Lyons Sep 28 '10 at 5:56

2 Answers 2

Try upgrading to the latest version of Zsh. I just upgraded from 4.3.4 to 4.3.10 and it at least fixes the problem with Git aliases not completing.

Instead of hacking my installation I added this to my local .zshrc:

customzsh=/usr/local/src/zsh-4.3.10/bin/zsh-4.3.10
if [ "$SHELL" != "$customzsh" ]; then
  export SHELL=$customzsh
  exec $customzsh
fi
share|improve this answer

For large projects, even the newer git completion scripts are far too slow. To disable them and just use normal file completion, place the following command in your .zshrc:

compdef -d git
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.