This is similar to a grep on the local buffer. To delete all lines matching a certain regular expression pattern, use :g/pattern/d To do the opposite, i.e. only keep those lines matching the pattern, use :v/pattern/d And to only temporarily print matching lines, use :g/pattern