Is there a way to select multiple non-adjoining (totally separate) texts in VS? I can do it in MS Word by selecting the texts separately by holding the Ctrl button, like this:
My version is 11.
Edit: I'm not talking about Alt+Select
block selection. Also I would love to see if there exist a technique in Notepad++.
This question is related to
visual-studio
visual-studio-2012
selection
text-editor
multi-select
Update: MixEdit extension now provides this ability.
MultiEdit extension for VS allows for something similar (doesn't support multiple selections as of this writing, just multiple carets)
Head over to Hanselman's for a quick animated gif of this in action: Simultaneous Editing for Visual Studio with the free MultiEdit extension
Just to note,
MixEdit is not completely free.
"This software is currently not licensed to any user and is running in evaluation mode. MIXEDIT may be downloaded and evaluated for free, however a license must be purchased for continued use."
Upon installation and use, a popup redirects to webpage - similar to SublimeText's unlicensed software pop-up message.
From Visual Studio 2017 Version 15.8, Ctrl + Alt + Click is now supposed to be a built-in way to manage multiple carets.
I couldn't find anything built in, which is sad. There is this functionality in CodeRush though.
With Notepad++, this feature comes in built in. Just turn on multi-editing from
Setting > Preferences > Editing > Multi-Editing Settings
But its not as intuitive as MS Word which lets you select two words by double clicking on them (after Ctrl of course).
MixEdit extension for Visual Studio allows you to do multiediting in the way you are describing. It supports multiple carets and multiple selections.
There is supposedly a way to do it now with Ctrl + Alt + Click
but I use this extension because it has a bunch of other nice features that I use: https://marketplace.visualstudio.com/items?itemName=thomaswelen.SelectNextOccurrence
There is a new extension for Visual Studio 2017 called SelectNextOccurrence which is free and open-source.
This extension makes it possible to select next occurrences of a selected text for editing.
Aims to replicate the Ctrl+D command of Sublime Text for faster coding.
Features:
Visual Studio commands:
SelectNextOccurrence.SelectNextOccurrence
is bound to Ctrl+D by default.SelectNextOccurrence.SkipOccurrence
is not bound by default. (Recommended Ctrl+K, Ctrl+D)SelectNextOccurrence.UndoOccurrence
is not bound by default. (Recommended Ctrl+U)SelectNextOccurrence.AddCaretAbove
is not bound by default. (Recommended Ctrl+Alt+Up)SelectNextOccurrence.AddCaretBelow
is not bound by default. (Recommended Ctrl+Alt+Down)https://marketplace.visualstudio.com/items?itemName=thomaswelen.SelectNextOccurrence
Got to this question because I was looking for a way to select multiple words with mouse click on VS Code, which should be achieved by using alt+click
, but this keybinding wasn't working (I think it is something related to my OS, Ubuntu).
For anyone looking for something similar, try changing the key to ctrl+click
.
Go to Selection
> Switch to Ctrl+Click for Multi Cursor
In Visual Studio 2019, you can put your caret on the right place and then press SHIFT ALT and . (dot). This will select the next occurrence.
Now the plugin is Multi Line tricks. The end and start buttons broke the selection.
in visual 2019, Open Options to show all enter image description here
and multi select: keep Ctrl + Alt
then click position you want
or, keep Shift + Alt
then click position to multi select multi line from start to end line clicked
In the Visual Studio Shift+Alt+. / Shift+Alt+,
Shift+Alt+.
- match caret;Shift+Alt+,
- remove previous caret; Same function as on VSCode Ctrl+D
.
Much more setting Tool - Options - Environment - keyboard
. Next in the Show commands containing
enter Edit.
.
Also, can use keyboard schema Visual Studio Code
. Available for Visual Studio 2017
For conclusion, nice link Visual Studio All keyboard shortcuts
Source: Stackoverflow.com