mirror of
https://github.com/folke/persistence.nvim.git
synced 2025-08-31 06:59:32 +02:00
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:
parent
d8a3eda0e1
commit
f4bb0c5641
5 changed files with 8 additions and 0 deletions
|
@ -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,
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue