antoprd
antoprd

Reputation: 403

Xcode 12.4 - How to duplicate a line using a shortcut

I am trying to figure out how to use a shortcut to duplicate a line of code in Xcode version 12.4 (Especially in the .swift files, the current duplicate "cmd + D" shortcut works only for UIBuilder).

I saw a lot of documentation on the internet but nothing referring to newest versions of Xcode. Has anybody tried to solve this problem?

Upvotes: 0

Views: 1999

Answers (2)

farkasseb
farkasseb

Reputation: 610

Your question was specifically for Xcode 12.4, but in Xcode 14.3 (14E222b) a simple Cmd + D works fine for duplicating lines.

Upvotes: 4

Viktor Golubenkov
Viktor Golubenkov

Reputation: 143

It works for me: open IDETextKeyBindingSet.plist in /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/ Add new -> Dictionary -> Add new Item inside -> new Item set String selectLine:, copy:, moveToEndOfLine:, insertNewline:, paste:, deleteBackward: Like this:enter image description here

Then assign a key in Xcode -> Preferences -> Key Bindings enter image description here

Upvotes: 5

Related Questions