If I want to delete every word, that is easy, because I would do something like this:
:s%/WORD//g
But what if I want to do xyz
to every occurrence of "WORD"? For example, let's say I want to delete every line that contains "WORD". I can think of a couple ways to do this, but none of them seem ideal.
1)
/WORD
and then manually press ddnddnddnddn...
until there are no more occurrences. But this is time consuming if there are many lines to do this on.
2)
qd/WORD<enter>ddq
and then guess how many times WORD occurs, and then, for example:
500@d
But this will either A) miss a bunch of lines or B) delete of bunch of extra lines.
Is there a better way to do this?
500@d
as you describe is actually safe. The macro playback will stop once the search term is not found. So you'll just see an error "Pattern not found: WORD" after all lines containing it have been deleted.