You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great if you could generate completions and then add them to the zsh fpath so they are automatically loaded.
For example, installing git with homebrew will add this file /opt/homebrew/share/zsh/site-functions/_git. If the parent directory is added to the special zsh fpath variable before compinit is called the completions will work without any explicit configuration. Most popular zsh frameworks like oh-my-zsh will setup this up for you by default.
However the currently generated completions for cliffy are not compatible with this approach and have no effect. They only work if you explicitly source the generated completions.
I did some experimenting and found there are 3 main differences from other common tool completions that seem to be the problem.
The first line needs to be #compdef <name>
There needs to be a non commented _<name> "$@" call. There is a similar line at the end but commented out.
The usage of (($+functions[...])) || function ... seems to cause a recursion issue when applying the previous changes. Removing the functions check fixes the issue. Not sure why.
I am not sure if there was a specific reason for the way it's currently done or if changing it to the way I suggested also works when sourcing. I would be willing to g to open a PR to demonstrate the suggested changes.
The text was updated successfully, but these errors were encountered:
It would be great if you could generate completions and then add them to the zsh
fpath
so they are automatically loaded.For example, installing
git
with homebrew will add this file/opt/homebrew/share/zsh/site-functions/_git
. If the parent directory is added to the special zshfpath
variable beforecompinit
is called the completions will work without any explicit configuration. Most popular zsh frameworks likeoh-my-zsh
will setup this up for you by default.However the currently generated completions for cliffy are not compatible with this approach and have no effect. They only work if you explicitly source the generated completions.
I did some experimenting and found there are 3 main differences from other common tool completions that seem to be the problem.
#compdef <name>
_<name> "$@"
call. There is a similar line at the end but commented out.(($+functions[...])) || function ...
seems to cause a recursion issue when applying the previous changes. Removing the functions check fixes the issue. Not sure why.I am not sure if there was a specific reason for the way it's currently done or if changing it to the way I suggested also works when sourcing. I would be willing to g to open a PR to demonstrate the suggested changes.
The text was updated successfully, but these errors were encountered: