Applying substitutes to a visual block
tip karma
Rating 155/45, Viewed by 8082
Read and edit this tip on the
Vim tip wiki.
The wiki may have a more recent version of this tip.
created:
March 28, 2001 8:26
complexity:
intermediate
author:
Chip Campbell
as of Vim:
5.7
If you'd like to apply a substitute, or even any ex command, to a visual-block
selected text region (ctrl-v and move), then you'll want Stefan Roemer's
http://www.erols.com/astronaut/vim/vimscript/vis.vim . Just source it in,
and then press ":B". On the command line you'll see
:'<,'>BCtrl-V
Just continue with the substitute or whatever...
:'<,'>B s/abc/ABC/g
and the substitute will be applied to just that block of text