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

I'd like to select some text in vim and then execute it in bash. I know of the following procedure:

  1. select text using V or v
  2. :!!

However, this replaces the selection with the output of the command. What if I don't want that?

share|improve this question
up vote 11 down vote accepted

Type the :w command like this:

:w !command

As you type it, it will appear like this:

:'<,'>w !command


:help :w_c
share|improve this answer
Thanks, exactly what I was looking for – Klaas van Schelven Aug 31 '11 at 17:34

You must log in to answer this question.

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