about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2002-01-10 11:00:05 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2002-01-10 11:00:05 +0000
commit5659f442c09bf3e94a60887b998473af02590477 (patch)
tree1180270207278bd62e4061dc44533780eaa45c84 /Completion
parent324e26d8ceb08ea907c686265f2b51bbc8232cff (diff)
downloadzsh-5659f442c09bf3e94a60887b998473af02590477.tar.gz
zsh-5659f442c09bf3e94a60887b998473af02590477.tar.xz
zsh-5659f442c09bf3e94a60887b998473af02590477.zip
allow manual pages to be shown separated by section with new separate-sections style (16426)
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Command/_man24
-rw-r--r--Completion/Zsh/Command/_zstyle1
2 files changed, 23 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) )
 
diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle
index ffd3c6dd4..48a39deed 100644
--- a/Completion/Zsh/Command/_zstyle
+++ b/Completion/Zsh/Command/_zstyle
@@ -100,6 +100,7 @@ styles=(
   remove-all-dups	 c:bool
   select-prompt          c:
   select-scroll          c:
+  separate-sections      c:bool
   single-ignored         c:single-ignored
   sort			 c:bool
   special-dirs		 c:sdirs