Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to paste corresponding lines in multi-cursor mode in Visual Studio Code? [duplicate]

I have a block of text with multiple lines copied to the clipboard. I have multiple cursors in my editor, added with Ctrl+Click (on Linux). I want to be able to paste each line from the clipboard into a corresponding cursor. Example:

Clipboard:

1
2
3

Cursors:

A|
AB|
ABC|

Desired result:

A1
AB2
ABC3

How would I got about this?

like image 786
Márcio Martins Avatar asked Nov 07 '22 10:11

Márcio Martins


1 Answers

This is a bit late but here's how you can do multiline copy pasting:

  1. Move cursor to bottom right (after 3)
  2. While holding down ⌥ Option + ⇧ Shift keys, drag cursor to top left before 1
  3. Copy lines using ⌘ Command + C
  4. Move cursor to bottom after ABC
  5. While holding down ⌥ Option + ⇧ Shift keys, drag cursor to top left before A like before
  6. Go to end of each line with ⌘ Command + → Left arrow
  7. Paste lines using ⌘ Command + V
    For VScode version 1.36.1

You can also use ⌥ Option + ⇧ Shift + I while your block of text is selected to get a cursor for each line

like image 137
sam-m Avatar answered Nov 17 '22 02:11

sam-m