I'm following a series of videos on Youtube on how to develop a dashboard using bootstrap. The developer in that series uses the Sublime Text editor.
I've noticed that sometimes he clicks on multiple places (one after another) then start typing, and whatever he's typing appears on all these places. I think that saves a lot of time.
In VS and SSMS, one can press ALT then select a rectangle that will be modified. But this one is different as you can just select randomly several places, then start typing.
Do we have the same functionality in Visual Studio 2017?
As of the current version, alt+click works!
Select the lines you want and then press: Windows: Shift + Alt + i. Mac: shift + option + i.
What you do put your cursor where you want to add a character on a line, then use SHIFT+ALT and either the arrow keys or your mouse (you have to click to the same column position the line that you are selecting to) to select all the lines that you want to edit the same way.
Here’s a quick tip if you’ve ever wanted to edit multiple lines of code at once in Visual Studio. Simply position your cursor at a point in your code, then press and hold SHIFT and ALT. Next, press the up or down arrow to select the lines you want to edit.
This is very useful to apply the same change to multiple lines. For instance when you want to add the modifier to multiple properties. Press Alt while selecting the block with the mouse: Press Alt+Shift+Arrow to select the block to edit: If you want to edit multiple places that are unaligned, you can use the multi-cursor edit.
As of the current version, alt+click works! You can use Shift + Alt while left clicking, but that will only be good for multiple lines selection The question might be dated but in Visual Studio 2019 while holding down click the lines that you want to change and it works as you wanted. As @besthost and @Noel Nemeth commented, you can use ALT + SHIFT
This approach overwrites the selected block. If you want to edit multiple lines in non aligned blocks you need to press Ctrl+Alt and explicitly click where you want each cursor to be and then just start typing as in example 2 below. With this approach you only add new code not overwrite existing code.
You can use Shift+Alt while left clicking, but that will only be good for multiple lines selection
The question might be dated but in Visual Studio 2019 while holding down
Ctrl + Alt
click the lines that you want to change and it works as you wanted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With