try to fix nvim hanging when it exits

main
Bryan 2024-11-11 00:19:28 -06:00
parent 1934279d0b
commit cf4c944b21
1 changed files with 22 additions and 22 deletions

View File

@ -113,6 +113,7 @@ end
---Save the session ---Save the session
---@param opts? { force?: boolean, session?: string } ---@param opts? { force?: boolean, session?: string }
function M.save(opts) function M.save(opts)
vim.schedule(function()
opts = opts or {} opts = opts or {}
-- Do not save the session if should_save evals to false...unless it's forced -- Do not save the session if should_save evals to false...unless it's forced
@ -135,7 +136,6 @@ function M.save(opts)
if type(config.save_pre) == "function" then if type(config.save_pre) == "function" then
config.save_pre() config.save_pre()
end end
vim.schedule(function()
vim.api.nvim_command("wa") vim.api.nvim_command("wa")
vim.api.nvim_command("mksession! " .. e(opts.session or vim.g.persisting_session or M.current())) vim.api.nvim_command("mksession! " .. e(opts.session or vim.g.persisting_session or M.current()))
end) end)