Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Vim, I'd like to search for lines with a given string, then delete them.

Specifically, I'd like to find lines with the LaTeX commands \begin{frame} and \end{frame}, and delete them. =

share|improve this question
up vote 5 down vote accepted


Use the g command to operate on lines matching a pattern, along with the d command to delete those lines.




should do the trick.

If that doesn't work, try:


which will work, no matter what your magic setting is.

share|improve this answer
Thanks! The g is the trick I needed to learn! – Richard Herron Feb 23 '11 at 21:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .