-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
zsh completion doesn't seem to work with zinit #330
Comments
|
Apparently not. I never had and it was never causing issues, because I only use forgit's aliases, which are referencing the However, adding the |
Hi @Gerrit-K, I don't know a lot about zinit or macOS, but I wrote the zsh completion functions for forgit so hopefully we can figure this out together 🙂 Additionally to
That's a bit odd and forgit needs the completion functions for the individual git commands for the completions to function properly. Could you please run the following in your zsh and let me know the results? for line in $fpath; do grep _git-add "$line/"**/*(-.); done Also can you post the content of the Just to be sure could you let me know how you initialize completions in your .zshrc? For example, mine looks like this
It would also be good to know which version of git you're using and where you installed it from. |
Hey @sandr01d, first of all, thank you so much for the detailed answer and all the effort to help me ❤️ It might very well be just a niche edge case, but I really appreciate it! To get back to your replies:
Yes ✔️
Not at all, unfortunately.
Sure, here's the (slighly anonymized 😉) result:
_git function
This is unfortunately a bit more convoluted in my setup, due to how zinit works. It's kind of similar to this config (which I've adapted, but diverged from, several years ago) with the matching call here. I can try to simplify my setup to see if it fixes the issue 👍
Sure! It's |
So what this essentially boils down to is |
Hey, sorry for the delayed reply! I think I've figured out what's happening. First of all, the reason why Next problem was to get the aliases working. When I zi lucid for \
completions \
sbin'bin/*' \
src'completions/git-forgit.zsh' \
wfxr/forgit \
atinit'zicompinit; zicdreplay' \
zdharma-continuum/fast-syntax-highlighting The idea (based on this example) was that:
However, I reordered the plugins so that zi lucid for \
atinit'zicompinit; zicdreplay' \
zdharma-continuum/fast-syntax-highlighting
completions \
sbin'bin/*' \
src'completions/git-forgit.zsh' \
atload'zicdreplay' \
wfxr/forgit \ With that, everything finally worked. It's not the most ideal solution and I'll probably continue working on it, but for now I'm happy that this case is solved. I'm sorry to have bothered you with this, but I'm really grateful for your help, as I probably wouldn't have invested the time to fix this if you hadn't provided troubleshooting suggestions. Thank you! |
Fwiw, the changes from #340 fixed all issues described above and zinit is now handling the single completion file perfectly well 👏 |
Nice, thanks for the info! Also thanks for the write-up, what an interesting edge case. |
Check list
Environment info
Problem / Steps to reproduce
Installed zsh (5.9) via Homebrew
Installed fzf and forgit using zinit
simplified zinit config
Try out completions
Try
source
inggit-forgit.zsh
results in_default:compcall:12: can only be called from completion function
, which is likely caused by running_git
directly in line 13 of the script.I'm by far not an expert when it comes to zsh completions, but I noticed there are no
_git-*
completion functions, but also nogit-*
commands on my system. Everything is handled bygit [command]
and the_git
completion function. Maybe the forgit completions don't account for that?The text was updated successfully, but these errors were encountered: