Skip to content

fix(commands): allow bufdo to delete buffers - #316

Merged
fcoury-oai merged 1 commit into
mainfrom
fcoury/bufdo-delete
Aug 22, 2026
Merged

fix(commands): allow bufdo to delete buffers#316
fcoury-oai merged 1 commit into
mainfrom
fcoury/bufdo-delete

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

PR #311 added :bufdo, but deleting buffers remained outside its supported command subset. As a result, the common Vim workflow :bufdo bd reported an unsupported-command error even though traversal already snapshots stable buffer IDs.

Allow DeleteBuffer during :bufdo traversal. Each snapshotted buffer is deleted once, and the replacement blank buffer created after deleting the final target is not revisited. An unforced :bufdo bd stops at the first dirty buffer and preserves the existing unsaved-change error; :bufdo bd! discards dirty buffers and continues.

The command architecture notes now document deletion semantics, and focused integration coverage exercises clean traversal, stop-on-dirty behavior, and forced deletion.

How to Test

  1. Open several clean buffers and run :bufdo bd. Confirm every original buffer is deleted and Red leaves one fresh [No Name] buffer.
  2. Open several buffers, modify one without saving, and run :bufdo bd. Confirm traversal stops on the dirty buffer with No write since last change (add ! to override) and does not delete later buffers.
  3. Run :bufdo bd!. Confirm the remaining buffers are deleted and Red leaves one fresh [No Name] buffer.
  4. Run cargo test --test editing bufdo_. All five focused bufdo integration tests should pass, including bufdo_deletes_each_snapshotted_buffer_and_leaves_a_blank_buffer and bufdo_delete_stops_at_a_dirty_buffer_unless_forced.

@fcoury-oai
fcoury-oai merged commit 4dc4054 into main Aug 22, 2026
10 checks passed
@fcoury-oai
fcoury-oai deleted the fcoury/bufdo-delete branch August 22, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant