Git\'s tab autocompletion is useful for small projects, but I\'m currently working on two big projects that use git and for these it\'s worse than useless. Whenever I type, say,
This is because Zsh comes by default with extremely bloated completion for Git. I wrote a blog post explaining how I fixed this bloatedness, but it had to be outside of the Zsh project.
The easy answer is to install Git's zsh completion, which is different than Zsh's git completion (which comes by default). Download git-completion.zsh, and place it in your ~/.zsh/_git
. Then place it on your fpath:
fpath=(~/.zsh $fpath)
You should be flying now.
As another comment here explains; another option is to use oh-my-sh and enable the gitfast plugin, which achieves the same thing.
Why would Zsh developers insist on making their code slow? I don't know, but here you can see a sample of their reasoning: Re: Slowness issue with git completion.