fix(man): avoid setting v:errmsg (#30052)

This commit is contained in:
zeertzjq 2024-08-15 22:02:20 +08:00 committed by GitHub
parent 4199671047
commit ee5aaba215
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -479,7 +479,13 @@ local function put_page(page)
-- XXX: nroff justifies text by filling it with whitespace. That interacts
-- badly with our use of $MANWIDTH=999. Hack around this by using a fixed
-- size for those whitespace regions.
vim.cmd([[silent! keeppatterns keepjumps %s/\s\{199,}/\=repeat(' ', 10)/g]])
-- Use try/catch to avoid setting v:errmsg.
vim.cmd([[
try
keeppatterns keepjumps %s/\s\{199,}/\=repeat(' ', 10)/g
catch
endtry
]])
vim.cmd('1') -- Move cursor to first line
highlight_man_page()
set_options()

View File

@ -20,7 +20,7 @@ local function get_search_history(name)
local args = vim.split(name, ' ')
local code = [[
local args = ...
local man = require('runtime.lua.man')
local man = require('man')
local res = {}
man.find_path = function(sect, name)
table.insert(res, {sect, name})