Sublime Forum

Duplicate lines a,b as a,a,bb

#1

I know about ctrl-shift-d to duplicate lines. But this accomplishes nothing more than cut/paste. I would like to select the following text:

line one
line two

and have them duplicated as:

line one
line one
line two
line two

I suspect there is a way to do this, but can’t figure it out.

~S

0 Likes

#2

Put your cursor on the first line:

|line one line two
ctrl+alt+down to create another cursor:

|line one |line two
ctrl+shift+D to duplicate:

line one line one line two line two
There is variants to this procedure but the important step is that you need a multi-selection.

0 Likes

#3

Select the two (or possibly more) lines, split this into multiple selections (ctrl+shift+l), press home to get the cursor to the beginning of the line (this is key to getting it to work the way you want it to) and then use ctrl-shift-d to duplicate the lines.

0 Likes

#4

Oops…looks like bizoo beat me to it :smile:

0 Likes

#5

Great thanks. Both worked great. I prefer the ctrl-alt-down, but that is likely because it is similar to Vim’s Ctrl-V.

0 Likes