feat: Toggle movement of all selections versus only the primary selection #13833
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.
Hi everyone!
This is my stab at a minimal PR building off of the discussion in #10457.
Here's a short showcase of the proposed improvement:
rec2.mov
Motivation
While performing search-and-replace in some large files I've also found myself wanting to change the primary selection without touching the rest. For me this 'completes' the mental model of multiple selections. With this it should be possible to create arbitrary selections and (in my opinion) there is motivation for adding this in everyday usage.
As a nice aside (although I know this isn't that relevant) other editors fall short here. For example in
(n)vim
while performing search and replace there is no option to modify just one of the selections. Kakoune also does not offer this option to the best of my knowledge and it is instead a plugin: phantom-selection.Example
rec1.mov
Edge cases
Optional additions
The branch also has two commits marked as 'optional', I really wanted to avoid bikeshedding about this so its the: Keymapping of toggling this mode, and the theme parameter for the 'primary' text. It should be easy to cherry pick the comments which are wanted in the merge.
ui.statusline.selections.primary-only
to describe the styling of the text.