Using a one-time recording allows you to precisely control how many changes you make:
qq " start recording in register q /foo<CR> " search for next foo cgnbar<Esc> " change it to bar q " end recording 11@q " play recording 11 times
See :help recording and :help gn .
Another way :normal :
:norm! /foo<Cv><CR>cgnbar<Cv><Esc> <-- should look like this: :norm! /foo^Mcgnbar^[ 11@ :
See :help :normal and :help @:
Or simply:
:/foo/|s//bar<CR> 11@ :
source share