summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_man
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command/_man')
-rw-r--r--Completion/Unix/Command/_man24
1 files changed, 22 insertions, 2 deletions
diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index 3da15f9ba..44634369c 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -40,8 +40,28 @@ _man() {
dirs=( $^manpath/(sman|man|cat)*/ )
awk='{print $1}'
fi
+ if zstyle -t ":completion:${curcontext}:manuals" separate-sections; then
+ typeset -U sects
+ local ret=1
- _wanted manuals expl 'manual page' _man_pages
+ sects=( ${(o)${dirs##*(man|cat)}%/} )
+
+ (( $#sects )) || return 1
+
+ _tags manuals.${^sects}
+ while _tags; do
+ for sect in $sects; do
+ _requested manuals.$sect expl "manual page, section $sect" _man_pages &&
+ ret=0
+ done
+ (( ret )) || return 0
+ done
+
+ return 1
+ else
+ sect=
+ _wanted manuals expl 'manual page' _man_pages
+ fi
}
_man_pages() {
@@ -56,7 +76,7 @@ _man_pages() {
matcher=
fi
- pages=( $dirs )
+ pages=( ${(M)dirs:#*$sect/} )
compfiles -p pages '' '' "$matcher" '' dummy '*'
pages=( ${^~pages}(N:t:r) )