From eb5622edae69ec65f6f83fcdd0eb5a70ce48ece7 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 6 Jul 2024 21:22:40 +0200 Subject: [PATCH] feat!: removed `opts.options`. Use `vim.o.sessionoptions` instead. --- lua/persistence/config.lua | 9 ++------- lua/persistence/init.lua | 5 +---- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/lua/persistence/config.lua b/lua/persistence/config.lua index 17d9a72..7ef5296 100644 --- a/lua/persistence/config.lua +++ b/lua/persistence/config.lua @@ -1,17 +1,12 @@ local M = {} ----@class PersistenceOptions ----@field pre_save? fun() ----@field post_save? fun() ----@field pre_load? fun() ----@field post_load? fun() +---@class Persistence.Config 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 } ----@type PersistenceOptions +---@type Persistence.Config M.options = {} function M.setup(opts) diff --git a/lua/persistence/init.lua b/lua/persistence/init.lua index d6ac1f5..3d2dd9b 100644 --- a/lua/persistence/init.lua +++ b/lua/persistence/init.lua @@ -70,10 +70,7 @@ function M.stop() end function M.save() - local tmp = vim.o.sessionoptions - vim.o.sessionoptions = table.concat(Config.options.options, ",") - vim.cmd("mks! " .. e(M.current or M.get_current())) - vim.o.sessionoptions = tmp + vim.cmd("mks! " .. e(M._current or M.current())) end function M.load(opt)