I know how to do something to every line that matches a pattern, using
:g. Is there a way to do something to every line that does not match the pattern?
For example, suppose I want to delete every line that does not match /foo/. I might do something like:
:G is not the opposite of
:g, but that is what I am looking for)