fix: preview the correct man page section (#1076)
This commit is contained in:
@@ -646,6 +646,10 @@ builtin.man_pages({opts}) *builtin.man_pages()*
|
|||||||
Parameters: ~
|
Parameters: ~
|
||||||
{opts} (table) options to pass to the picker
|
{opts} (table) options to pass to the picker
|
||||||
|
|
||||||
|
Fields: ~
|
||||||
|
{sections} (table) a list of sections to search, use `{ "ALL" }` to
|
||||||
|
search in all sections
|
||||||
|
|
||||||
|
|
||||||
builtin.reloader({opts}) *builtin.reloader()*
|
builtin.reloader({opts}) *builtin.reloader()*
|
||||||
Lists lua modules and reloads them on `<cr>`
|
Lists lua modules and reloads them on `<cr>`
|
||||||
|
|||||||
@@ -244,6 +244,7 @@ builtin.help_tags = require("telescope.builtin.internal").help_tags
|
|||||||
|
|
||||||
--- Lists manpage entries, opens them in a help window on `<cr>`
|
--- Lists manpage entries, opens them in a help window on `<cr>`
|
||||||
---@param opts table: options to pass to the picker
|
---@param opts table: options to pass to the picker
|
||||||
|
---@field sections table: a list of sections to search, use `{ "ALL" }` to search in all sections
|
||||||
builtin.man_pages = require("telescope.builtin.internal").man_pages
|
builtin.man_pages = require("telescope.builtin.internal").man_pages
|
||||||
|
|
||||||
--- Lists lua modules and reloads them on `<cr>`
|
--- Lists lua modules and reloads them on `<cr>`
|
||||||
|
|||||||
@@ -505,14 +505,14 @@ previewers.man = defaulter(function(opts)
|
|||||||
return previewers.new_buffer_previewer {
|
return previewers.new_buffer_previewer {
|
||||||
title = "Man Preview",
|
title = "Man Preview",
|
||||||
get_buffer_by_name = function(_, entry)
|
get_buffer_by_name = function(_, entry)
|
||||||
return entry.value
|
return entry.value .. "/" .. entry.section
|
||||||
end,
|
end,
|
||||||
|
|
||||||
define_preview = function(self, entry, status)
|
define_preview = function(self, entry, status)
|
||||||
local win_width = vim.api.nvim_win_get_width(self.state.winid)
|
local win_width = vim.api.nvim_win_get_width(self.state.winid)
|
||||||
putils.job_maker({ "man", entry.section, entry.value }, self.state.bufnr, {
|
putils.job_maker({ "man", entry.section, entry.value }, self.state.bufnr, {
|
||||||
env = { ["PAGER"] = pager, ["MANWIDTH"] = win_width },
|
env = { ["PAGER"] = pager, ["MANWIDTH"] = win_width },
|
||||||
value = entry.value,
|
value = entry.value .. "/" .. entry.section,
|
||||||
bufname = self.state.bufname,
|
bufname = self.state.bufname,
|
||||||
})
|
})
|
||||||
putils.regex_highlighter(self.state.bufnr, "man")
|
putils.regex_highlighter(self.state.bufnr, "man")
|
||||||
|
|||||||
Reference in New Issue
Block a user