Zsh man page completion

On zsh some commands like tree have man page based completions. For example if I type tree - and then hit Tab it shows options for the command but for other commands like dialog, if I type dialog - and hit Tab it doesn’t give me completions. Is there any way I can get man page based completions for all commands?

Sure, you just have to write them. (and share them with devs)

Wait so these completions are not parsed from man pages automatically?

Wishful thinking. :slight_smile:

They are provided either by zsh, zsh-completions or individual packages.
You can check /usr/share/zsh/site-functions/ or /usr/share/zsh/functions/Completion/.

Your tree example:

cat /usr/share/zsh/functions/Completion/Unix/_tree

EDIT: I did a quick search and there are some alternatives: https://www.reddit.com/r/zsh/comments/mhrerr/can_zsh_look_give_you_suggestions_by_looking_at/

Oops thought it was like fish. Oh well thanks for your help :slight_smile:.

Not familiar with fish but somehow I highly doubt that it magically parses completions from man pages.

1 Like

From

Man Page Completions

Man Page Completions Thumbnail

Other shells support programmable completions, but only fish generates them automatically by parsing your installed man pages.

1 Like

Well, I guess magic is real. :stuck_out_tongue:

Added an edit to solution post, if it’s of any help.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.