Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Having a hard time dealing with a completion collision



I'm using todoman <https://github.com/pimutils/todoman> and it provides
a useful completion for ZSH (I happen to be the writer of it):
<https://github.com/pimutils/todoman/blob/master/contrib/completion/zsh/_todo>

TIL there's another completion file in ZSH's tree that has `#compdef
todo` among other common aliases for it:
https://gitlab.com/zsh-org/zsh/-/blob/5c55b3fb50bbfe602fcfa55fa6258e398ecc6b20/Completion/Unix/Command/_devtodo

I'm using NixOS and this is my `$fpath`:

~/.zsh/comp/tested
~/.zsh/comp/local
/usr/local/share/zsh/site-functions
/nix/store/k9rq1cymsrbfybzgx21c5g851085w0fz-zsh-5.7.1/share/zsh/site-functions
/nix/store/k9rq1cymsrbfybzgx21c5g851085w0fz-zsh-5.7.1/share/zsh/5.7.1/functions
/run/current-system/sw/share/zsh/site-functions
/run/current-system/sw/share/zsh/5.7.1/functions
/run/current-system/sw/share/zsh/vendor-completions
/nix/var/nix/profiles/default/share/zsh/site-functions
/nix/var/nix/profiles/default/share/zsh/5.7.1/functions
/nix/var/nix/profiles/default/share/zsh/vendor-completions
/etc/profiles/per-user/doron/share/zsh/site-functions
/etc/profiles/per-user/doron/share/zsh/5.7.1/functions
/etc/profiles/per-user/doron/share/zsh/vendor-completions
~/.nix-profile/share/zsh/site-functions
~/.nix-profile/share/zsh/5.7.1/functions
~/.nix-profile/share/zsh/vendor-completions

I tried putting the replacement `_todo` file in my first fpath directory
- `~/.zsh/comp/tested/` but surprisingly I still got the failing devtodo
completion loaded instead of the replacement completion.

Assuming I'm not interested in submitting a change to ZSH's source tree,
what would be the best way to handle this collision? My current rather
ugly workaround is to rename the desired completion's file to `_td` and
make it complete `td` instead of `todo` while using the following:

td(){
  todo "$@"
}

An alias doesn't work because ZSH see's there's such an alias and it
loads devtodo's completion just like it would as if there wasn't an
alias.

Help will be appreciated.

Doron.



Messages sorted by: Reverse Date, Date, Thread, Author