This is bugging me, because I'm *sure* I did something like this before,
only now I'm misremembering something.

I'll use html as an example...

If I wanted to delete text between certain tags (actually, *any*
start/end text), in multiple instances scattered throughout a huge file,
I was able to do something along the lines of

        :g/<h1>/.,/<.h1>/s/.*/<h1><\.h1>/p

ie, globally recurse through the file, from where I find a "<h1>", from
here ('.') until I find the very next "<.h1>", and from that range
substitute alllll that with the empty tags "<h1><\/h1>".

Ie, I'd want to turn

        <h1>stuff stuff
        stuff stuff stuff
        stuff stuff stuff
        stuff stuff</h1>

to

        <h1></h1>

and leave everything before/after untouched.

In reality, they're *not* matched tags, so there's no 'dit' operation or
anything, eg, it could be between "<script>" and the next
"<\/noscript>", between "{ab}" and the next "<hdend>", between "^sub "
and the next "^^I}", etc.

I remember doing this once before and it worked amazingly well, only now
I'm missing something, probably something basic.

Tnx.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to