- Run command in terminal
code /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/IDETextKeyBindingSet.plistFor Beta releases:
code /Applications/Xcode-beta.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/IDETextKeyBindingSet.plist- Add this in:
<key>Duplication</key>
<dict>
<key>Duplicate Lines</key>
<string>selectParagraph:, delete:, undo:, moveRight:, yankAndSelect:, moveRight:, moveLeft:</string>
</dict>-
Open Xcode and go to
Xcode preferences->Key Bindings->Texttab -> Scroll till you seeDuplication -
Click on
Duplicate Current Line, add a shortcut for it, eg. ⌘ + D (remove any other bindings for this key)