feat: add cleanup_buffers_on_delete option

Problem: When files are deleted via canola, any open Neovim buffers
for those files remain alive, polluting the jumplist with stale
entries.

Solution: Add an opt-in `cleanup_buffers_on_delete` config option
(default `false`). When enabled, `finish()` in `mutator/init.lua`
iterates completed delete actions and wipes matching buffers via
`nvim_buf_delete` before `CanolaActionsPost` fires. Only local
filesystem deletes are handled (guarded by the `files` adapter
check).
This commit is contained in:
Barrett Ruth 2026-03-06 15:16:25 -05:00
parent 69d85b8de1
commit 047338a6dd
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
5 changed files with 176 additions and 108 deletions

View file

@ -311,6 +311,12 @@ prompt_save_on_select_new_entry *canola.prompt_save_on_select_new_e
When this option is `true`, Canola will prompt you to save before entering a file or
directory that is pending within canola, but does not exist on disk.
cleanup_buffers_on_delete *canola.cleanup_buffers_on_delete*
type: `boolean` default: `false`
When `true`, canola will wipe any open buffer whose path matches a file that
was successfully deleted via canola. This prevents stale buffers from
appearing in the jumplist after a deletion.
--------------------------------------------------------------------------------
API *canola-api*