views:

373

answers:

3

Google is not being very helpful here. I'd like to compose emails with :set spell on, but for all other files, :set spell should be off. I am using mutt, and Vim as the editor for composing emails.

In fact, I'm curious, how does Vim know that it's an email I'm composing? Is there a command-line parameter of the type of file being edited? How does mutt know what to pass in?

Thanks.

+7  A: 

Try this in your .muttrc:

set editor = "/usr/bin/vim -c':set spell'"

You can find the correct path to vim with "which vim".

Perfect thanks.It doesn't seem like mutt requires the full path to vim, which is great if I want to use the same muttrc file across platforms.
MTsoul
A: 

Shouldn't you be using a mutt configuration command? See the following links:

dirkgently
+7  A: 

You can use an autocmd in your ~/.vimrc that gets triggered by the detected file type:

autocmd FileType mail set spell
sth
How does Vim know that it's an email I am composing?
MTsoul
Vim knows mutts naming scheme for temporary files. If a file fits that pattern, vim treats it as a mail. (For details look into your filetype.vim that is probably located somewhere in /usr/share/vim)
sth