In addition to @nobe4's answer, Damian Conway has two pretty interesting mappings to speed up search and replace actions. They come from this how i vim interview which is totally worth reading completely.
To quote him:
[...] I found I was forever doing global search-and-replaces (i.e.
:%s/X/Y/g<CR>
), so I eliminated the repetitious typing by stealing the
never-used (by me) S
command:
nmap S :%s//g<LEFT><LEFT>
Now I just need to type: SX/Y
But then I started noticing how often I did a /-search for some pattern and,
having looked through the matches, then wanted to globally substitute all of
them. Even with the S mapping that was more annoying repetition: first do the
search: /pattern then do the replace: Spattern/replacement So I stole
the (also never used by me) M command for that:
nmap <expr> M ':%s/' . @/ . '//g<LEFT><LEFT>'
Now it’s just: do the search: /pattern then replace all the matches:
Mreplacement
To answer your question, I guess you could slightly modify the first mapping for
something like this:
nmap S :s///g<LEFT><LEFT>
This way you can first make your substitution :s/foo/bar/g
, go to the next line, hit S
and you'll get: :s//|/g
where |
is the cursor, you can now type your new subsitution.