How can I debug ZSH completion for git on macos

479 Views Asked by At

I switched to zsh when I upgraded to Catalina and have been generally very happy, especially with how many completions just work without any work on my part. But sometime in the last week or so, completions stopped working. It had been working (again, with no work on my part) for aliases I had like co for checkout so that I could do

% git co mybr<tab>       # becomes git co mybranch

But now even BASIC completions like subcommands doesn't work

% git checko<tab>        # nothing.  doh!

So I did some basic investigation. My fpath, below, shows the only customizations seems to be some stuff that brew stuck in /usr/local/share

pristineuser ~ % echo $fpath
/usr/local/share/zsh/site-functions /usr/share/zsh/site-functions /usr/share/zsh/5.7.1/functions

pristineuser ~ % ls /usr/local/share/zsh/site-functions /usr/share/zsh/site-functions 
/usr/local/share/zsh/site-functions:
_brew       _brew_cask

/usr/share/zsh/site-functions:

pristineuser ~ % ls -1 /usr/share/zsh/5.7.1/functions | grep git
VCS_INFO_detect_git
VCS_INFO_get_data_git
_git
_git-buildpackage
_stgit
_topgit
run-help-git

ANyone have idea why my git zsh completions aren't working (even simple subcommands) or how I can debug what is happening?

1

There are 1 best solutions below

0
On

So, I'm not sure what happened. But just going to first principles and reading the docs about zsh completions led me to add:

autoload -Uz compinit && compinit

to my .zprofile and everything works as expected.

I'm unclear how this was working previously (change to OSX defaults with an update? more likely, some arbitrary edits on my part for some other thing?)