summaryrefslogtreecommitdiff
path: root/completions/man
diff options
context:
space:
mode:
Diffstat (limited to 'completions/man')
-rw-r--r--completions/man8
1 files changed, 3 insertions, 5 deletions
diff --git a/completions/man b/completions/man
index a00ac7a0..0668b8ee 100644
--- a/completions/man
+++ b/completions/man
@@ -45,23 +45,21 @@ _man()
return
fi
- _expand || return
-
# file based completion if parameter looks like a path
if [[ "$cur" == @(*/|[.~])* ]]; then
_filedir "$manext"
return
fi
- local manpath="$MANPATH"
- [[ -z $manpath ]] && \
- manpath=$( manpath 2>/dev/null || command man -w 2>/dev/null )
+ local manpath=$( manpath 2>/dev/null || command man -w 2>/dev/null )
[[ -z $manpath ]] && manpath="/usr/share/man:/usr/local/share/man"
# determine manual section to search
local sect
[[ "$prev" == $mansect ]] && sect=$prev || sect='*'
+ _expand || return
+
manpath=$manpath:
if [[ -n $cur ]]; then
manpath="${manpath//://*man$sect/$cur* } ${manpath//://*cat$sect/$cur* }"