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.

If I type:

rm <TAB>

I'll see possible completions almost instantly.

However, if I type:

git rm <TAB>

It'll hang for several seconds if it's in a git repo, or fail to show any completions if I'm outside of a git repo.

How can I fix this behavior?

There's nothing in my .zshrc that looks like it has to do with git :-/

share|improve this question
    
+1 This drives me so batty I've wired my brain to not hit <TAB> when using git. –  Christopher Aug 8 '12 at 12:12

1 Answer 1

up vote 10 down vote accepted

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.

share|improve this answer
    
Worked perfectly! Thanks a bunch! –  rodarmor Aug 8 '12 at 18:01
    
This did not work for me. I'm loading the following oh-my-zsh plugins: plugins=(git gitfast last-working-dir zeus). I loaded the above function after the plugins. –  justingordon Nov 21 '13 at 21:41
    
I had the same problem. Commenting to confirm success: on OSX 10.8.5, zsh 4.3.11, git 1.8.2, that .zshrc entry made all the difference. Without it, cpu regularly pinned at 100%. With it, tab completion seems about the same for git commands as any other. Thank you! :) –  cweekly Apr 4 at 20:34

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.