Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode: How to join two lines?

Tags:

xcode

Say I have this:

CGColorSpaceRef space = 
CGColorGetColorSpace(col.CGColor);

Is there a hotkey in XCode that lets me join these two lines together into:

CGColorSpaceRef space = CGColorGetColorSpace(col.CGColor);

?

like image 745
user1234448 Avatar asked Mar 08 '12 17:03

user1234448


2 Answers

Simplest method I have found: Position your cursor at the end of a line, then CTRL-SHIFT-RIGHT CTRL-SHIFT-LEFT SPACE.

There is no such function like the "J" command in VI.

like image 97
Ana Avatar answered Sep 20 '22 13:09

Ana


Old question but I was looking for a way today, and ended up adding:

<key>JoinLines</key>
<dict>
    <key>Join Current Line</key>
    <string>moveDown:, moveToBeginningOfText:, deleteToBeginningOfLine:, deleteBackward:</string>
</dict>

In file:

/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/IDETextKeyBindingSet.plist

(to be edited with sudo)

Then restart XCode, go to preferences -> Key Bindings, and assign some shortcut to "Join Current Line". Seems to work!

like image 39
penguin42 Avatar answered Sep 20 '22 13:09

penguin42