[Bug]: Autoload not working
rubiin opened this issue · comments
Your minimal.lua
config
{
"olimorris/persisted.nvim",
-- stylua: ignore
keys = {
{ "<leader>qs", function() require("persisted").load() end, desc = "Restore Session" },
{ "<leader>ql", function() require("persisted").load({ last = true }) end, desc = "Restore Last Session" },
{ "<leader>qd", function() require("persisted").stop() end, desc = "Don't Save Current Session" },
{
"<leader>fs",
"<cmd>Telescope persisted<cr>",
desc = "Find Session",
},
},
opts = {
save_dir = vim.fn.expand(vim.fn.stdpath("data") .. "/sessions/"), -- directory where session files are saved
silent = false, -- silent nvim message when sourcing session file
use_git_branch = false, -- create session files based on the branch of a git enabled repository
default_branch = "main", -- the branch to load if a session file is not found for the current branch
autosave = true, -- automatically save session files when exiting Neovim
autoload = true, -- 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 to match current working directory if it changes
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 when auto-saving and auto-loading
telescope = {
reset_prompt = true, -- Reset the Telescope prompt after an action?
},
should_autosave = function()
local excluded_filetypes = {
"alpha",
"oil",
"lazy",
"",
}
for _, filetype in ipairs(excluded_filetypes) do
if vim.bo.filetype == filetype then
return false
end
end
return true
end,
},
},
Error messages
None
Describe the bug
When I open a folder , no session is restored automatically. Manually restoring works though
Reproduce the bug
Open a directory in neovim
Open few files
Exit vim
Repopen the directory
Final checks
- I have made sure this issue exists in the latest version of the plugin
- I have tested with the
minimal.lua
config file above and still get the issue - I have used
SessionSave
to save the session before restarting Neovim and usingSessionLoad
- I have made sure this is not a duplicate issue
found the issue to be lazyloading
@rubiin how did you fix it?
remove lazyloading globally or put lazy=false in the plugin spec @alankritjoshi