Noah Spurrier wrote:
I used this pattern to select sections of test that belong to me
when CVS or SVN generates a merge conflict. This pattern works fine:
    /^<<<<<<<\_.\{-}=======.*$/
I have search highlighting turned on and I can see the multiline
patterns get highlighted as expected.

Then I tried to delete all of those highlighted areas by using
the global command:
    :g//d
This didn't work. It would delete the FIRST line of the pattern match, but
leave all the other lines. So I figured that maybe there was some trick to
using // to recall the last search pattern that I was not aware of, so
I tried typing in the pattern to :g:
    :g/^<<<<<<<\_.\{-}=======.*$/d
Again, this would only delete the first line of the pattern match.

From the vim :g documentation I read this:
  The global commands work by first scanning through the [range] lines and
  marking each line where a match occurs (for a multi-line pattern, only the
  start of the match matters).

What is the best way to do what I am trying to do?
I want to delete all text that matches a pattern, including
multi-line patterns.

Yours,
Noah





Try the :s command, defining a pattern matching characterwise what you want to delete, possibly including the ending linebreak, and replacing it by nothing.

(Untested)

        :1,$s/^<<<<<<<\_.\{-}=======.*\n//

Best regards,
Tony.





Reply via email to