diff --git a/README.md b/README.md index fcd3439..88b096b 100644 --- a/README.md +++ b/README.md @@ -355,6 +355,21 @@ vim.api.nvim_create_autocmd("User", { }) ``` +Or, to ensure that certain filetypes are removed from the session before it's saved: + +```lua +vim.api.nvim_create_autocmd("User", { + pattern = "PersistedSavePre", + callback = function() + for _, buf in ipairs(vim.api.nvim_list_bufs()) do + if vim.bo[buf].filetype == "codecompanion" then + vim.api.nvim_buf_delete(buf, { force = true }) + end + end + end, +}) +``` + **Highlights** The plugin also comes with pre-defined highlight groups for the Telescope implementation: diff --git a/doc/persisted.nvim.txt b/doc/persisted.nvim.txt index ad48381..6e69e3a 100644 --- a/doc/persisted.nvim.txt +++ b/doc/persisted.nvim.txt @@ -369,6 +369,22 @@ session, saving the current session before clearing all of the open buffers: }) < +Or, to ensure that certain filetypes are removed from the session before it’s +saved: + +>lua + vim.api.nvim_create_autocmd("User", { + pattern = "PersistedSavePre", + callback = function() + for _, buf in ipairs(vim.api.nvim_list_bufs()) do + if vim.bo[buf].filetype == "codecompanion" then + vim.api.nvim_buf_delete(buf, { force = true }) + end + end + end, + }) +< + **Highlights** The plugin also comes with pre-defined highlight groups for the Telescope