- Open with text editor
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/IDETextKeyBindingSet.plist
If you are using multiple versions of Xcode you have to open this file for each of them. Remember to change /Applications/Xcode.app to path where your Xcode is located.
- Add thise lines:
<key>Duplication</key>
<dict>
<key>Duplicate Current Line Up</key>
<string>moveToBeginningOfLine:, deleteToEndOfLine:, yank:, insertNewline:, moveToBeginningOfLine:, yank:, moveUp:, moveToEndOfLine:</string>
<key>Duplicate Current Line Down</key>
<string>moveToBeginningOfLine:, deleteToEndOfLine:, yank:, insertNewline:, moveToBeginningOfLine:, yank:</string>
</dict>-
Open Xcode and
Xcode preferences⌘ Command + , →Key Bindingsand search forduplication -
Click on
Duplicate Current Line Up, add a shortcut for it, eg. (if you want same shortcut as visual studio code) ⌥ Option + ⇧ Shift + ↑ (remove any other bindings for this key) -
Click on
Duplicate Current Line Down, add a shortcut for it, eg. (if you want same shortcut as visual studio code) ⌥ Option + ⇧ Shift + ↓ (remove any other bindings for this key)
Thank you 🫡