How can I execute a Vim selection or range in bash without replacing it?
Type the :w
command like this:
:w !command
As you type it, it will appear like this:
:'<,'>w !command
See
:help :w_c
In vim 8.0, you can select a range of lines and run :terminal bash
. This will open a terminal running bash
with your selection as stdin.
:terminal node
, :terminal ruby
, :terminal python
seem to work nicely as well.