mirror of
https://github.com/neovim/neovim.git
synced 2026-08-03 06:09:14 +00:00
fix(restart): keep :restart error message concise #40746
(cherry picked from commit 4f1ef2dec1)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user