Edit Text in Multiple Places at Once

How to use multiple cursors to code faster in JetBrains IDEs.

Want to edit the same thing, in multiple places, at once?

Multiple carets to the rescue. Click the first occurrence, then invoke "Add Selection for Next Occurrence" ^G (macOS) / Alt+J (Windows/Linux)for each change. Type the replacement. Press when finished.

Or, all at once by invoking "Select All Occurrences" ⌘⌃G (macOS) / Ctrl+Alt+Shift+J ( Windows/Linux). Then, type the replacement as before.

Works in all languages and IDEs. Other tips:

  • To add or remove multiple carets, you can also press and hold the (macOS) / Alt ( Windows/Linux), then click to add a new caret. You can also make a multiple selection by holding Shift+Alt and dragging the caret.
  • To remove all the carets, press (macOS) / Escape (Windows/Linux).

Related Resources

Convert Class to Record
Convert Class to Record
Use inspections to convert classes to Java 16 records.
Evaluate JSON Path Expressions
Evaluate JSON Path Expressions
Use IntelliJ IDEA to check if your JSON Path expression are correct.
Create New Class
Create New Class
Quickly add new classes to your project.