mirror of
https://github.com/folke/persistence.nvim.git
synced 2025-06-22 00:49:05 +02:00
feat: don't save the session when no files are open (save_empty = false)
This commit is contained in:
parent
4b8051c01f
commit
e9afeaf3a7
3 changed files with 15 additions and 1 deletions
|
@ -34,6 +34,18 @@ function M.start()
|
|||
Config.options.pre_save()
|
||||
end
|
||||
|
||||
if not Config.options.save_empty then
|
||||
local bufs = vim.tbl_filter(function(b)
|
||||
if vim.bo[b].buftype ~= "" then
|
||||
return false
|
||||
end
|
||||
return vim.api.nvim_buf_get_name(b) ~= ""
|
||||
end, vim.api.nvim_list_bufs())
|
||||
if #bufs == 0 then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
M.save()
|
||||
end,
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue