TIL: Delete lines matching pattern in VIM

:vim:

To remove lines of oppened file which contains the pattern run following command:

:g/pattern/d

The g! can be used to remove lines which do not match the pattern:

:g!/pattern/d

g! is the same as v:

:v/pattern/d

Source: https://vim.fandom.com/wiki/Delete_all_lines_containing_a_pattern