Question

I need a capability to copy multi-lines and paste it into multiple cursors in sublime text 2.(on Mac OS X)

Here's my original text.

level1:
  default: Level 1
  short: Lvl 1
level2:
  default: Level 2
  short: Lvl 2
level3:


level4:


level5:

Basically, I just want to copy 'default' and 'short' under level1 into level3 and level4 each. The expected result should be as follows:

level1:
  default: Level 1
  short: Lvl 1
level2:
  default: Level 2
  short: Lvl 2
level3:
  default: Level 1
  short: Lvl 1    
level4:
  default: Level 1
  short: Lvl 1
level5:

However, it doesn't seem to work the way I want as I copy lines of level1's default and short, then place multiple cursors under level3 and level4 (cmd + left-mouse click for each), and then paste them using cmd+v.

What it does instead?, it's only copying each line into each cursor as below, which is not what I want.

level1:
  default: Level 1
  short: Lvl 1
level2:
  default: Level 2
  short: Lvl 2
level3:
  default: Level 1

level4:
  short: Lvl 1

level5:

Any advice on how to achieve the copy-paste result that I want?

Was it helpful?

Solution

At first, copy the wanted lines.

enter image description here

Extend the file by two newlines at the end. Then, select the ":" after level3 and press CMD+d a few times to select the following colons.

First Step

Next, press the down arrow one time, then hold shift and press the down arrow again.

enter image description here

Paste.

enter image description here

OTHER TIPS

I also see this issue. What I observed was:

  • Only when the lines you copied equal to the number of selections, you will see one line pasted at each selection point. Otherwise, the behavior is correct, all lines pasted at each of selection.

And someone else also reported this issue at Sublime Text forum here. Then someone else developed a plugin to resolve this issue. See https://github.com/adzenith/CopyEdit

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top