Skip to content

Instantly share code, notes, and snippets.

@nikndr
Forked from emotality/duplicate_line_xcode.md
Last active September 17, 2021 09:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikndr/019e73537088b0c2551bd550f385c4bb to your computer and use it in GitHub Desktop.
Save nikndr/019e73537088b0c2551bd550f385c4bb to your computer and use it in GitHub Desktop.
Xcode - Duplicate Line key binding

Xcode line duplicate

Bind keys to duplicate lines in Xcode

  1. Run command in terminal
code /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/IDETextKeyBindingSet.plist

For Beta releases:

code /Applications/Xcode-beta.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/IDETextKeyBindingSet.plist
  1. Add this in:
<key>Duplication</key>
<dict>
    <key>Duplicate Lines</key>
    <string>selectParagraph:, delete:, undo:, moveRight:, yankAndSelect:, moveRight:, moveLeft:</string>
</dict>
  1. Open Xcode and go to Xcode preferences -> Key Bindings -> Text tab -> Scroll till you see Duplication

  2. Click on Duplicate Current Line, add a shortcut for it, eg. + D (remove any other bindings for this key)

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