persisted.nvim
persisted.nvim copied to clipboard
[Bug]: no-neck-pain.nvim `disable` doesn't work in `SavePre` hook
Your minimal.lua
config
local root = "/tmp/persisted"
-- Set stdpaths to use root dir
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- Bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
vim.opt.sessionoptions = "buffers,curdir,folds,globals,tabpages,winpos,winsize" -- Session options to store in the session
-- Install plugins
local plugins = {
{
"olimorris/persisted.nvim",
opts = {
autoload = true,
},
},
{
"shortcuts/no-neck-pain.nvim",
opts = {
buffers = {
scratchPad = {
enabled = true,
location = "/tmp/",
},
bo = {
filetype = "md",
},
},
},
},
-- Put any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
local persisted_hooks = vim.api.nvim_create_augroup("PersistedHooks", {})
vim.api.nvim_create_autocmd({ "User" }, {
pattern = "PersistedSavePre",
group = persisted_hooks,
callback = function()
require("no-neck-pain").disable()
end,
})
Error 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
- [X] I have made sure this issue exists in the latest version of the plugin
- [X] I have tested with the
minimal.lua
config file above and still get the issue - [X] I have used
SessionSave
to save the session before restarting Neovim and usingSessionLoad
- [X] I have made sure this is not a duplicate issue