Hacker News new | ask | show | jobs
by weaksauce 4829 days ago
visual selection replacement is good too.

:'<,'>s/this/to that/g

I think vim does that automatically when you have a selection active and hit :

1 comments

Note that this will replace over the entirely lines even if it's a blockwise selection.

So you might consider using :'<,'>s/\%Vthis/to that/g

It might be a setting or something but it definitely doesn't do that on my machine or the linux machine I have in the cloud.

this ipsum dolor sit amet

this ipsum dolor sit amet

this ipsum dolor sit amet

this ipsum dolor sit amet

this ipsum dolor sit amet

select the middle 3 lines and do what I said will give you:

this ipsum dolor sit amet

to that ipsum dolor sit amet

to that ipsum dolor sit amet

to that ipsum dolor sit amet

this ipsum dolor sit amet