I often have text in columns and need to replace some things without clobbering similar stuff on the same line... a simple example follows:
The solution is obviously the \%V regex atom, but note, that this it still a little bit buggy.
Update: It's no bug. This thread explains the behaviour.
The visual selection block should be identifiable with %V
:'<,'>s/\%V80/81/g
You need to add \%V
to your pattern. From :help \%V
:
Match inside the Visual area. When Visual mode has already been
stopped match in the area that gv would reselect.
This is a /zero-width match. To make sure the whole pattern is
inside the Visual area put it at the start and end of the pattern.
OP EDIT: the explicit solution is to to use : s/\%V8\%V0/81/g