You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't find a way to configure to restore last session on startup.
Provide background
No response
What is the significance of this feature?
nice to have
Additional details
It would be good to have the following behavior: if no running neovim instance exists, then restore last session on startup. If an instance does exist, then just open neovim without loading any sessions.
Alternatively, always restore the session that was last terminated.
The text was updated successfully, but these errors were encountered:
{
"stevearc/resession.nvim",
lazy=false,
config=function()
localresession=require("resession")
resession.setup({})
vim.api.nvim_create_autocmd("VimEnter", {
callback=function()
-- Only load the session if nvim was started with no argsifvim.fn.argc(-1) ==0then-- Open the last session if it existsresession.load("last", { silence_errors=true })
endend,
nested=true,
})
vim.api.nvim_create_autocmd("VimLeavePre", {
callback=function()
-- Always save a special session named "last"resession.save("last", { notify=false })
end,
})
end,
}
This config saves the current session on exit as "last". When you open nvim, it will attempt to restore a session with the same name.
If you want separate sessions per director, you can change it to the following:
{
"stevearc/resession.nvim",
lazy=false,
config=function()
localresession=require("resession")
resession.setup({})
vim.api.nvim_create_autocmd("VimEnter", {
callback=function()
-- Only load the session if nvim was started with no argsifvim.fn.argc(-1) ==0then-- Save these to a different directory, so our manual sessions don't get pollutedresession.load(vim.fn.getcwd(), { dir="dirsession", silence_errors=true })
endend,
nested=true,
})
vim.api.nvim_create_autocmd("VimLeavePre", {
callback=function()
resession.save(vim.fn.getcwd(), { dir="dirsession", notify=true })
end,
})
end,
}
Did you check existing requests?
Describe the feature
I can't find a way to configure to restore last session on startup.
Provide background
No response
What is the significance of this feature?
nice to have
Additional details
It would be good to have the following behavior: if no running neovim instance exists, then restore last session on startup. If an instance does exist, then just open neovim without loading any sessions.
Alternatively, always restore the session that was last terminated.
The text was updated successfully, but these errors were encountered: