IntelliJ IDEA way of editing multiple lines IntelliJ IDEA way of editing multiple lines java java

IntelliJ IDEA way of editing multiple lines


Since Idea IntelliJ IDEA 13.1 there is possibility to edit multiple lines.

Use:

Alt + Shift + Mouse click

for selection. More about this new improvement in IntelliJ blogpost here. Very useful feature.


I use Column Selection Mode (Cmd+Shift+8 on Mac) which allows to create multiple cursors via Shift+Up or Shift+Down then edit all the lines together.

Starting from IntelliJ IDEA 14 there is also Clone Caret Above / Below:

  • Windows: Ctrl, Ctrl+Up/Down
  • MacOS: Option,Option + Up/Down

(hold the second press of the modifier key, then press the arrow key)


Another keyboard-only approach. It's possible (since 13.1 version) to use Alt+J / Shift+Alt+J (Ctrl+G for OS X) shortcuts for creating multiple carets. Alt+J selects the next occurrence of the currently selected text and adds another caret.

  1. Select the first semicolon

enter image description here

  1. Then press Alt+J four times

enter image description here

  1. Edit what you want to

enter image description here

  1. Press Esc to return to the first line.

enter image description here