about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2001-08-21 18:06:24 +0000
committerBart Schaefer <barts@users.sourceforge.net>2001-08-21 18:06:24 +0000
commita90502aeb0062c56cd4b2af69a047ccda27e3394 (patch)
tree6f86df7817ef3a08b7fe603c9566337b6b5e5a20 /Completion
parent647674f6abe8e6fd01bb115af88b43304ab00025 (diff)
downloadzsh-a90502aeb0062c56cd4b2af69a047ccda27e3394.tar.gz
zsh-a90502aeb0062c56cd4b2af69a047ccda27e3394.tar.xz
zsh-a90502aeb0062c56cd4b2af69a047ccda27e3394.zip
Better handling of manual section numbers.
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Command/_man17
1 files changed, 14 insertions, 3 deletions
diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index 0bdd8db8b..3da15f9ba 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -22,9 +22,20 @@ _man() {
 
   mrd=(${^manpath/\%L/${LANG:-En_US.ASCII}}/mandb(N))
 
-  if [[ $words[2] = (<->*|1M|l|n) ]]; then
-    dirs=( $^manpath/(sman|man|cat)${words[2]}/ )
-    awk="\$2 == \"$words[2]\" {print \$1}"
+  local sect
+  if [[ $OSTYPE = solaris* ]]; then
+    sect=$words[$words[(i)-s]+1]
+  elif [[ -n ${sect:=$words[$words[(i)-S]+1]} || -n ${sect:=$MANSECT} ]]; then
+    if [[ $sect != ${sect::="${sect//:/|}"} ]]; then
+      sect="($sect)"
+    fi
+  elif (( CURRENT > 2 )); then
+    sect=$words[2]
+  fi
+
+  if [[ $sect = (<->*|1M|l|n) || $sect = \(*\|*\) ]]; then
+    dirs=( $^manpath/(sman|man|cat)${~sect}/ )
+    awk="\$2 == \"$sect\" {print \$1}"
   else
     dirs=( $^manpath/(sman|man|cat)*/ )
     awk='{print $1}'