Multiple cursors / highlight next instance of currently highlighted word

前端 未结 7 1566
长情又很酷
长情又很酷 2020-12-12 14:41

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

相关标签:
7条回答
  • 2020-12-12 15:11

    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!

    0 讨论(0)
  • 2020-12-12 15:12

    Apple just released Xcode 10 beta with the following feature:

    The Xcode Source Editor now supports multi-cursor editing allowing you to quickly edit multiple ranges of code at once. You can place additional cursors with the mouse via ⌃+⇧+Click or with column select (⌥+Click+Drag), or with the keyboard using ⌃+⇧+Up to column select up or ⌃+⇧+Down to column select down. (12564506)

    0 讨论(0)
  • 2020-12-12 15:15

    There's the Xcode-Multi-Edit-Plugin. It's still not quite like Sublime because the multiple cursors can't be used to edit beyond the selection you made when you started command-d-ing but it's close enough.

    The plugin is not updated for Xcode 7.3 but this can be easily fixed by adding

        <string>ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C</string>
    

    to the list of similar UUIDs in <key>DVTPlugInCompatibilityUUIDs</key> in the plugin's Info.plist. (Found at ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/XcodeMultiEdit.xcplugin/Contents/Info.plist)

    Another promising plug-in which currently lacks Xcode 7.3 support is Multiplex.

    0 讨论(0)
  • 2020-12-12 15:16

    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

    0 讨论(0)
  • 2020-12-12 15:17

    I just read on twitter that Xcode team has added multiple cursors feature for testing, but kept it hidden.To enable it use following command.

    defaults write com.apple.dt.Xcode PegasusMultipleCursorsEnabled -bool true

    Link for your reference. Multiple Cursor in Xcode

    0 讨论(0)
  • 2020-12-12 15:29

    You can create cursors with Shift + Ctrl + Mouse Click wherever you need more cursor

    You can either use Shift + Ctrl + (or ) if you want to create a new cursor on the following line.

    Option + Mouse Drag also works very well

    0 讨论(0)
提交回复
热议问题