Merge pull request #25 from zeertzjq/man-section-remove-space

bugfix: always open the correct man page section
main
ibhagwan 3 years ago committed by GitHub
commit 20016902db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,8 +13,17 @@ local actions = require "fzf-lua.actions"
local M = {}
local function getmanpage(line)
-- match until comma or space
return string.match(line, "[^, ]+")
-- extract section from the last pair of parentheses
local name, section = line:match("^(.*)%((.-)%)[^()]-$")
if name:sub(-1) == " " then
-- man-db
name = name:sub(1, -2)
else
-- mandoc
name = name:match("^[^, ]+")
section = section:match("^[^, ]+")
end
return name .. "(" .. section .. ")"
end
M.manpages = function(opts)

Loading…
Cancel
Save