How can I convert a column of words (one word per line) to a paragraph using vim?
For example, before:
how
to
convert
After:
how to convert
With fairly default settings, gqip
or gwip
should do the trick.
This applies the gq
or gw
formatting/wrapping operators to the ip
in-paragraph text object.
Visually select a range of words and press J
to join them:
J
oin themVjjJ
J
oin themvipJ
Or for the whole buffer you can simply :%join
or :%j
to join all lines.
For one paragraph, with cursor on the first line somewhere:
v}J
v
= start visual selection;
}
= jump to next blank line;
J
= join the lines (note it's a capital J)
In your example, with cursor on the first line, 3J
also would work.
VipJ
.