Reputation: 21641
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?
Upvotes: 41
Views: 79015
Reputation: 121
The shortcuts changes over the versions of VisualStudio. If any of answers already provided doesn't work for you, you can always check shortcut in Visual Studio options.
Tools -> Environment -> Keyboard
Upvotes: 1
Reputation: 1178
On mac you can also use cmd
+ d
+ d
after highlighting certain part of code, and then whatever you type will be reflected to rename in multiple places.
Upvotes: 0
Reputation: 705
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.
Upvotes: 38
Reputation: 655
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.
Upvotes: 9
Reputation: 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"
Upvotes: -3
Reputation: 888
You can use Shift+Alt while left clicking, but that will only be good for multiple lines selection
Upvotes: 51
Reputation: 6363
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.
Upvotes: 6
Reputation:
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.
Upvotes: -3