On May 12, 2011 at 02:28 PM -0600, Aaron Toponce wrote:
Is there are way to tell Vim not to wrap the headers, even though I wish to
wrap the body?

I hardly ever edit the headers in my editor, vim or otherwise. I do that all from the mutt interface. I have Vim (and my other editor) set up to not mess with lines I don't edit. So they don't munge headers.

As far as wrapping my paragraphs in my message body, you need to have your vim options set correctly. I have the following set for when I edit mail in vim. You could get away with a subset of these.

    setlocal formatoptions=wtcqrn
    setlocal tw=72
    setlocal noai
    setlocal nosi

I set text wrapping to 72 columns (tw). I turn off auto indenting (noai) and smart indenting (nosi). The format options are explained in vim's help under 'fo-table'. But the short story on them is the following:

- t - autowrap text using textwidth
- c - autowrap comments using textwidth - add comment leader
- q - allow formatting comments with 'gq' command
- r - auto insert comment leader after hitting enter in insert mode while in a comment
- n - recognize numbered lists while formating
- w - trailing white space indicates a paragraph continues to the next line. a line that ends in a non-white character ends the paragraph.

The 'w' option is the pertinent one if you set format=flowed.

The way the above settings works is that as I type long wrapped paragraphs, vim automatically adds line breaks and a trailing space on those lines (satisfying the requirements of f=f). Lines that I don't edit don't get line breaks added. If I edit a wrapped paragraph, I usually have to manually run 'gq' on that paragraph to get it formatted correctly - if you don't want to have to do that, you can look into adding the 'a' option to the formatoptions. You also might be interested in the 'v', 'b', and'l' options, which control how vim wraps lines depending on their lengths, content, and how you edit the line. For example, I should enable the 'l' option...

Hope this helps.  And if you already knew this stuff, please disregard.

Attachment: pgpEZyLC5cxRc.pgp
Description: PGP signature

Reply via email to