dotfiles
dotfiles copied to clipboard
Switch from Zsh's git completion to Git's git completion instead
Yeah yeah, #69 happened, but:
-
This is the big one: Zsh-based
git
completions don't include custom git subcommands. For example, I have agit-shalector
script andgit sha<TAB>
doesn't work with Zsh's git completions, but does work with Git's. -
The problem in #69 was that
gc
was broken. I now have a custom fuzzy-finder-backedgc
that I love much more than tab-completion of git branches. -
Both Zsh and Git complete git aliases like
git full
, though Zsh is a little better. I'm fine with using Git's version.- With Zsh,
git <TAB>
will show the aliases along with standard subcommands, and completes them as you'd expect:
$ git <TAB> #...other output... unpack-objects -- unpack objects from packed archive unstage -- alias for 'reset HEAD' up -- alias for '!git fetch origin && git rebase origin/master'
- With Git,
git <TAB>
only shows the standard subcommands. However, if I start typing a custom alias and hit tab, likegit fu<TAB>
, then it autocompletes as you'd expect. I always know which alias I want to use, so I'm fine typing the first bit.
- With Zsh,
For debugging, here's how to switch between completions:
- To switch to Zsh-based completion:
brew uninstall --ignore-dependencies git && brew install git --without-completions
, then open a new shell - To switch to Git-based completion:
brew uninstall --ignore-dependencies git && brew install git
, then open a new shell