When editing text documents, paragraphs can often become split up into lines of varying lengths.
For example, starting from the following text:
Initial Conditions
This·is·a·single·paragraph
with·lines·that
have·been·split·up·into·different·lengths.
NORMAL
Top
1:1
One solution is to combine Vim's text formatting command gw with the paragraph text object selector ip:
gw{motion} tells Vim to format the lines that covered by {motion}, and the ip [[text object]] tells Vim to apply this formatting over the inner paragraph.
Reflow
gwip
This·is·a·single·paragraph·with·lines·that·have·been·split
up·into·different·lengths.
NORMAL
Top
1:1
The lines of the paragraph are combined, then split at word boundaries to produce a sequence of
lines with lengths that follow the width set by vim.opt.textwidth
.