Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose i'm in vim editing the file ~/hello.txt

I would like to send this files as an attachment with mutt from vim using some terminal command.

What does such a command look like?

share|improve this question
up vote 1 down vote accepted

The command looks like this:

:!mutt -s "your subject" -a ~/hello.txt -- < /dev/null

Since you're executing it within Vim and editing the attachment, you could also use this:

:!mutt -s "your subject" -a % -- < /dev/null

You didn't say anything about a message body, so I just used an empty message body by redirecting stdin from /dev/null.

share|improve this answer

How would you do it from your shell?

You can execute shell commands from Vim with:

:!command %

where command is the external command and % is the current file.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .