Vim: Linebreak at 80 characters

Step-by-Step descriptions of how to do things.
Post Reply
User avatar
^rooker
Site Admin
Posts: 1469
Joined: Fri Aug 29, 2003 8:39 pm

Vim: Linebreak at 80 characters

Post 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.
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
Post Reply