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

Clean Up Messy Imports With Optimize Imports
Clean Up Messy Imports With Optimize Imports
Quickly remove any unused imports and more.
Generate documentation with AI
Generate documentation with AI
AI can help you make XML documentation both automatic and useful.
Add console.log Faster
Add console.log Faster
Use Postfix Completion to quickly add console.log.