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

Inlay Hints
Inlay Hints
Inlay hints provide additional information about your code.
Go to Next Error
Go to Next Error
Quickly move to the next (or previous) error or warning in the file.
Find Next Word
Find Next Word
Find next word and highlight all instances.