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, git add forms<tab>
, git takes 20 seconds or more to find the file (in this example, forms.py), and in this timespan I can't do anything else in the terminal. Is there any way to turn off the autocompletion feature, or somehow make it faster?
fpath : The git-completion. zsh is a function file, not designed to be sourced like the bash script. This command appends the ~/. zsh directory onto the shell's function lookup list.
zsh-autocomplete adds real-time type-ahead autocompletion to Zsh. Find as you type, then press Tab to insert the top completion, Shift Tab to insert the bottom one, or ↓ / PgDn to select another completion.
It can really save you a lot of typing. If there is more than one possibility, then it will let you know that it needs more information and you can type a little bit more of the word and try again. Git auto-completion is a separate script, and it's included inside the Git source code repository on GitHub.
It's not git auto completing the file names, it's your shell. Do you have the same delay when doing e.g. "cat forms< tab >"?
Check out this post with similar problems:
http://talkings.org/post/5236392664/zsh-and-slow-git-completion
This post suggests adding the following to your .zshrc:
__git_files () { _wanted files expl 'local files' _files }
EDIT: Here's the original text of that post
I found many posts relating complaints about how painfully slow git auto-completion can be in large repositories. There were various suggested patches and suggestions to load the latest zsh. Maybe one of those things would work, but all I really want is for it to complete the names of branches and files as they are in the file system. I did not find any suggestions on how to get this behavior so I figured it out for myself. I thought I would share this for anyone who might benefit from it. I just added the following to my .zshrc file:
__git_files () { _wanted files expl 'local files' _files }
Now I can run git commands and get near instant completion while still getting file completion similar to what ls would provide.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With