How to filter visual selection?

前端 未结 1 2074
无人共我
无人共我 2021-02-10 02:55

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

1条回答
  •  日久生厌
    2021-02-10 03:35

    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.

    0 讨论(0)
提交回复
热议问题