Using vim
, I know that I can replace all occurrences of a string across multiple lines by specifying a count or a range, as documented in :h subst
.
I have a markdown table which contains C function prototypes, as well as English prose. I would like to replace, for example, the word 'float', but only the first three occurrences.
If I were writing a program to do this, many languages have a .replace
method on strings that will accept a howmany
parameter that limits the number of times the replacement is made.
Can I do something like that with vim
? Is there any way to say, for example, "replace float
with long double
at most 3 times"?