Xcode Duplicate Current Line Keyboard Shortcut

This is something that should have been implemented ages ago – but for some reason, it’s still not present by default.

1. Navigate to the following folder using Finder (CMD + Shift + G):

/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/

2. Open the following file in a text editor:

IDETextKeyBindingSet.plist

3. Add these lines above the last two lines:

<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>

It should look something like this:

Insert the code just above the last </dict> tag

This is a convenient reblog from a GitLab Gist