23 lines
623 B
Lua
Raw Normal View History

2021-07-12 10:47:09 +02:00
local M = {}
---@class PersistenceOptions
---@field pre_save? fun()
---@field post_save? fun()
---@field pre_load? fun()
---@field post_load? fun()
2021-07-12 10:47:09 +02:00
local defaults = {
dir = vim.fn.stdpath("state") .. "/sessions/", -- directory where session files are saved
options = { "buffers", "curdir", "tabpages", "winsize", "skiprtp" }, -- sessionoptions used for saving
save_empty = false, -- don't save if there are no open file buffers
2021-07-12 10:47:09 +02:00
}
---@type PersistenceOptions
M.options = {}
function M.setup(opts)
M.options = vim.tbl_deep_extend("force", {}, defaults, opts or {})
vim.fn.mkdir(M.options.dir, "p")
end
return M