Skip to content

Instantly share code, notes, and snippets.

@danielrotaermel
Last active July 2, 2020 14:42
Show Gist options
  • Save danielrotaermel/1b54903d84dbb3418019d731b0d31174 to your computer and use it in GitHub Desktop.
Save danielrotaermel/1b54903d84dbb3418019d731b0d31174 to your computer and use it in GitHub Desktop.

XCode Duplicate Line Shortcuts

Key Bindings to duplicate lines in Xcode similar to VSCode

HINT: these don't mess with the clipboard or the undo history

  • Copy the following snippet into

    /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/IDETextKeyBindingSet.plist
    
    <key>Custom</key>
    <dict>
        <key>Duplicate Current Line Down</key>
        <string>selectParagraph:, delete:, undo:, moveRight:, yank:, moveLeft:</string>
        <key>Duplicate Current Line Up</key>
        <string>selectParagraph:, delete:, undo:, moveLeft:, yank:, moveLeft:</string>
    </dict>
    
  • Assign shortcuts in Xcode -> Preferences -> Key Bindings

    Duplicate Current Line Down –> shift + alt +

    Duplicate Current Line Up –> shift + alt +

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment