Up until Xcode 8.0, it was possible to customize IDETextKeyBindingSet.plist file. However, now it seems like modifying this file causes Xcode to stop behaving normally (e.g. arr
Confirmed, still working in Xcode 11.2.1 on macOS Catalina 10.15.4
open /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/IDETextKeyBindingSet.plist
Add the following lines into the root dictionary
<key>Sublime Commands</key>
<dict>
<key>Cut Current Line</key>
<string>selectLine:, cut:</string>
<key>Copy Current Line</key>
<string>selectLine:, copy:</string>
<key>Duplicate Current Line</key>
<string>selectLine:, copy:, moveToBeginningOfLine:, paste:, moveToEndOfLine:</string>
</dict>
Key Bindings
settings and assign any shortcut you want to the new three commands. Just search for their key
s.It's a shame that in the 21st century you still have to manually add such basic shortcuts.
The steps have to be repeated after every update of Xcode.
The previous answer left erroneous whitespace when I tried it. This works for me in Xcode 9:
selectLine:, copy:, moveToBeginningOfLine:, paste:, moveToEndOfLine:
The above answer seems to be broken in Xcode 9.
Here is another solution that I have verified does work in Xcode 9 GM:
<key>Custom Commands</key>
<dict>
<key>Duplicate Current Line</key>
<string>moveToBeginningOfLine:, deleteToEndOfLine:, yank:, insertNewline:, moveToBeginningOfLine:, yank:</string>
</dict>