Chris G.
Chris G.

Reputation: 25994

vscode deselect one from "change all occurrences"

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

Answers (3)

merowinger
merowinger

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

Mark
Mark

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).

demo of deslecting selections

Upvotes: 2

John Archer
John Archer

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

Related Questions