fix: #38 reinstate on_autoload_no_session

main
olimorris 2022-10-26 17:14:40 +01:00
parent 5c5c4ae949
commit df231232c7
2 changed files with 3 additions and 2 deletions

View File

@ -10,6 +10,7 @@ local defaults = {
autosave = true, -- automatically save session files when exiting Neovim autosave = true, -- automatically save session files when exiting Neovim
should_autosave = nil, -- function to determine if a session should be autosaved should_autosave = nil, -- function to determine if a session should be autosaved
autoload = false, -- automatically load the session for the cwd on Neovim startup 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 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 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 ignored_dirs = nil, -- table of dirs that are ignored for auto-saving and auto-loading

View File

@ -110,8 +110,8 @@ function M.load(opt)
vim.g.persisting_session = session vim.g.persisting_session = session
end end
utils.load_session(session, config.options.before_source, config.options.after_source, config.options.silent) utils.load_session(session, config.options.before_source, config.options.after_source, config.options.silent)
elseif type(config.options.should_autosave) == "function" then elseif type(config.options.on_autoload_no_session) == "function" then
config.options.should_autosave() config.options.on_autoload_no_session()
end end
end end