aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/man.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2023-03-07 15:13:09 +0100
committerJustin M. Keyes <justinkz@gmail.com>2023-03-07 15:23:06 +0100
commit304477ff3504373a336c83127654e65eddfa2ef9 (patch)
tree6ec14dfc8b6719da7b9bd3ca851af4dd00946ef5 /runtime/lua/man.lua
parent160a019ffa104eebd65f4037729954d98aca6ad0 (diff)
downloadrneovim-304477ff3504373a336c83127654e65eddfa2ef9.tar.gz
rneovim-304477ff3504373a336c83127654e65eddfa2ef9.tar.bz2
rneovim-304477ff3504373a336c83127654e65eddfa2ef9.zip
fix(man.lua): tests, naming
Diffstat (limited to 'runtime/lua/man.lua')
-rw-r--r--runtime/lua/man.lua14
1 files changed, 7 insertions, 7 deletions
diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua
index f420cc0d67..cca9434e9c 100644
--- a/runtime/lua/man.lua
+++ b/runtime/lua/man.lua
@@ -384,7 +384,7 @@ local function extract_sect_and_name_ref(ref)
return sect, name
end
--- search_for_path attempts to find the path to a manpage
+-- find_path attempts to find the path to a manpage
-- based on the passed section and name.
--
-- 1. If manpage could not be found with the given sect and name,
@@ -395,7 +395,7 @@ end
-- 4. If a path still wasn't found, return nil.
---@param sect string?
---@param name string
-function M.search_for_path(sect, name)
+function M.find_path(sect, name)
if sect and sect ~= '' then
local ret = get_path(sect, name, true)
if ret then
@@ -584,8 +584,8 @@ local function get_paths(sect, name)
---@type string[]
local paths = fn.globpath(mandirs, 'man?/' .. name .. '*.' .. sect .. '*', false, true)
- -- Prioritize the result from search_for_path as it obeys b:man_default_sects.
- local first = M.search_for_path(sect, name)
+ -- Prioritize the result from find_path as it obeys b:man_default_sects.
+ local first = M.find_path(sect, name)
if first then
paths = move_elem_to_head(paths, first)
end
@@ -754,9 +754,9 @@ function M.open_page(count, smods, args)
end
-- Try both spaces and underscores, use the first that exists.
- local path = M.search_for_path(sect, name)
+ local path = M.find_path(sect, name)
if path == nil then
- path = M.search_for_path(sect, spaces_to_underscores(name))
+ path = M.find_path(sect, spaces_to_underscores(name))
if path == nil then
man_error('no manual entry for ' .. name)
end
@@ -793,7 +793,7 @@ end
-- Called when a man:// buffer is opened.
function M.read_page(ref)
local sect, name = extract_sect_and_name_ref(ref)
- local path = M.search_for_path(sect, name)
+ local path = M.find_path(sect, name)
if path == nil then
man_error('no manual entry for ' .. name)
end