4

I am exploring mutt as an email client - and I like it very much - my only problem is setting the editor to be vim with some extra parameters. Ideally, I would like something like

set editor='vim -c "set fo+=aw"'

but this doesn't work: after editing a message and then saving and quitting, mutt responds with an error about "aborted unmodified message". If I use

set editor=vim

then everything works fine. How can I pass parameters to vim via the set editor command in .muttrc?

  • 1
    does mutt launch vim with a specific filetype? if so, you could try defining an autocommand that runs set fo+=aw when the mutt files are loaded – the_velour_fog Jul 2 '16 at 12:27
  • I have used a similar setting for years without any problem. Also, your exact command seems to work fine here, and so does moving the set command to a ftplugin for mail. – Satō Katsura Jul 2 '16 at 14:33
3

I've had the following in my ~/.vimrc for years:

autocmd BufNewFile,BufRead /tmp/mutt* set noautoindent filetype=mail wm=0 tw=78 nonumber digraph nolist
autocmd BufNewFile,BufRead ~/tmp/mutt* set noautoindent filetype=mail wm=0 tw=78 nonumber digraph nolist

They tell vim to set those options when editing matching files.

It works well for me. The only thing I'd consider adding would be to set paste as well as noautoindent.

BTW, I write all my email in mutt with vim - I wouldn't/couldn't use anything else....even when I had to use Icedove (aka Thunderbird) at $a_previous_job years ago to connect to their Exchange server, I had the External Editor plugin installed so I could use gvim. I eventually switched to using mutt+vim+fetchmail - direct imap connections to the Exchange server timed out in about 60 seconds, nowhere long enough to write anything but the shortest msg in vim.

1

You can use a shell script to hold the options, and set your editor variable to that.

For example

#!/bin/sh
vim -c "set fo+=aw" "$@"

The Mutt FAQ suggests a similar approach in How to trim quoted replies (like stripping signatures)?, though this is not generally material for an FAQ.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.