- Open below directory in Finder with Cmnd + Shift + G
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/
-
Open
IDETextKeyBindingSet.plist
with a text editor. -
Add this in:
<key>Duplication</key>
<dict>
<key>Duplicate Current Line</key>
<string>moveToBeginningOfLine:, deleteToEndOfLine:, yank:, insertNewline:, moveToBeginningOfLine:, yank:</string>
<key>Duplicate Lines</key>
<string>selectLine:, copy:, moveToEndOfLine:, insertNewline:, paste:, deleteBackward:</string>
<key>Delete Line</key>
<string>selectLine:, deleteBackward:</string>
</dict>
-
Open Xcode and go to
Xcode preferences
->Key Bindings
->Text
tab -> Scroll till you seeDuplication
-
Click on
Duplicate Current Line
, add a shortcut for it, eg. Cmnd + D (remove any other bindings for this key)