Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: man completion



On Sun, May 15, 2022 at 8:20 AM Karel Balej <karelb@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> Yet when I export MANPATH as ":/some/path", I only get suggestions from
> this directory and not from the default directories. Could this detail
> be overlooked in the completion function?

The completion function is calling $(manpath 2>/dev/null), but it's
caching the result, so if you change $MANPATH that's not being picked
up.

It also clobbers the cache if called with the -M or -m options and
doesn't reset it, which is clearly wrong.

A quick but suboptimal fix (I will not be pushing this to git):

diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index dba1d13dc..0e0415cc7 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -16,7 +16,7 @@
 _man() {
   local dirs expl mrd awk variant noinsert
   local -a context line state state_descr args modes
-  local -aU sects
+  local -aU sects _manpath
   local -A opt_args val_args sect_descs

   if [[ $service == man ]]; then




Messages sorted by: Reverse Date, Date, Thread, Author