Closed paw-lu closed 2 years ago
Not able to reproduce this on CentOS. But seems exlusive to my macos.
That's not a zinit issue. You are missing git completions. These are supposed to be shipped with zsh, but macOS doesn't. I don't know what's the recommended way of installing the missing comps on darwin. It's probably brew install something
.
If you can't figure it out you can give zinit pack"rootless" for zsh-static
a shot.
thanks for the responce!
You are missing git completions.
it definitley worked before migration to zinit
If I change my zshrc from the above to just
# My .zshrc
autoload -Uz compinit && compinit
git completions work as expected!
% git com<TAB>
% git commit
It's only when using zinit's zicompinit;
where problems arise.
I see that if I run zinit completions
that both needed files are present as well (_git
and git-completion.bash
)
% zinit completions | rg git
git %/opt/homebrew/share/zsh/site-functions
% ls /opt/homebrew/share/zsh/site-functions
_git git-completion.bash
This directory is probably not in your fpath.
zinit fpath -f /opt/homebrew/share/zsh/site-functions
I will add this my todo for the system-completions package, or zinit core. Not entirely sure where this would fit best yet.
yeah you're right—it isn't, and additing manually to fpath does solve the problem.
I guess the part I don't understand is why it was working fine before zinit, and zinit required more manual intervention. (Not actuall expecting support here since it's probably macos specific, just thinking outloud).
also (again), really appreciate the discussion and guidance here!
Looked into this a bit more—as the completion we got from this was worse than before for me (less options, not working on all commands, etc). The actual issue is that another file is being used for completion instead of the default completion provided by zsh.
% autoload -Uz compinit && compinit
% whence -v $_comps[git]
_git is a shell function from /usr/local/Cellar/zsh/5.8_1/share/zsh/functions/_git
% source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
% autoload -Uz compinit && compinit
% zinit completions | grep ^git,
100.0%
git, rg %/opt/homebrew/share/zsh/site-functions
So we want the default /usr/local/Cellar/zsh/5.8_1/share/zsh/functions/_git
, but zinit seems to prefer /opt/homebrew/share/zsh/site-functions
, which is why the original exceptions were occuring.
What's the suggested method to giving priority here to /usr/local/Cellar/zsh/5.8_1/share/zsh/functions/_git
over the homebrew directory?
To be clear, I know we can force /usr/local/Cellar/zsh/5.8_1/share/zsh/functions/_git
by just running creinstall
. Just wondering if there was a less hardcoded way to make sure this doesn't occur for other packages in the future.
zinit wait lucid light-mode for \
...
atpull'zinit creinstall -q' \
is-snippet /usr/local/Cellar/zsh/5.8_1/share/zsh/functions/_git \
...
Issue description
Any time I call
zicompinit
, git's completion gets polluted by errors.git version 2.31.1
zinit config
zinit version or commit ID
19347bad3b3a09f9b6344225ea338c63888eae70
zsh version
5.8