24

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?

einpoklum
  • 86,754
  • 39
  • 223
  • 453
Richard77
  • 17,505
  • 36
  • 124
  • 222

7 Answers7

27

You can use Shift+Alt while left clicking, but that will only be good for multiple lines selection

Noel Nemeth
  • 578
  • 5
  • 21
besthost
  • 533
  • 7
  • 10
21

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.

iCould7
  • 525
  • 4
  • 10
6

You can do this in Visual Studio Code, since it is based on Atom. In VS2017, I believe you can only do Select+ALT block editing. I would expect to see features from Code/Atom continue to migrate to VS in the future.

Adam Erickson
  • 4,729
  • 1
  • 32
  • 31
5

As @besthost and @Noel Nemeth commented, you can use ALT + SHIFT

Another option is keeping ALT pressed and select the lines you want with mouse.

GreatNews
  • 165
  • 1
  • 9
0

As far as I'm aware you can't. I wanted to find out the same thing a while ago and from what I read online, you can't with Visual Studio. You'll need a plugin that adds extra functionality.

To do this in Sublime Text, you need to press Ctrl (Windows) or Cmd (Mac) and click to select multiple lines or columns.

0

For Visual Studio Code just hold alt and you can select.

-1

In Version 1.26.1 (1.26.1) of Visual Studio code you can edit multiple lines:

var donut 1 = "glazed"; 
var donut 2 = "chocolate frosted"; 
var donut 3 = "cinnamon";

go to each location (ie to the right side of the last character ) and hit "Alt" + "spacebar" . It will insert a " | ". When all the lines have a | (the character above the backslash) inserted then the cursor > will is controlling all these lines.

////////////// Example One ///////////////////////////

If we type a , the , will be inserted on all the lines simultaneously.

var donut 1 = "glazed";| 
var donut 2 = "chocolate frosted";|
var donut 3 = "cinnamon";|

////////////// Example Two ///////////////////////////

lines. If we hit the backspace key, all three lines will have characters > to the right side of the " | " will be deleted on all the lines simultaneously.

var donut 1 = |"glazed"; 
var donut 2 = |"chocolate frosted";
var donut 3 = |"cinnamon";

To insert the | character in the line, position the cursor and hit "Alt" + "spacebar"

  • 5
    Thanks, that's interesting. The question was about Visual Studio though, not about Visual Studio Code. https://stackoverflow.com/a/33798601/5629418 – Roland Weber Aug 29 '18 at 05:35