Merge multiple lines into one using Sublime Text
A single command shortcut for merging multiple lines into 1 is "join lines".
- Command + Shift + J on the Mac to join lines.
- CTRL + Shift + J on Windows
- Edit > Lines > Join Lines
Important note: This keyboard shortcut changed in versions of sublime text released after around mid-2021. For older versions, use Command + J, or CTRL + J.
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/
I think that, in the demo, he presses Del, with the cursor at the end of the line, in multiple selection. This way the \n
is removed in every selected line.