I looked at other questions working with finding a n / a phenomenon of a word / pattern, but I do not know That's how you would actually replace the N-th event of a pattern in vim.
: s /.* \ (word \). * \ (word \). * \ (word \). * /. * All such events are a clear way of coding coding. \ 1 * \ 2. * New Word. * / G
Is there a better way to do this?
You can do it a bit more easily by using many searches : s / In the pattern / repl /
command, the empty pattern means to change the most recent search result.
: / word // word // word / s / / code / s / word / newword /
by doing this again, or even <<10p>
Alternatively, if I was interacting with this, then I would do something like this:
3 / word: s // newWord / r
This will receive the third instance of the word starting on the cursor and then the replacement.
Comments
Post a Comment