Closed okkdev closed 3 months ago
With your setup, :q
seems to close the buffer you're working in, leaving the no-neck-pain tabs open:
I see. But if I disable
them pre save, how are they getting persisted? Is that because the working buffer closes first?
So doing :q
triggers the VimLeavePre
autocmd. I've built Persisted to listen for that autocmd and run the persisted.save
method which in turn calls this method:
---Write the session to disk
---@param session string
---@return nil
local function write(session)
vim.api.nvim_exec_autocmds("User", { pattern = "PersistedSavePre" })
vim.cmd("mks! " .. e(session))
vim.g.persisting = true
vim.api.nvim_exec_autocmds("User", { pattern = "PersistedSavePost" })
end
I suspect that VimLeavePre
causes a conflict with NoNeckPain which doesn't allow it to close down its buffers. Might be worth asking the creator how this works in their plugin.
A quick search on GitHub reveals that there are a lot of users utilising the PersistedSavePre
hook with other plugins.
I'm taking @shortcuts up on their offer to ping them.
@shortcuts Any ideas/insight, why this doesn't work?
Hey there, thanks for the investigation! I've tried with your reproduction and the only weird thing I've seen is that the reopened file is one of the nnp side buffer.
My guess is that there is a race condition between the two plugin since we both have hooks on the quit events. I noticed the prompt before quitting on your recording @olimorris and I do believe this might cause an issue, from my investigation it seems to be on the nnp side so I'll try to see if I can improve that!
@shortcuts sounds great. Totally up for rework on my side too to get our plugins to be friends 😉
I found someone close the NoNeckPain buffers "manually": https://github.com/yuma140902/dotfiles-public/blob/8dd33b742a45e74416b785d1a529ef4e35120752/neovim/nvim/lua/rc/plugins.lua#L568
They are using the blank buffers, I'm not sure how I can identify the buffers when I have scratch pads enabled. I tried some things, but couldn't get it to work. It's probably a skill issue though.
I found someone close the NoNeckPain buffers "manually": https://github.com/yuma140902/dotfiles-public/blob/8dd33b742a45e74416b785d1a529ef4e35120752/neovim/nvim/lua/rc/plugins.lua#L568
They are using the blank buffers, I'm not sure how I can identify the buffers when I have scratch pads enabled. I tried some things, but couldn't get it to work. It's probably a skill issue though.
You can maybe try to compare the path of the file opened in the buffer? You can get access to it via _G.NoNeckPain.config
and from there you have the path of the opened file in buffers.[left|right].scratchPad.pathToFile
I find a way to remove the prompt when quitting nvim with persisted enabled but it doesn't yet solve the issue of the side buffers :/ i'll keep digging
Closing this for now and please let me know if we do find a solution
Your
minimal.lua
configError messages
No response
Describe the bug
What I expect
After
:q
uitting a file while using:NoNeckPain
to center the code, I expect to get back into the file at the same position where I left off when loading the Session.What happens instead
Persisted.nvim opens the side buffer of NoNeckPain instead of my file. Even though I disable NoNeckPain using the
PersistedSavePre
hook.Reproduce the bug
Steps to reproduce:
nvim
:e some-file.txt
:NoNeckPain
:q
nvim
Final checks
minimal.lua
config file above and still get the issueSessionSave
to save the session before restarting Neovim and usingSessionLoad