Monday, May 26, 2008

Search and delete lines in vim

vim is great editor but one must remember some commands. Sometimes we want to delete line as per the search criteria. vim is capable of that also. To delete the lines as per search use

:g/editor choice/d

This will delete all the lines that have the word "editor choice". Offcourse we can use regular expression too.


Pretty simple g tells to do thing globally. / for pattern enclosing . d for deleting.

Enjoy vim :)
There was an error in this gadget