fix(man.lua): cache pages until width changes #40607

Problem: :Man unloads hidden buffers, so reopening large pages reruns rendering
even when the width is unchanged.

Solution: keep regular man buffers loaded and refresh them only when the
effective width changes.
This commit is contained in:
Barrett Ruth
2026-07-06 05:45:10 -05:00
committed by GitHub
parent f034e5f66b
commit a6827be98f
2 changed files with 45 additions and 10 deletions

View File

@@ -37,3 +37,14 @@ vim.api.nvim_create_autocmd('BufReadCmd', {
end
end,
})
vim.api.nvim_create_autocmd('BufWinEnter', {
group = augroup,
pattern = 'man://*',
callback = function()
local err = require('man').refresh_page()
if err then
vim.notify('man.lua: ' .. err, vim.log.levels.ERROR)
end
end,
})