ZSH tab completion of git commands is very slow. How can I turn it off?

I finally bothered to google this and came up with this SO answer, which worked perfectly for me. Add this to .zshrc:

__git_files () { 
    _wanted files expl 'local files' _files     
}

There's also a deep mailing list thread here about it explaining what zsh is doing to take so long.


Here's another option: the official Git zsh completion: git-completion.zsh. All you need to do is download that to ~/.zsh/_git, and make sure it's in your fpath:

fpath=(~/.zsh $fpath)

I find it interesting that this thread is mentioned in another response; I started that thread, and I wrote the official Git zsh completion as a result.

Tags:

Unix

Shell

Git

Zsh