mirror of
https://github.com/folke/persistence.nvim.git
synced 2025-07-02 21:44:42 +02:00
fix: dont throw error when session was already stopped
This commit is contained in:
parent
7421e30704
commit
70c281e54e
3 changed files with 10 additions and 11 deletions
|
@ -27,19 +27,16 @@ function M.setup(opts)
|
|||
end
|
||||
|
||||
function M.start()
|
||||
vim.cmd([[
|
||||
augroup Persistence
|
||||
autocmd!
|
||||
autocmd VimLeavePre * lua require("persistence").save()
|
||||
augroup end
|
||||
]])
|
||||
vim.api.nvim_create_autocmd("VimLeavePre", {
|
||||
group = vim.api.nvim_create_augroup("persistence", { clear = true }),
|
||||
callback = function()
|
||||
M.save()
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
function M.stop()
|
||||
vim.cmd([[
|
||||
autocmd! Persistence
|
||||
augroup! Persistence
|
||||
]])
|
||||
pcall(vim.api.nvim_del_augroup_by_name, "persistence")
|
||||
end
|
||||
|
||||
function M.save()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue