Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Atom edit multiple highlight select

Tags:

atom-editor

Using multiple-highlight-select I can select a single word and all instances will be highlighted. Is there a way to select a word and edit all instances?

like image 528
SeanPlusPlus Avatar asked Oct 21 '16 20:10

SeanPlusPlus


2 Answers

Instead of boring find-and-replace, you can edit all instances with multi-cursor.

  • Select a word (by double-clicking on it or press CMD + d to select a word under the cursor).
  • Press CTRL+CMD+g to select all occurrences and to create multi-cursor.
  • Type/delete chars — this will affect all occurrences!
  • Press ESC to leave multi-cursor mode.

This works in Atom 1.18.0. On Windows you should use win instead of CMD button.

like image 144
Alexander Svetkin Avatar answered Oct 05 '22 15:10

Alexander Svetkin


You can select several occurrences of the same word using ctrl + d repeatedly, or select all the occurrences by typing alt + F3.

Then just start typing in order to edit all the occurrences at once. (press escape when you are done to return to normal "single" editing)


Otherwise, using ctrl + e when you are on a word will open the find and replace panel for this word.

Then use tab to go into the "replace in current buffer' field, and type your replacement word.

Finally, hit enter to replace the occurrences one by one, or ctrl + enter to replace all.

like image 24
Fab313 Avatar answered Oct 05 '22 13:10

Fab313