From a90502aeb0062c56cd4b2af69a047ccda27e3394 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Tue, 21 Aug 2001 18:06:24 +0000 Subject: Better handling of manual section numbers. --- Completion/Unix/Command/_man | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'Completion') 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}' -- cgit 1.4.1