From 97a71ab4846c4b92a1e658ec00ff3eae74bf1256 Mon Sep 17 00:00:00 2001 From: Josh Hirschkorn <53196448+vortexisalpha@users.noreply.github.com> Date: Mon, 27 Jul 2026 14:20:46 +0100 Subject: fix(man): use direct lookup without manpath #40421 Problem: On NetBSD, `man -w open` can return the exact manpage path, but `:Man` may still fail when man directories cannot be discovered from `manpath -q`, bare `man -w`, or `$MANPATH`. Solution: Fall back to the direct manpage lookup when directory discovery fails. Add a test for resolving `open(2)` through `goto_tag()` without manpath data. --- test/functional/plugin/man_spec.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/man_spec.lua b/test/functional/plugin/man_spec.lua index 330b10e4dc..40b0dac81f 100644 --- a/test/functional/plugin/man_spec.lua +++ b/test/functional/plugin/man_spec.lua @@ -304,6 +304,31 @@ describe(':Man', function() ) end) + it('uses direct manpage lookup if man directories cannot be determined #25919', function() + eq( + { + { + name = 'open', + filename = 'man://open(2)', + cmd = '1', + }, + }, + exec_lua(function() + local man = require('man') + vim.env.MANPATH = nil + vim.npcall = function() + return nil + end + man._find_path = function(name, sect) + if name == 'open' and sect == '2' then + return '/usr/share/man/man2/open.2' + end + end + return man.goto_tag('open(2)') + end) + ) + end) + it('tries variants with spaces, underscores #22503', function() eq({ { vim.NIL, 'NAME WITH SPACES' }, -- cgit