I want to define a global search and replace with confirmation command, something like:
command Gfr :s/<parameter1>/<parameter2>/gc
So I can type:
:Gfr foo bar
and Vim will find all occurrences of 'foo' in the document and ask for each whether I want to replace it with 'bar'.
Googling has led me to some tantalising hints that this is possible, but no definitive answer.
:help :command
in Vim itself and scroll around for five minutes?:%s
. I recommend you familiarize yourself with:s
instead of wrapping it in a command of your own. It quickly becomes second nature.:s
. This question is really more a learning exercise for customising vim.