Change where session post save autocommand is defined
parent
88f5508d46
commit
a8a0bfd2f1
|
|
@ -95,7 +95,7 @@ function M.start()
|
|||
vim.api.nvim_create_autocmd("VimLeavePre", {
|
||||
group = vim.api.nvim_create_augroup("Persisted", { clear = true }),
|
||||
callback = function()
|
||||
-- M.save()
|
||||
M.save()
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
@ -110,6 +110,16 @@ function M.stop()
|
|||
M.fire("Stop")
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("SessionWritePost", {
|
||||
callback = function()
|
||||
if type(config.save_post) == "function" then
|
||||
config.save_post()
|
||||
end
|
||||
M.fire("SavePost")
|
||||
-- return true -- returning true deletes autocmd after fired
|
||||
end,
|
||||
})
|
||||
|
||||
---Save the session
|
||||
---@param opts? { force?: boolean, session?: string }
|
||||
function M.save(opts)
|
||||
|
|
@ -122,16 +132,6 @@ function M.save(opts)
|
|||
return
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("SessionWritePost", {
|
||||
callback = function()
|
||||
if type(config.save_post) == "function" then
|
||||
config.save_post()
|
||||
end
|
||||
M.fire("SavePost")
|
||||
return true -- returning true deletes autocmd after fired
|
||||
end,
|
||||
})
|
||||
|
||||
M.fire("SavePre")
|
||||
if type(config.save_pre) == "function" then
|
||||
config.save_pre()
|
||||
|
|
|
|||
Loading…
Reference in New Issue