Hello Tim,

Many thanks for your help. The command provided does exactly what I was looking 
for.

Thanks also to the others who provided solution and comments.

Cheers,
Jean-christophe

On Thu, 22 Oct 2009 12:14:52 -0500
Tim Chase <[email protected]> wrote:

> 
> > What I want to do is to find every line starting with 'delete' and
> > delete from the 'aaaa' line till the 'bbbb' line.
> > 
> > I thought about using a global command to do that, but I can't get
> > it working.
> 
> You're on the right track.  Assuming your bracketing lines always 
> exist in parity around your lines-to-delete, you can do something 
> like
> 
>    :g/^delete/?aaaa?,/bbbb/d
> 
> which roughly translates to
> 
>    /^delete/  on lines matching "^delete"
>    ?aaaa?     go backwards to find "aaaa"
>    ,          through
>    /bbbb/     going forward from "aaaa" to the line with "bbbb"
>    d          delete this range ("aaaa" through "bbbb")
> 
> Odd edge cases occur if they can be arbitrarily nested, if the 
> start/end (aaaa/bbbb) lines don't always occur, or if your 
> aaaa/bbbb patterns happen to contain "^delete".  But for the 
> general case, the above should do the trick.
> 
> -tim
> 
> 
> 
> 
> --~--~---------~--~----~------------~-------~--~----~
> You received this message from the "vim_use" maillist.
> For more information, visit http://www.vim.org/maillist.php
> -~----------~----~----~----~------~----~------~--~---
> 


-- 
Liip AG // Agile Web Development // T +41 26 422 25 11
CH 1700 Fribourg // GPG 0xFC648C61 // www.liip.ch

Attachment: signature.asc
Description: PGP signature

Reply via email to