From df231232c7b193f3d0bd22441c4632948d7356dc Mon Sep 17 00:00:00 2001 From: olimorris Date: Wed, 26 Oct 2022 17:14:40 +0100 Subject: [PATCH] fix: #38 reinstate on_autoload_no_session --- lua/persisted/config.lua | 1 + lua/persisted/init.lua | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/persisted/config.lua b/lua/persisted/config.lua index 01e1b18..fef9973 100644 --- a/lua/persisted/config.lua +++ b/lua/persisted/config.lua @@ -10,6 +10,7 @@ local defaults = { autosave = true, -- automatically save session files when exiting Neovim should_autosave = nil, -- function to determine if a session should be autosaved autoload = false, -- automatically load the session for the cwd on Neovim startup + on_autoload_no_session = nil, -- function to run when `autoload = true` but there is no session to load follow_cwd = true, -- change session file name with changes in current working directory allowed_dirs = nil, -- table of dirs that the plugin will auto-save and auto-load from ignored_dirs = nil, -- table of dirs that are ignored for auto-saving and auto-loading diff --git a/lua/persisted/init.lua b/lua/persisted/init.lua index 7dc78b6..66e4363 100644 --- a/lua/persisted/init.lua +++ b/lua/persisted/init.lua @@ -110,8 +110,8 @@ function M.load(opt) vim.g.persisting_session = session end utils.load_session(session, config.options.before_source, config.options.after_source, config.options.silent) - elseif type(config.options.should_autosave) == "function" then - config.options.should_autosave() + elseif type(config.options.on_autoload_no_session) == "function" then + config.options.on_autoload_no_session() end end