Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3228362
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:41:00+00:00 2026-05-17T16:41:00+00:00

I’m planning to send emails from inside of VIM via SendEmail , but I

  • 0

I’m planning to send emails from inside of VIM via SendEmail, but I have run into some problems.

  1. When piping part of the buffer (or the whole buffer) into SendEmail via the bang (!) operator, the text in my buffer gets replaced with SendEmail’s output. So my first question is: how do I pipe a range into an external command and discard it’s output (or even better: show it in a cmd window)?

  2. Most of the options I’m giving to SendMail don’t change most of the time (like the email server or the from-address), so I don’t want to type them every time I send something: I would like a command that has these parameters hard-coded and where I can specify any number of additional parameters (like -u “subject”).

Can this be done via the command feature (nargs,range), or do I need to write a function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:41:01+00:00Added an answer on May 17, 2026 at 4:41 pm

    The simplest option for this would be to download the RunView plugin from the Vim website and use this. If you let g:runview_filtcmd be equal to your SendEmail command line, it will take the contents of the current buffer, pipe it to SendEmail and print the output in a separate window. I think this achieves what you need. If you want to use RunView for other stuff, you could omit the g:runview_filtcmd step and just add this command:

    :command! -nargs=* -range=% SendEmail <line1>,<line2>RunView SendEmail -e oneoption -b twooption <args>
    

    and then do:

    :SendEmail -u "subject"
    

    or

    :'<,'>SendEmail -u "subject"
    

    I haven’t tested any of this, but it should work very easily.


    If you want to do it manually, you’ll probably have to write a function. The way that RunView works is to copy the whole buffer into a register, create a new window, paste the buffer into the end of that window and then filter the new lines through the program. It adds a date/time stamp at the start to separate multiple runs of the same program. This wouldn’t be too hard to replicate, but you would probably need a function.


    Edit in response to comment:

    If you want to send the path as an argument to SendEmail, you could do something like this (I haven’t tested this, so it might need tweaking a litle):

    command! -nargs=* SendEmailAsAttachment exe '!SendEmail -e oneoption -b twooption -f' expand('%:p') <args>
    

    Note that :exe concatenates arguments with a space, so calling SendEmailAsAttachment -u "subject" expands to:

    !SendEmail -e oneoption -b twooption -f /path/to/filename.txt -u "subject"
    

    See:

    :help expand()
    :help :exe
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
This could be a duplicate question, but I have no idea what search terms
I have a text area in my form which accepts all possible characters from
I am currently running into a problem where an element is coming back from
I have a view passing on information from a database: def serve_article(request, id): served_article

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.