I need to do a bunch of word replacements in a file and want to do it with a vi command, not an EX command such as :%s///g
. I know that this is the typical way
Using the information in this post, I have formed this useful mapping. I chose 'cp' because it signifies "change paste"
nmap
EDIT:
Also I took this a step further and supported any motion.
To get the equivalent of command above it would be cpw
for "change paste word"
"This allows for change paste motion cp{motion}
nmap cp :set opfunc=ChangePasteg@
function! ChangePaste(type, ...)
silent exe "normal! `[v`]\"_c"
silent exe "normal! p"
endfunction