From 6c48ac7dc679c5694a2c0375a5e67773e31d8157 Mon Sep 17 00:00:00 2001 From: Steven Arcangeli Date: Fri, 19 Apr 2024 10:40:35 -0400 Subject: [PATCH] fix: output suppressed when opening files (#348) --- lua/oil/init.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/oil/init.lua b/lua/oil/init.lua index 43f5bf1..f68eb5f 100644 --- a/lua/oil/init.lua +++ b/lua/oil/init.lua @@ -601,7 +601,6 @@ M.select = function(opts, callback) horizontal = opts.horizontal, split = opts.split, keepalt = true, - emsg_silent = true, } local filebufnr = vim.fn.bufadd(normalized_url) local entry_is_file = not vim.endswith(normalized_url, "/") @@ -633,11 +632,15 @@ M.select = function(opts, callback) cmd = "buffer" end end - vim.cmd({ + local ok, err = pcall(vim.cmd, { cmd = cmd, args = { filebufnr }, 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 vim.api.nvim_set_option_value("previewwindow", true, { scope = "local", win = 0 })