Home » Questions » Computers [ Ask a new question ]

Remove lines efficiently in Vim

Remove lines efficiently in Vim

How can you remove given lines efficiently in Vim?

Asked by: Guest | Views: 206
Total answers/comments: 2
Guest [Entry]

"To remove all lines that match div

:g/div/d

To remove all lines that don't match div

:g!/div/d"
Guest [Entry]

":V/div/d

In case of larger files, it might be faster to:

:%!grep div"