>
> > g:/<!--\_.\{-}-->/ delete
>
> I honestly cannot say why this would work for you. It certainly does
> not "work" for me, at least not in the way you seem to expect it to.
>
> I assume you meant :g/<!--\_.\{-}-->/ delete, which I tested, and it
> only deleted the first line, as I expected.
>
All right. I was certainly misunderstanding it.
> > But why isn't
>
> > :g/<!--\_.\{-}> /delete
>
> > deleting until the >
>
> > Also, If I try to delete until the last > in the file:
>
> > :g/<!--\_.*>/ delete
>
> > is not deleting until the last >. I don't understand why...
>
> The reason none of these work, is because you are using the :g command
> with a multi-line pattern and expecting it to operate on every line.
> The :g command does not work that way. The :g command works by first
> finding every line starting a match for the pattern (in this case, the
> first line only) and then performing your given operation on the lines
> found. It does not operate on any but the first line of a multi-line
> match. There are a couple of ways you could do this.
>
Okay. I was really using the :g command wrongly.
> 1. Give a range to your delete command. Something like:
>
> :g/<!--\_.\{-}-->/ .,/-->/delete
>
> 2. Use an :s command instead. Something like:
>
> :%s/<!--\_.\{-}-->//
>
> This being Vim, there are probably a dozen more ways as well, but
> these are the two which immediately spring to mind.
Thanks. I see now that I was taking misguided attempts with a lot of
misconceptions.
I'm re-reading usr_27.txt, and after that I'm heading to pattern.txt.
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment