#compdef — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #compdef, aggregated by home.social.
-
So I see a lot of zsh completion scripts doing:
#compdef _example example
as s short form for
#compdef example
compdef _example exampleBut 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?
-
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