Repository navigation
feat(editor): add vim-style multi-cursor editing - #326
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 currently requires repeated edits or blockwise workarounds when the same text needs to change in several places. This adds a Vim-style multi-cursor workflow for selecting repeated occurrences or aligned positions and editing them as one operation.
What Changed
Ctrl-noccurrence selection with forward/backward navigation, wrapping, skipping, removal, smart-case matching, and stable buffer/window ownership.Ctrl-UpandCtrl-Downvertical cursors with display-column alignment, shorter-line skipping, empty-line handling at column zero, and tab-aware positioning.Tab, Shift-arrow selection,h/l/w/e/0/$motions, anchor inversion witho, andCtrl-nword promotion for vertical cursors.How to Test
foo one foo two foo. Place the cursor on the firstfoo, pressCtrl-ntwice, then typecbar<Esc>. The first two occurrences should becomebar; oneushould restore both edits.Ctrl-Downrepeatedly. Cursors should stay aligned by display column and skip lines that cannot reach it; at column zero, empty lines should receive a cursor.Shift-RightorTabfollowed bye, thencX<Esc>. Every selected range should be replaced. Pressingobefore another motion should extend from the opposite endpoint.y, and paste withporP. Each cursor should receive its corresponding payload in document order. Changing the system clipboard should replace the structured payload rather than replay stale regions.Focused automated coverage:
cargo test --test multi_cursorcargo test editing::multi_selection::tests --libcargo clippy --all-targets --all-features -- -D warnings