XCode: How to join two lines?

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.


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!


There's at least one extension for Xcode Source Editor that provides "Join Lines" command, available in AppStore: TextPlus. After installing and activating the extension, you can assign any shortcut to the corresponding "Join Lines" menu via Xcode > Preferences > Key Bindings.