Paste a rectangular block in Visual Studio

13,460

Solution 1

If I understand your question correctly, you can hold Shift + Alt to select a block with the keyboard.

Copy the block from within Visual Studio and then use Shift + Alt again to select the column you want to paste it to. You can then paste it. The same as you would in Notepad++.

If you want to use the mouse you only need to hold the Alt key.

Copy multiline block in Visual Studio

Update for VS Code:

In VS Code it seems to require the mouse. Click to the beginning of what you want to copy, press and hold Shift+Alt then click to the end of what you want to copy. Then release the keys and copy. When pasting, do the same for the column you want to insert.

Copy multiline block VS Code

Solution 2

Use the Left Alt key on the keyboard + mouse to select multiple lines. Then, select the paste region in the same manner. And press Ctrl + V.

Solution 3

The pasted area has to have the same rows as the copied area. Not in Notepad++, yes in Visual Studio Code.

In the last one, you must look at the IDE's bottom.

Share:
13,460

Related videos on Youtube

serge
Author by

serge

#asp.net-core #javascript

Updated on September 16, 2022

Comments

  • serge
    serge over 1 year

    Is there a way to paste a rectangular block in Visual Studio (2017, for example)?

    Enter image description here

    The only way I can do it now is paste first the values, and then "surround" the values column with from left and right, like this:

    Enter image description here

  • serge
    serge almost 7 years
    did you try it with my example? afraid will not work
  • serge
    serge almost 7 years
    Genious ! I didn't know the Shift+Alt combination, only Alt + Selection then Ctrl+V doesn't work !
  • Chris Marisic
    Chris Marisic over 5 years
    Something that seems to be very important is that you copy the block of vertical text from inside Visual Studio. Any time i used the block of text coming from Notepad++ it would multiplex the text and change my 10 lines into 100 lines.
  • Chris
    Chris over 4 years
    Broken in 2019 preview. It copies the whole block at each caret.
  • Olivier Jacot-Descombes
    Olivier Jacot-Descombes over 4 years
    @Chris: See Chris Marisic's comment.
  • Allan Ruin
    Allan Ruin about 4 years
    shift+alt conflict with Windows 10's input method shortcut
  • Tomer Shetah
    Tomer Shetah over 3 years
    Hello and welcome to SO! Please take the tour and read How to Answer. Please try to add new information over the existing answers.
  • Peter Mortensen
    Peter Mortensen over 3 years
    Visual Studio Code is not the same as Visual Studio. The question was about Visual Studio, not Visual Studio Code. In fact, Visual Studio Code is quite broken and crippled wrt. block mode compared to most advanced text editors and IDEs (despite the hype for Visual Studio Code).
  • user24601
    user24601 about 3 years
    This does not work at all with VS version 1.5.3.2.
  • Philipp Grathwohl
    Philipp Grathwohl about 3 years
    @user24601 If you mean VS Code then yes. It has a different method for multiline editing. It works for Visual Studio, though.