You can set the width of a file, git commit message or any group of text by following these steps:
- Set text width with
:set tw=80
(80 here stands for 80 columns) - Select the text that you want to modify:
V
to enter visual mode. - Format the width:
gq
And that’s it!
More information
tw
is short fortextwidth
which you can also use (e.g.:set textwidth=80
- If you want to format text from the start of the cursor to the end of the file, use
gqG
in Step 3