Pressing cmd + x
without selecting text in other IDEs, cuts the complete line. Same goes for cmd + c
which copies, instead of cutting. Otherwise, if some text is selected, only that region is cut.
How do I do this in XCode?
I added the following in the IDETextKeyBindingSet.plist
to add cutting line and copying line functionality :
<key>My Custom Commands</key>
<dict>
<key>Cut Current Line</key>
<string>selectLine:, cut:</string>
<key>Copy Current Line</key>
<string>selectLine:, copy:</string>
</dict>
But obviously binding these to cmd + x
(or c) doesn't allow cutting/copying selected region. I understand I can set it to some other keybinding. But, as a force of habit, cmd + x
(or c) suits better.
Is there any way to do this? Maybe an extension?
[PS I asked the same question on StackOverflow, but realised, this is more apt place]
Best Answer
That is correct. (Xcode 10)
IDETextKeyBindingSet.plist
fileIDETextKeyBindingSet.plist
Example:
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/IDETextKeyBindingSet.plist
Xcode keybinding (Cut and Copy):
Xcode conflict resolve (Cut and Copy):