Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiline column copy paste in VS Code

Is it possible to do pasting in multiline editing (cursor |):

text1 = [|] text2 = [|] text3 = [|] text4 = [|] 

Assuming I have pasted the following lines:

val1 val2 val3 val4 

I would like to have this result:

text1 = [val1] text2 = [val2] text3 = [val3] text4 = [val4] 

What actually happens is that the clipboard content is pasted four times, once for each cursor.

Something like mentioned in this answer, but instead of typing simply pasting: https://stackoverflow.com/a/30039968/1374488

like image 669
lukas_o Avatar asked Apr 25 '18 18:04

lukas_o


People also ask

How do you copy and paste multiple lines in VS code?

“duplicate a line multiple times in vscode” Code Answer'sOn Windows: Shift + Alt + Up/Down. On Mac: Shift + Option + Up/Down. On Ubuntu: Ctrl + Shift + Alt + Up/Down.

How do you insert multiple lines in VS code?

Select the lines you want and then press: Windows: Shift + Alt + i.

How do I paste a column in Visual Studio?

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++.


1 Answers

Use column-edit instead of the multi-line edit mode:

  1. Click the end of the source text.
  2. Shift Alt, click the beginning.
  3. Copy.
  4. Click the end of the destination text.
  5. Shift Alt, click the beginning.
  6. Paste.
like image 155
belwood Avatar answered Sep 18 '22 06:09

belwood