fix: output suppressed when opening files (#348)

This commit is contained in:
Steven Arcangeli 2024-04-19 10:40:35 -04:00
parent 8bb35eb81a
commit 6c48ac7dc6

View file

@ -601,7 +601,6 @@ M.select = function(opts, callback)
horizontal = opts.horizontal, horizontal = opts.horizontal,
split = opts.split, split = opts.split,
keepalt = true, keepalt = true,
emsg_silent = true,
} }
local filebufnr = vim.fn.bufadd(normalized_url) local filebufnr = vim.fn.bufadd(normalized_url)
local entry_is_file = not vim.endswith(normalized_url, "/") local entry_is_file = not vim.endswith(normalized_url, "/")
@ -633,11 +632,15 @@ M.select = function(opts, callback)
cmd = "buffer" cmd = "buffer"
end end
end end
vim.cmd({ local ok, err = pcall(vim.cmd, {
cmd = cmd, cmd = cmd,
args = { filebufnr }, args = { filebufnr },
mods = mods, mods = mods,
}) })
-- Ignore swapfile errors
if not ok and not err:match("^Vim:E325:") then
vim.api.nvim_echo({ { err, "Error" } }, true, {})
end
if opts.preview then if opts.preview then
vim.api.nvim_set_option_value("previewwindow", true, { scope = "local", win = 0 }) vim.api.nvim_set_option_value("previewwindow", true, { scope = "local", win = 0 })