Forcing selected text to be limited to 80 characters within vim is fairly straightforward.
Just do this:
- Set the text width.
- Select desired lines.
- Reformat selected text.
Here's the breakdown in more detail.
From within vim, first set the text width setting so that vim knows how to format the selected text:
Selecting the text can be done a number of ways, so for this example, let's say my cursor was on the first line of a paragraph that I wanted to format. The cursor can be on any column of that line for this to work. I would then do this to select that paragraph:
Then I would reformat that paragraph, by just typing this:
For more UNIX tips, please check out
Learning the UNIX Command Line.