Edit Text in Multiple Places at Once

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

00:00
00:00

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 JSON to classes or records
Convert JSON to classes or records
Turn any JSON data you have into a class or record
Inlay Hints
Inlay Hints
Inlay hints provide additional information about your code.