2

When asking for a completion by pressing Tab on the zsh command line, the matches can be grouped according to their tag provided that the group-name style is set to an empty string:

autoload -Uz compinit
compinit
zstyle ':completion:*' menu select
zstyle ':completion:*' group-name ''
zstyle ':completion:*:descriptions' format '%d'

In the case of the $ man command, the matches can be divided further if the separate-sections style is set to true for the manuals tag:

autoload -Uz compinit
compinit
zstyle ':completion:*' menu select
zstyle ':completion:*' group-name ''
zstyle ':completion:*:descriptions' format '%d'
zstyle ':completion:*:manuals' separate-sections true

As a result, if I press Tab after $ man write, the completion system suggests these matches:

$ man write
manual page, section 1 (general commands)
write
manual page, section 2 (system calls)
write   writev

And if I select the write match in the first list, $ man opens the write page in the first section of the manual.

But if I select the write match in the second list, $ man still opens the write page in the first section, while the description of the list mentions the second section of the manual.

Is it possible to make zsh pass the relevant manual section to the man command when the separate-sections style is set?

I'm using zsh 5.6.2-dev-0 (x86_64-pc-linux-gnu).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.