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
Hi!
All buffers from the session .json file are marked as loaded: false when exiting neovim by closing the terminal window instead of executing :qa!.
Is my understanding that at least 1 of the buffers from that .json file should be marked as loaded: true for everything to work correctly later on load, right? I believe that is the case because this is the root of a problem I'm having and which is kinda painful to fully replicate.
What is the severity of this bug?
tolerable (can work around it)
Steps To Reproduce
Using the provided repro, open neovim nightly with nvim --clean +'so repro.lua'. Put at least 2 files (of any type) under the same cwd as your repro.
Open a new instance of your terminal emulator.
Open neovim with nvim --clean +'so repro.lua'
Open some files and exit neovim with :qa!
Go to the "dirsession" folder (should be on ~...resession_issue/.repro/data/nvim/dirsession/_session_file.json) and inspect the .json file, at least 1 of the buffers is marked as loaded. This is good.
Now repeat step 3 but this time exit neovim by closing your terminal emulator window (I tested this with Kitty and Konsole)
Inspect the .json file again. Now all buffers are marked as unloaded. Bad (I think)
This doesn't seems to cause that much of a problem, until you have some complicated lazy-loading on your neovim config.
My workaround is using "UILeave" event instead of "VimLeavePre":
vim.api.nvim_create_autocmd("UILeave", {
desc="Save a dir-specific session when you close Neovim",
group=vim.api.nvim_create_augroup("resession_autosave_session", { clear=true }),
callback=function()
-- Only save the session if nvim was started with no argsresession.save(vim.fn.getcwd(), { dir="dirsession", notify=false })
end,
})
Expected Behavior
At least 1 buffer should be marked as loaded
Directory structure
.
├── file-1.md
├── file-2.md
└── repro.lua
Repro
-- DO NOT change the pathslocalroot=vim.fn.fnamemodify("./.repro", ":p")
root=root:sub(-1) =="/" androotorroot.."/"-- set stdpaths to use .reprofor_, nameinipairs({ "config", "data", "state", "cache" }) dovim.env[("XDG_%s_HOME"):format(name:upper())] =root..nameend--------------------------------------------------------------------------------vim.g.mapleader=""--------------------------------------------------------------------------------localplugins= {
{
"stevearc/resession.nvim",
event="VeryLazy",
config=function(_, opts)
localresession=require("resession")
resession.setup(opts)
vim.api.nvim_create_autocmd("VimLeavePre", {
desc="Save a dir-specific session when you close Neovim",
group=vim.api.nvim_create_augroup("resession_autosave_session", { clear=true }),
callback=function()
-- Only save the session if nvim was started with no argsresession.save(vim.fn.getcwd(), { dir="dirsession", notify=false })
end,
})
end,
},
}
--------------------------------------------------------------------------------locallazypath=root.."/plugins/lazy.nvim"---@diagnosticdisable-next-line:undefined-fieldifnot (vim.uvorvim.loop).fs_stat(lazypath) thenvim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
endvim.opt.runtimepath:prepend(lazypath)
require("lazy").setup(plugins, {
root=root.."/plugins",
})
Did you check the bug with a clean config?
I have confirmed that the bug reproduces with nvim -u repro.lua using the repro.lua file above.
The text was updated successfully, but these errors were encountered:
Now I realized UILeave also don't work when exiting neovim as :qa!. What always work is just remembering to manually save the session before leaving. I also can't use the autosave option from resession because it uses VimLeavePre under the hook.
Did you check the docs and existing issues?
Neovim version (nvim -v)
NVIM v0.10.0-dev-2064+g2f9ee9b6c
Operating system/version
arch, ubuntu
Describe the bug
Hi!
All buffers from the session
.json
file are marked asloaded: false
when exiting neovim by closing the terminal window instead of executing:qa!
.Is my understanding that at least 1 of the buffers from that
.json
file should be marked asloaded: true
for everything to work correctly later on load, right? I believe that is the case because this is the root of a problem I'm having and which is kinda painful to fully replicate.What is the severity of this bug?
tolerable (can work around it)
Steps To Reproduce
Using the provided repro, open neovim nightly with
nvim --clean +'so repro.lua'
.Put at least 2 files (of any type) under the same cwd as your repro.
nvim --clean +'so repro.lua'
:qa!
~...resession_issue/.repro/data/nvim/dirsession/_session_file.json
) and inspect the.json
file, at least 1 of the buffers is marked as loaded. This is good..json
file again. Now all buffers are marked as unloaded. Bad (I think)This doesn't seems to cause that much of a problem, until you have some complicated lazy-loading on your neovim config.
My workaround is using "UILeave" event instead of "VimLeavePre":
Expected Behavior
At least 1 buffer should be marked as loaded
Directory structure
.
├── file-1.md
├── file-2.md
└── repro.lua
Repro
Did you check the bug with a clean config?
nvim -u repro.lua
using the repro.lua file above.The text was updated successfully, but these errors were encountered: