- 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>User</key>
<dict>
<key>Duplicate Current Lines Down</key>
<string>selectParagraph:, delete:, yank:, moveToBeginningOfParagraph:, yank:, moveUp:, moveToEndOfParagraph:</string>
<key>Delete Current Line</key>
<string>deleteToBeginningOfLine:, moveToEndOfLine:, deleteToBeginningOfLine:, deleteBackward:, moveDown:, moveToBeginningOfLine:</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.Cmd + D
(remove any other bindings for this key)