Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple cursors / highlight next instance of currently highlighted word

In Sublime Text, it's easy to select the next instance of a word by pressing command + d and also place multiple cursors by pressing command & clicking. I know I'm not alone in saying this is an incredibly useful function in editors.

I haven't had any luck in finding any key mappings or Alcatraz plugins for this, so I was interested to see if either there is a way to do this in xcode 5 which I might have missed or if there are plans to implement this in xcode 6?

If there isn't, and any xcode developers see this, would love to see this as a feature and hear your opinions on it :)

like image 432
Matt Rowles Avatar asked Jul 22 '14 08:07

Matt Rowles


People also ask

How to make multiple cursors in WebStorm?

Use multiple cursors to make changes to your code faster. Multi-cursor selection in WebStorm: Select next occurrence of the current word or selection: Ctrl+G on macOS and Alt+J on Windows and Linux. Select all occurrences: Ctrl+Cmd+G / Shift+Ctrl+Alt+J.

How do I select multiple words in Xcode?

Hold down the Shift and Control keys, and press the Right-Arrow key. Now both instances of top are selected!


2 Answers

It is possible starting from Xcode 10 Beta 3

You can add selections for the next and previous find results using the “Find and Select Next” and “Find and Select Previous” menu commands.

Additionally, you can quickly add selections for the next and previous occurrences of the current selected text using the “Select Next Occurrence” and “Select Previous Occurrence” menu commands.

E to select next occurence of currently selected

E to select previous occurence of currently selected

G to find and select next

G to find and select previous

You can also use the Find menu to find these actions. Of course, feel free to bind it to different hotkeys!

like image 75
Infinity Avatar answered Sep 18 '22 10:09

Infinity


If what you're wanting to do is change the name of a variable, then when your cursor is on the variable press control+command+E and type away. (This is "Edit All in scope")

For editing on a Project scope there is always the Editor > Refactor > Rename menu item

like image 39
Max Chuquimia Avatar answered Sep 21 '22 10:09

Max Chuquimia