Suppose we have some nice bunch of text:
Hello world
and we select the world
in visual mode. Then we could filter the visual selec
The :!
filter command always works on entire lines (this is as old as the original vi, embedding Ex commands that start with :
), and the '<,'>
range also only specifies lines.
You can use the venerable vis plugin to achieve your result; it offers a :B
command that limits the following command to the visually selected text.
:'<,'>B !echo foobar
The plugin works for all kind of Ex commands; for :substitute
within the selection you can also use the special \%V
atom, though.