This feels like a dumb question, but I can't find an answer on the Internet (or in VIM help). I'm using VIM 7.2 on Mac OS X. All I want to do is wrap my lines at 72 characters, but doing
:set textwidth=72
has no effect. The textwidth is being set correctly (I can see that when I just query ":set textwidth"), but neither existing lines nor new lines that I type after setting textwidth get wrapped. If I start a new line, still doesn't wrap. Open and close the file, no change. I've also tried :set wrapmargin=72 (with textwidth=0), with no effect.
What am I missing here?
Try gggqG
to apply the new text width to the whole buffer.
gg
means : go to the beginning of buffer gq
means : reformat the text included in the motion G
means : go to the end of the buffer (It will works if the format options are correctly set, as detailed in Zyx post)
On the other hand, you could also display your existing text with a width of 72 characters by adding a modeline
at the beginning or end of your file. See :help modeline
Something like vim:tw=72
should work.