In order to skip the addressee and subject prompts before editing a message, one must set both autoedit and edit_headers. But setting the latter puts the header into the edit buffer. Is it not possible to skip the prompt without having the header in the buffer? I have a rather long header, and no need to edit it along with the message.

Alternatively, is there a way to exclude a particular header items from the edit buffer?

PS. The reasons I do not want to give the addressee and subject first are

  1. I do not want to worry about accidentally sending the message prematurely;
  2. It may be easier to think of a suitable subject line after the message has been written.

I'm using Vim as my editor.


Using the filetype plugin for mails in vim:

Create the file $HOME/.vim/ftplugin/mail.vim with the single line

set foldmethod=manual
norm }

This will cause the the above commands to be executed every time the mail filetype plugin loads, which it does when you're editing a mail message.

The commands will create a fold over the headers (everything from the start of the file to the first empty line) and collapse them into a single line. The norm } command will simply place you on the first line of the body of the message (you may alternatively want to use /^-- /-1 instead to place the cursor on the last line of the message, before the signature).

To open the fold, step over it and type zo. To close it, step over it and type zc.

This is assuming that you have autoedit and edit_headers set in mutt already.

vim with a new message, headers folded:

+--  8 lines: From: Myself <my.name@example.com>-------

my signature here

With the headers unfolded:

From: Myself <my.name@example.com>
Organization: blipp blopp beep beep


my signature here
  • It looks as if this puts <<< and >>> into the header. – Toothrot Apr 8 '18 at 13:10
  • @Toothrot Huh? "It works for me"... does it actually insert that into the header, or does it just look like it? – Kusalananda Apr 8 '18 at 13:18
  • It does do that. Maybe because I have set foldmarker=<<<,>>> and set foldmethod=marker. – Toothrot Apr 8 '18 at 13:19
  • 1
    Yeah, just had to put set foldmethod=manual in mail.vim. – Toothrot Apr 8 '18 at 13:25
  • 1
    Mutt will insert the empty line. Did you have 1,/^$/-1fold before? I'll use that and end with norm G. Thanks! – Toothrot Apr 8 '18 at 13:32

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.