2021-07-12 10:47:09 +02:00
|
|
|
local M = {}
|
|
|
|
|
2024-07-06 21:22:40 +02:00
|
|
|
---@class Persistence.Config
|
2021-07-12 10:47:09 +02:00
|
|
|
local defaults = {
|
2024-06-11 20:53:08 -07:00
|
|
|
dir = vim.fn.stdpath("state") .. "/sessions/", -- directory where session files are saved
|
2023-10-13 07:57:09 +02:00
|
|
|
save_empty = false, -- don't save if there are no open file buffers
|
2021-07-12 10:47:09 +02:00
|
|
|
}
|
|
|
|
|
2024-07-06 21:22:40 +02:00
|
|
|
---@type Persistence.Config
|
2021-07-12 10:47:09 +02:00
|
|
|
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
|