Loading...

How to enable multi-line cursor editing in Xcode?

question xcode
Ram Patra Published on November 17, 2023

In Xcode, you can enable multi-line cursor editing, which allows you to type or edit text at multiple locations simultaneously. This can be incredibly useful for making the same edit on several lines at once. Here’s how you can do it:

  1. Using the Keyboard Shortcut:
    • Hold down the Option key and drag your cursor vertically. This will create cursors at multiple lines.
    • You can then start typing, and the text will be inserted at all cursor positions.
  2. Adding Cursors with the Mouse:
    • You can also add additional cursors at specific points by holding Shift + Control and then clicking at each point where you want a cursor.
    • This method is useful if the lines you want to edit are not directly above or below each other.
  3. Selecting Similar Text:
    • Select a piece of text.
    • Then use Editor -> Find -> Select Next Occurrence (or the corresponding keyboard shortcut, which is usually Control + Command + E).
    • This will add another cursor at the next occurrence of the selected text, allowing you to edit all instances simultaneously.
  4. Removing a Cursor:
    • If you have multiple cursors and want to remove one, just click at the location of the cursor you wish to remove.

Multi-line cursor editing is a powerful feature in Xcode that can save a lot of time and effort when you need to make the same change on multiple lines of code. However, be mindful when using it, as it’s easy to inadvertently make changes you didn’t intend.

Presentify

Take your presentation to the next level.

FaceScreen

Put your face and name on your screen.

ToDoBar

Your to-dos on your menu bar.

Ram Patra Published on November 17, 2023
Image placeholder

Keep reading

If this article was helpful, others might be too

question xcode sf symbol October 15, 2023 SF Symbol for the new X Social Network (previously Twitter)

I was looking for the SF Symbol for the latest Twitter icon, yes the X icon, but I couldn’t find any online. So, I created one here: https://github.com/rampatra/assets/blob/main/SFSymbols/X%20Social%20Network.svg. This works with the latest SF Symbol 5 so you can either import it to your SF Symbols app or use it directly in your Xcode by creating a new Symbol Image Set like shown below.

question apple app development August 11, 2022 How to notarize a dmg or zip file with the help of Xcode's Notary Tool?

With Xcode 13 and later, notarization via command-line has come down to these 2 basically:

question xcode apple October 1, 2024 xcrun: error: unable to find utility simctl, not a developer tool or in PATH

The error message you’re encountering indicates that the simctl utility is not recognized, which usually means that your command line tools are not properly configured or that the path to Xcode’s command line tools is not set correctly. Here are steps to resolve this issue: