From e3647c10876e7b1fb121df84d4f8f08e1c5c2e8d Mon Sep 17 00:00:00 2001 From: olimorris Date: Tue, 28 Feb 2023 18:54:33 +0000 Subject: [PATCH] refactor: clean up session loading --- lua/persisted/init.lua | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/lua/persisted/init.lua b/lua/persisted/init.lua index 3bd875c..5f3e643 100644 --- a/lua/persisted/init.lua +++ b/lua/persisted/init.lua @@ -85,11 +85,7 @@ function M.load(opt) if session then if vim.fn.filereadable(session) ~= 0 then - if config.options.follow_cwd then - vim.g.persisting_session = nil - else - vim.g.persisting_session = session - end + vim.g.persisting_session = config.options.follow_cwd and nil or session -- TODO: Alter this function call after deprecation notice ends utils.load_session(session, config.options.before_source, config.options.after_source, config.options.silent) -- @@ -157,12 +153,7 @@ function M.save(opt) return end - if vim.g.persisting_session == nil then - vim.cmd("mks! " .. e(get_current())) - else - vim.cmd("mks! " .. e(vim.g.persisting_session)) - end - + vim.cmd("mks! " .. e(vim.g.persisting_session or get_current())) vim.g.persisting = true --TODO: Remove this after deprecation notice period ends