Merge multiple lines into one using Sublime Text

Arun Manivannan picture Arun Manivannan · Nov 27, 2012 · Viewed 86.7k times · Source

I am very new to Sublime Text and I am sure this is a naive question. Watching the Multiple line selection at http://www.sublimetext.com/ (2/6 slide). Absolutely love it.

I understand that Ctrl (Cmd)+Shift+L "multiple-selects" so that we could do the edit simultaneously. However, in the demo, they also merge all the lines into 1 single line. What is the shortcut for that?
I used Ctrl+J but it just deletes once and not all the occurrences of new line.

I use TextPad and use Find/Replace \n with an empty space. But it seems that the person giving the demo uses some kind of shortcut.

Answer

uroc picture uroc · Mar 10, 2013

A single command shortcut for merging multiple lines into 1 is "join lines".

  • Command + J on the Mac to join lines.
  • CTRL + J on Windows
  • Edit > Lines > Join Lines

Another approach is seen in the demo animations on sublimetext.com. Using multiple selections, Ctrl+Shift+L is used to split a selection into lines, and each line is then edited simultaneously. end + del will then remove all line breaks. This can be seen in slide 2/6 at http://sublimetexttips.com/7-handy-text-manipulation-tricks-sublime-text-2/