Reflow paragraph in vim
Today I learned how to let vim reflow a paragraph according to the currently set text width. This makes plain text files much better readable. The vim command to use is gwip
or gwap
. The gw
at the beginning, tells vim to reformat the lines the cursor is going over. The ip
or ap
tells vim that the cursor should select the inner paragraph
or a paragraph
it’s currently in. At the end of the day both commands gwap
and gwip
do the same thing.
I came across this, while editing a document with a text width of 80 and while I usually would use automatic line breaks with the text width and then manually reflow text, I decided to learn something new today and found this StackOverflow conversation, which was then actually explained by the vim manual using :help gw
and :help ip
.