feat(persistence): pre_save option to call before saving (#22)

* feat(persistence): `pre_save` option to call before saving

This commit adds the `pre_save` option, which is a `fun()|nil` that will
be called (if present) before saving the current session. Use cases
include filtering buffers, executing `User` autocmds, etc.

* docs: `pre_save` option
This commit is contained in:
Iron-E 2023-02-28 09:05:58 +00:00 committed by GitHub
parent d8a3eda0e1
commit f4bb0c5641
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 0 deletions

View file

@ -30,6 +30,10 @@ function M.start()
vim.api.nvim_create_autocmd("VimLeavePre", {
group = vim.api.nvim_create_augroup("persistence", { clear = true }),
callback = function()
if Config.options.pre_save then
Config.options.pre_save()
end
M.save()
end,
})