Saturday, May 15, 2010

Deleting lines and non-matching lines with VIM

I'm always forgetting how to do this but here's how to delete matching lines:
:g/.*foo.*/d
And the more difficult thing to do that vim makes easy is deleting non-matching lines.  All you do is negate the pattern:
:g!/.*foo.*/d
Daily Vim: Text Editor Tips, Tricks, Tutorials, and HOWTOs: Delete Lines Matching Keyword






No comments:

Post a Comment