fix(restart): keep :restart error message concise #40746

(cherry picked from commit 4f1ef2dec1)
This commit is contained in:
Olivia Kinnear
2026-07-15 18:05:46 -05:00
parent 3a0e6239e9
commit a198506815
2 changed files with 26 additions and 14 deletions

View File

@@ -149,8 +149,16 @@ function M.ex_session_restart(after_cmd, quit_cmd)
end)
if not success then
--- @cast msg string
fs.rm(session, { force = true })
error(msg)
-- Trim error message to be equivalent to `:restart!`
local trimmed_msg = msg:match('Vim:.*$')
if trimmed_msg then
vim.api.nvim_echo({ { trimmed_msg:sub(5) } }, true, { err = true })
else
error(msg)
end
end
end