tags:

views:

873

answers:

2

I've changed the textwidth option mid-way through my file and I'd like to reformat the whole buffer to use the new width. What's the quickest way to do this?


Solution - Vim documentation topic

gq

+4  A: 

See

:help gq

if it helps.

ldigas
+2  A: 
gq<motion>

For example, if your file consists of 100 lines, move to the first line and then press:

gq100<Down Arrow>

You can use the visual mode to select the lines and then press gq as well.

Alan Haggai Alavi
So `gg` then `gqG`?
John Kugelman
Yes, that works too. Shorter!
Alan Haggai Alavi