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


2. Open the following file in a text editor:


3. Add these lines above the last two lines:

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

It should look something like this:

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

This is a convenient reblog from a GitLab Gist

Thanks for reading! Please consider Buying me a Coffee or checking out Colibri!