We don't need to bother entering the current line number.
If you would like to change each foo
to bar
for current line (.
) and the two next lines (+2
), simply do:
:.,+2s/foo/bar/g
If you want to confirm before changes are made, replace g
with gc
:
:.,+2s/foo/bar/gc