Sample Header Ad - 728x90

XCode : How to use cmd + x to either cut the current line (if no text is selected) or cut the selected text

11 votes
2 answers
4284 views
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 : My Custom Commands Cut Current Line selectLine:, cut: Copy Current Line selectLine:, copy: 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]
Asked by Saurabh Shrivastava (211 rep)
Sep 26, 2018, 08:16 AM
Last activity: Oct 28, 2024, 12:09 PM