Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] fix _man for NetBSD
- X-seq: zsh-workers 53866
- From: Jun T <takimoto-j@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] fix _man for NetBSD
- Date: Thu, 21 Aug 2025 17:05:11 +0900
- Archived-at: <https://zsh.org/workers/53866>
- List-id: <zsh-workers.zsh.org>
After workers/53251 (commit 7798fd8), completion for man does not
work on NetBSD:
NetBSD% man zsh<TAB>
No match for: `manual page' or `corrections'
The above commit uses 'man -p' for getting manpage search path on
NetBSD, but it gives a list of paths separated by newline (not :),
and the paths include /sect or /sect/arch, like
/usr/share/man/man1 /usr/share/man/man8/amd64 etc.
In the patch below I just removed the trailing /man1 or /man8/amd64.
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author