Alan Coromano
Alan Coromano

Reputation: 26008

Copy-paste in IntelliJ Idea 12. What can be easier? But

It turns out that for a such simple action as copy-paste I have to try very hard in IntelliJ Idea 12. I need to copy-paste many lines. I have tried many to do it by numerous ways and failed.

Other IDEs allow to do it very simply, but here it selects the area not the line(s). I even failed to paste the text because it pasted somewhat weirdly.

How can I do it exactly: copy line by line and paste?

Upvotes: 2

Views: 1474

Answers (2)

CrazyCoder
CrazyCoder

Reputation: 401975

To select multiple lines:

  1. Ensure the caret is on the first column by pressing Home (twice if there is any indent).
  2. Use Shift+UP and Shift+DOWN to select multiple lines.
  3. Copy/Paste where needed. Reformatting on paste can be adjusted.

Be aware of the Expand Selection feature (Ctrl+W) that makes it easier to select code basing on context, press it several times to expand selection.

Another way:

  1. Ensure the caret is on the first column by pressing Home (twice if there is any indent).
  2. Use Shift+END to select till the end of line, continue to hold Shift.
  3. Press DOWN or UP. If the line it longer than the first selected, it will be selected partially. Press END again while still holding Shift, IDE will now select full lines.
  4. Continue pressing DOWN or UP while holding Shift to expand selection on more lines.

Upvotes: 2

Dan Hulme
Dan Hulme

Reputation: 15280

From your description, it sounds like you've turned on column selection mode. From the IntelliJ IDEA help:

To toggle between the line and the column selection modes, do one of the following

  • On the main menu, choose Edit | Column Selection Mode.
  • On the context menu of the editor, choose Column Selection Mode.
  • Press Command Shift Multiply.
  • Keeping the middle mouse button pressed, drag the mouse.

Upvotes: 2

Related Questions