diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-05-08 16:09:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-08 16:09:33 +0800 |
commit | a961bb71010b5579df9d05aae17fe224f8066e94 (patch) | |
tree | bbe3c08542c2f4a8f90058bbe708e62307eb3180 /runtime/lua/man.lua | |
parent | 057a5bc78d90db50caa85cdb34986fb186f0fd98 (diff) | |
parent | 3001d86aea184f8b015c1bfffd2db42c946f8a84 (diff) | |
download | rneovim-a961bb71010b5579df9d05aae17fe224f8066e94.tar.gz rneovim-a961bb71010b5579df9d05aae17fe224f8066e94.tar.bz2 rneovim-a961bb71010b5579df9d05aae17fe224f8066e94.zip |
Merge pull request #23486 from msva/patch-1
fix(man.lua): return support of all sections
Diffstat (limited to 'runtime/lua/man.lua')
-rw-r--r-- | runtime/lua/man.lua | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua index 1158d80941..ac493bdc7f 100644 --- a/runtime/lua/man.lua +++ b/runtime/lua/man.lua @@ -583,7 +583,7 @@ local function get_paths(sect, name) local mandirs = table.concat(vim.split(mandirs_raw, '[:\n]', { trimempty = true }), ',') ---@type string[] - local paths = fn.globpath(mandirs, 'man?/' .. name .. '*.' .. sect .. '*', false, true) + local paths = fn.globpath(mandirs, 'man[^\\/]*/' .. name .. '*.' .. sect .. '*', false, true) -- Prioritize the result from find_path as it obeys b:man_default_sects. local first = M.find_path(sect, name) @@ -739,7 +739,12 @@ function M.open_page(count, smods, args) else -- Combine the name and sect into a manpage reference so that all -- verification/extraction can be kept in a single function. - if tonumber(args[1]) then + if args[1]:match('^%d$') or args[1]:match('^%d%a') or args[1]:match('^%a$') then + -- NB: Valid sections are not only digits, but also: + -- - <digit><word> (see POSIX mans), + -- - and even <letter> and <word> (see, for example, by tcl/tk) + -- NB2: don't optimize to :match("^%d"), as it will match manpages like + -- 441toppm and others whose name starts with digit local sect = args[1] table.remove(args, 1) local name = table.concat(args, ' ') |