The gq{motion} command will format a section of text. The ip motion selects the current paragraph, so gqip applies formatting to the current paragraph. Running the gq command moves the cursor to the end of the paragraph. If you want to keep the cursor on the same word, you can instead run the command gw.

http://vimcasts.org/episodes/hard-wrapping-text/

Formatting text in Vim
Tagged on:

Leave a Reply

Your email address will not be published. Required fields are marked *