" C-s in normal mode will replace all the occurences of the last register with " what was typed in the provided body. noremap :set operatorfunc=DoSubstitutiong@ function DoSubstitution(str) abort exec printf(":'[,']s/%s/%s/g", @", @.) endfunction