- Run
sudo chmod 666 /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources//IDETextKeyBindingSet.plist
sudo chmod 777 /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/
- Open below directory in Finder with
Cmnd
+Shift
+G
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/
-
Open
IDETextKeyBindingSet.plist
file in text editor -
Append
<key>Custom</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>
- Restart Xcode
- Go to Preferences - Key Bindings, search for the command we typed (Duplicate Lines & Duplicate Current Line, Delete Line).
- Set desired key binding
Taken from: https://stackoverflow.com/a/34195483/5969121
https://stackoverflow.com/a/41121405/5969121