fix(commands): allow bufdo to delete buffers - #316
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR #311 added
:bufdo, but deleting buffers remained outside its supported command subset. As a result, the common Vim workflow:bufdo bdreported an unsupported-command error even though traversal already snapshots stable buffer IDs.Allow
DeleteBufferduring:bufdotraversal. Each snapshotted buffer is deleted once, and the replacement blank buffer created after deleting the final target is not revisited. An unforced:bufdo bdstops 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
:bufdo bd. Confirm every original buffer is deleted and Red leaves one fresh[No Name]buffer.:bufdo bd. Confirm traversal stops on the dirty buffer withNo write since last change (add ! to override)and does not delete later buffers.:bufdo bd!. Confirm the remaining buffers are deleted and Red leaves one fresh[No Name]buffer.cargo test --test editing bufdo_. All five focusedbufdointegration tests should pass, includingbufdo_deletes_each_snapshotted_buffer_and_leaves_a_blank_bufferandbufdo_delete_stops_at_a_dirty_buffer_unless_forced.