First, you don't need to explicit set your setting in your .muttrc
, since Vim recognized mutt mails automatically and to set your settings for specifically writing mails with Vim, you simply create a file $HOME/.vim/ftplugin/mail.vim
(create directories, if they don't exists) and put your seetings there:
setl tw=76
setl fo+=aw
You need to, however explicitly enable filetype plugins in Vim, to enable this, e.g. your .vimrc
needs to contain filetype plugin on
or similar.
For making sure, that those formatoptions are only considered, when writing the body of the mail (as I have set edit_headers
on in mutt), I have written an autocommand, that specifically checks the region you are in and applies certain settings, if you are in the header or in a patch or in the signature region,...
I have written about this in more detail here. You might also be interested in the other settings at that page.