I have a quite big text file formed of blocks like
Short line.
Really long line.
Short line.
separated by empty lines, and I would like to use vim (on Linux) to break down the long lines and obtain blocks like
Short line.
This was
part of
a long line.
Short line.
My problem with gq
(and gw
) is that it reflows each block as an entire paragraph, i.e. it doesn't preserve the two line breaks within each block, and according to :help fo-table
none of gq
's format options would allow me to do what I want.
I also thought that I could achieve my goal if I could define new-line characters to be paragraph delimiters, but according to :help paragraph
those are hard-coded.
Edit: I know that I could use gq
or gw
to format each long line one by one, but since my file runs over a few thousand lines I am looking for a way to achieve this automatically.
gq
andgw
. I'm also glad I didn't stop there, otherwise I wouldn't have learned about the:g
command. :)