11

How can I achieve multi-line editing in Visual Studio? For example in Sublime Text I could make it by CTRL + Mouse left button.

2

8 Answers 8

15

I'm fairly certain you are wanting to click in multiple places in the code, say you have a few lines you copy and pasted over that have the same word that you want to change (without having to do a Find/Replace)

ALT + CTRL + Left Mouse Click in the locations you want to edit, then just start typing.

10

ALT+Shift + Down Arrow will do the trick from the keyboard

3
  • This is the real answer to the question. Commented Aug 21, 2020 at 17:24
  • Can you update the answer to say what keyboard binding you have alt+shift+down arrow set to as I've lost the ability and I can't seem to find the binding that I need to set.. @JasonShave - perhaps you know the answer to my question? Commented Nov 10, 2021 at 19:21
  • In Visual Studio if you click Tools, Options, then search for 'keyboard'. In the "Show commands containing" search box, type "Edit.LineUp" and you should see "Edit.LineUpExtendColumn". This might be the one as it maps to Shift+Alt+Up Arrow and there is one for down arrow too. Commented Nov 11, 2021 at 20:59
6

You can use ALT + LEFT MOUSE BUTTON and mark the lines you want to write to.

I hope that helps.

3
  • 2
    Unfortunately it doesn't work.(Windows 10 here if it matters). Commented May 5, 2018 at 23:32
  • What do you mean? Is there just nothing happening in Visual Studio?
    – Kirdus
    Commented May 5, 2018 at 23:37
  • 2
    Nothing happens.Marks only one line of code. When I use ALT + Shift and Arrow Keys, it marks all lines of code. Commented May 5, 2018 at 23:46
4

You can use Alt + Shift shortcut.

First press Alt + Shift then click mouse button on the first line.

Go to the last line then do the same.

This will mark all the part of one side. what ever you type will be reflected the marked spaces.

Do the same in the other side too.

1

Multi Edit Mode extension lets you simultaneously edit in more than one location in the VS editor. ALT+Click on different locations in your code to set multiple carets, and then type as you normally would.

1

Let's use Shift+Alt+ or buttons in any Source Window.

Unfortunately, but Visual Studio's multi-line editing is not as intellectually developed as in Sublime Text 3.

0

You can do ALT + UP/DOWN arrow keys to select the lines you want to write on. Then, they'll all be edited at the same time. Hope that helped!

0

If you are looking for the Sublime Text 3/VS Code style editing, there's Select Next Occurrence, which supports the entire feature set.

Since e.g. Ctrl+D is bound to Debug windows in VS, you may need to set the shortcuts manually.

Not the answer you're looking for? Browse other questions tagged or ask your own question.