From 25e729970712a89d2d125084e4df83418553d55d Mon Sep 17 00:00:00 2001 From: Tomasz N Date: Sat, 16 Mar 2024 02:00:25 +0100 Subject: feat(man): allow opening pages in current window (#27861) With :hide modifier, open page in current window. --- runtime/lua/man.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/man.lua') diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua index ac15aff60c..a9004db3f4 100644 --- a/runtime/lua/man.lua +++ b/runtime/lua/man.lua @@ -716,7 +716,7 @@ function M.open_page(count, smods, args) local target = ('%s(%s)'):format(name, sect) local ok, ret = pcall(function() - if smods.tab == -1 and find_man() then + if smods.hide or (smods.tab == -1 and find_man()) then vim.cmd.tag({ target, mods = { silent = true, keepalt = true } }) else smods.silent = true -- cgit From 59aadf33efc2755ef52ff224e7d279a9ee9cd5dd Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 16 Mar 2024 09:56:58 +0800 Subject: fix(man): pass modifiers also to :tag (#27878) There aren't really many modifiers that take an effect on :tag (except maybe :confirm, :unsilent, :verbose), but pass them for consistency. --- runtime/lua/man.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime/lua/man.lua') diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua index a9004db3f4..58a69f90dd 100644 --- a/runtime/lua/man.lua +++ b/runtime/lua/man.lua @@ -716,11 +716,11 @@ function M.open_page(count, smods, args) local target = ('%s(%s)'):format(name, sect) local ok, ret = pcall(function() + smods.silent = true + smods.keepalt = true if smods.hide or (smods.tab == -1 and find_man()) then - vim.cmd.tag({ target, mods = { silent = true, keepalt = true } }) + vim.cmd.tag({ target, mods = smods }) else - smods.silent = true - smods.keepalt = true vim.cmd.stag({ target, mods = smods }) end end) -- cgit From 3a7c30dc93b9b903ff8591c43689c3bdcb4761de Mon Sep 17 00:00:00 2001 From: Brian Cao <75100021+RandomChugokujin@users.noreply.github.com> Date: Fri, 26 Apr 2024 14:14:45 -0400 Subject: fix(man.vim): q quits after jump to different tag in MANPAGER modified (#28495) --- runtime/lua/man.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'runtime/lua/man.lua') diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua index 58a69f90dd..02e841030f 100644 --- a/runtime/lua/man.lua +++ b/runtime/lua/man.lua @@ -411,15 +411,13 @@ local function find_man() return false end ----@param pager boolean -local function set_options(pager) +local function set_options() vim.bo.swapfile = false vim.bo.buftype = 'nofile' vim.bo.bufhidden = 'unload' vim.bo.modified = false vim.bo.readonly = true vim.bo.modifiable = false - vim.b.pager = pager vim.bo.filetype = 'man' end @@ -475,7 +473,7 @@ local function put_page(page) vim.cmd([[silent! keeppatterns keepjumps %s/\s\{199,}/\=repeat(' ', 10)/g]]) vim.cmd('1') -- Move cursor to first line highlight_man_page() - set_options(false) + set_options() end local function format_candidate(path, psect) @@ -662,7 +660,8 @@ function M.init_pager() vim.cmd.file({ 'man://' .. fn.fnameescape(ref):lower(), mods = { silent = true } }) end - set_options(true) + vim.g.pager = true + set_options() end ---@param count integer @@ -730,7 +729,7 @@ function M.open_page(count, smods, args) if not ok then error(ret) else - set_options(false) + set_options() end vim.b.man_sect = sect -- cgit