Vim Tips Wiki
Advertisement

Previous TipNext Tip

Tip: #850 - Automatic word wrapping

Created: January 11, 2005 2:53 Complexity: basic Author: mmj Version: 5.7 Karma: 42/27 Imported from: Tip#850

To automatically wrap word in vim

:set wm=2 

which sets a wrap margin of 2 characters at the end of each line, and does automatic word-wrapping as you type in text.

To set textwidth as of your screen with do

:set textwidth=0      " (If you want to set it yourself do :set textwidth=78.) 

If you want to apply this to specific areas; bring the cursor at the beginning of the text you want to format and type gq. Now specify the range, say $ to format a large line.

References

Comments

set textwidth=72       " is more useful. 

to check out the differences.

Anonymous , February 16, 2005 13:59


Advertisement