Some documents contain paragraphs which are wrapped often at the 80 character mark to help with formatting and readability. This is sometimes accomplished using forced line breaks which can be quite annoying especially when you want to reverse it as I did earlier today. Rather than messing with regex and weird edge cases, use Vim which provides a lovely solution! Here it be:
- Add the command
This sets the text width (number of characters in a line) to a really large value.
- Now use Vim's magic command:
- And voila, the problem is solved.
Explaining the magic:
gg tells Vim to go to the start (by default, of the buffer). Then
gq tells Vim to automatically reformat from that line onwards based on current settings (which includes our new text width directive). Finally, the
G tells Vim to keep reformatting until it reaches the last line.