I have text in Vim
- hit
Ctrl+V
to put VIm in block mode - highlight the text I want
- type
:
this gives the this prompt:'<,'>
- I add to the prompt my regex
s/ /*/g
. This leaves me with:'<,'>s/ /*/g
and the text highlighted - I hit enter
Unfortunately, it operates on the whole line for the block, not just the block. Is there anyway to do a block search and replace?
Best Answer
When using ex commands in visual block mode,
:
, they always operate on the whole line. There are two ways around this:The
\%V
atom will match only inside the visual area. TrySee
:help %V
:help visual-operators