How do I open mail using vim?

You can pipe mail to vim, at least on my test system (RHEL 6.7) it worked.

 mail | vim -

the vim - tells vim to read from standard input

you should see output that say's:

Vim: reading from stdin...

at that point just press the number of the mail item you want to read, IE 1 to read the first message,then press ctrl-d to push it forward.


You can open the mail spool file (usually /var/spool/mail/<username>) in vim, but it will contain header information that you probably don't want. Your best bet is to open the message in your mail program, save the message to a file, then open the newly saved file in vim. You'll still have some header information, but much less of it than if you open the mail spool file directly.

Tags:

Mail Command