Repository navigation
feat(commands): add bufdo support - #311
Merged
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.
Red can navigate and edit multiple open buffers, but it lacks Vim's
:bufdoworkflow for applying one Ex command across them. That makes project-wide buffer edits repetitive and prevents familiar stop-on-error behavior.This adds
:[buffer-id-range]bufd[o][!] {command}with a stable snapshot of open buffer IDs. The command visits matching buffers in ID order, reparses the nested command for each buffer, stops on the first error, and leaves the last or failing buffer active. Nested completion works for command names and arguments, and substitute commands accepteto continue past missing matches.Traversal is intentionally limited to non-interactive built-ins that do not restructure buffers or windows. Modal UI, plugin commands, recursive
:bufdo, and|command chains are rejected before execution.How to Test
CARGO_TARGET_DIR=/private/tmp/red-bufdo-target cargo test --test editing bufdo. The three focused tests should pass, covering full traversal, stable-ID ranges, stop-on-error behavior, the substituteeflag, and unsupported nested commands.foo, run:bufdo %s/foo/bar/g, and confirm every buffer is updated and the final buffer remains active.e, traversal should stop on that buffer and leave later buffers unchanged; with:bufdo %s/foo/bar/ge, traversal should continue through the final buffer.