Page 1 of 1

Vim: Linebreak at 80 characters

Posted: Mon Aug 06, 2018 10:52 pm
by ^rooker
If you want to quickly format a plain text into a certain-character-width, here's how to do it in Vim:

Set the text-width to 80 characters:

Code: Select all

:set tw=80
Then the following options are at your service:

Code: Select all

gq{motion} % format the line that {motion} moves over
{Visual}gq % format the visually selected area
gqq        % format the current line
...
8)


Thanks to an answer from "he_the_great" on Stackoverflow.