summaryrefslogtreecommitdiffstats
path: root/Completion/Unix/Command/_man
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command/_man')
-rw-r--r--Completion/Unix/Command/_man7
1 files changed, 5 insertions, 2 deletions
diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index 2869e99e2..28bc12fe7 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -169,9 +169,12 @@ _man() {
typeset -gHA _manpath_cache
fi
if [[ -z $_manpath_cache[$MANPATH] ]]; then
- local mp
+ local -aU mp
if [[ $variant == netbsd* ]]; then
- mp=( ${(s.:.)$(command man -p 2>/dev/null)} )
+ # 'man -p' gives a newline-separatd list of
+ # /usr/pkg/man/man1 /usr/share/man/man8/amd64 etc.
+ # Here we just remove the trailing /man1 or /man8/amd64 etc.
+ mp=( ${${(f)"$(command man -p 2>/dev/null)"}%%/man/*}/man )
elif [[ $variant != freebsd* ]]; then
mp=( ${(s.:.)$(command man -w 2>/dev/null)} )
fi