I know regex for doing a global replace,
%s/old/new/g
how do you go about doing an interactive search replace in vim
I know regex for doing a global replace,
%s/old/new/g
how do you go about doing an interactive search replace in vim
I usually use the find/substitute/next/repeat command :-)
/old<CR>3snew<ESC>n.n.n.n.n.n.n.
That's find "old", substitute 3 characters for "new", find next, repeat substitute, and so on.
It's a pain for massive substitutions but it lets you selectively ignore some occurrences of old (by just pressing n again to find the next one instead of . to repeat a substitution).
I think you're looking for c, eg s/abc/123/gc, this will cause VIM to confirm the replacements. See :help :substitute for more information.
If you just want to count the number of occurrences of 'abc' then you can do %s/abc//gn. This won't replace anything but just report the count for the number of occurences of abc.