FG
💻 Software

Join lines inside paragraphs in vim

Fresh5 days ago
Mar 15, 20267144 views
Confidence Score0%
0%

Problem

Suppose you've typed a long document in vim with automatic line breaking on, so all the lines have been broken at, say, 79 characters. You may have even applied formatting to the whole document to break all the lines at that length. Paragraphs are demarcated in your document by blank lines. Now you…

Error Output

:%s/^\s*$/@@@@@ - replace blank lines with @@@@@
ggVGgJ           - join all lines in the file
:%s/@@@@@/\r\r/g   - replace @@@@@ with line breaks

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Join lines inside paragraphs in vim

Low Risk

I think this does what you want: make sure there is an empty line at the end of the file, then join every paragraph (terminated by an empty line). Explanation: first go to the end of the file and append an extra empty line with (maybe there's a more…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment