feat: add cleanup_buffers_on_delete option (#73)

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:19:32 -05:00 committed by GitHub
parent 69d85b8de1
commit 1ee6c6b259
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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*