Closed dirn closed 11 months ago
This is possible to do with autocmd's. I've setup the following in my config. I'm using LazyVim, but ultimately that doesn't really matter too much; the config is the same I think:
local function augroup(name)
return vim.api.nvim_create_augroup("rwjblue_" .. name, { clear = true })
end
vim.api.nvim_create_autocmd("FileType", {
group = augroup("disable_session_persistence"),
pattern = { "gitcommit" },
callback = function()
require("persistence").stop()
end,
})
I recently started trying out persistence.nvim after many years of using ProSession. So far everything works great. I noticed once difference, though, that caught me by surprise. When I'm working with Git and close Neovim, e.g., after writing a commit message or performing an interactive rebase, the next time I call
require("persistence").load()
from the same directory, instead of my previous session, I'm greeted by whatever Git opened in Neovim, e.g., the commit message or rebase todo.Is there a way to tell persistence.nvim not to automatically save the session when Neovim is opened by Git?