Talkings

1

2 notes

Zsh and slow git completion

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.

  1. davemparrish reblogged this from talkings and added:
    Great post, it helped me to fix my...quote characters were wrong though.
  2. talkings posted this