
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:
Vto enter visual mode. - Format the width:
gq
And that’s it!
More information
twis short fortextwidthwhich 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
gqGin Step 3