Reputation: 25994
In VSCode working in a file, and you need to change multiple variable etc.
When selecting all occurrences in a file, I often find that I need to de-select one or more, can you do that?
Upvotes: 3
Views: 3835
Reputation: 321
On Mac, to de-select one or more substrings selected with Cmd + D, type Cmd + U.
Analogously, type Ctrl + U on Windows/Linux.
Found on https://www.reddit.com/r/vscode/comments/8gx98z/how_cancel_last_ctrld_selection/
Upvotes: 7
Reputation: 182949
You can use your multi-cursor add command to also de-select specific cursors. So if you have this setting:
Editor: Multi Cursor Modifier
The modifier to be used to add multiple cursors with the mouse. The Go To Definition and Open Link mouse gestures will adapt such that they do not conflict with the multicursor modifier. Read more.
set to alt
(the default) then you can alt+left-mouse-click
them in any order to deselect them. Or same with Ctrl/Cmd
if that is your setting option.
If you use the find widget to find all your occurrences (select a word and Ctrl+F) then alt+enter will select them all from the start. Then you can deselect any of them with the alt+left-mouse-click
thing. and then if you want them all reselected for any reason alt+enter will do that.
See demo for both methods (right-click vs find widget).
Upvotes: 2
Reputation: 2515
Assuming you use Ctrl+D
to select multiple variables, press K
while still holding Ctrl
to skip/exclude the current selection.
Upvotes: 3