ZSH auto completion for git takes significant amount of time, can I turn it off or optimize it?

前端 未结 6 2046
悲哀的现实
悲哀的现实 2021-01-31 03:49

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,

6条回答
  •  难免孤独
    2021-01-31 04:30

    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.

提交回复
热议问题