Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 8 down vote accepted

Type the :w command like this:

:w !command

As you type it, it will appear like this:

:'<,'>w !command

See

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.