So I see a lot of zsh completion scripts doing:

#compdef _example example

as s short form for

#compdef example
compdef _example example

But looking at the documentation for my 5.9 version, this doesn't seem to be specified (and not needed?).

The specifier

#compdef example

should be enough to mark the file autoloadable and the function defined in it will be called when completing 'example'.

So is that indeed an old style?

#Zsh

@willhbr I'm researching how to write a generic installer command to install completion files for bash or zsh. If the zsh completion files begin with `#compdef name` and `#autoload` and are in `/usr/local/share/zsh/site-functions/`, they will automatically be loaded by zsh.

Ah ha, I figured out how to load bash completions into zsh:

1. The completion file name must start with with a `_` character.
2. The completion file must be installed into `/usr/local/share/zsh/site-functions/`.
3. The completion file must start with the lines `#compdef command-name-here`.
4. You must enable and call the `compinit` and `bashcompinit` modules/commands in your `~/.zshrc`.

If any of those things are missing, the completions won't load/work.
#zsh #bashcompletion

Zsh-completions are now available for passr (https://codeberg.org/oxo/tool/src/branch/main/passr)!
Get the compdef file from the dotfile repository (https://codeberg.org/oxo/dotf/src/branch/main/zsh/completions/_passr).
#linux #dotfiles #zsh #compdef
tool

tool

Codeberg.org