Today I Learned

hashrocket A Hashrocket project

Delete Lines That Match A Pattern

The :g command can be used to execute an Ex command over the entire buffer for all lines that match a given pattern. By choosing d (delete) as the Ex command, all lines that match the given pattern will be deleted. For instance, if I want to remove all lines that contain binding.pry, I can execute the following command:


See :h :g for more details.

h/t Chris Erin

See More #vim TILs
Every developer at Hashrocket is a Vim expert. Check out our development environment, Dotmatrix, and if you are in Chicago, come to the Vim Chicago Meetup hosted at our Chicago office.