Technical Leader

Vim Reformat

While I am typing in Vim I do not let the text wrap, I put in returns manually. This causes problems when I came back to it later and add in some text within the middle of paragraph. The line will continue on to the right margin and the text will wrap, then when I have to adjust the line I have to fix all the following lines to be ended correctly on the right side.

Well, using 'gq' you can somewhat auto format your lines. This will use what 'textwidth' is set to, if it is not set then the width of the screen is used up to 79. In order to format the current line 'gqq', to format the paragraph 'gqip' (ip for inner paragraph).

For further reading try :he auto-format and :he text-objects.