Friday, March 23, 2012

Re: Edit the US Code

On Friday, March 23, 2012 10:26:12 AM UTC-5, Ben Fritz wrote:
> On Thursday, March 22, 2012 9:14:21 PM UTC-5, thdq wrote:
> > Hi all,
> >
> > I downloaded some copies of US Code. Since I am only interested in the
> > statute, not revision history and other information, I'd like to
> > delete anything enclosed by a pair of '-SOURCE-' and '-End-'. How can
> > I do it in vim? Thanks.
> >
>
> :/-SOURCE-/,/-END-/d
>
> See :help :range, :help :d

Of course, that only deletes the first occurrence after the cursor. For all occurrences,

:g#-SOURCE-#.,/-END-/d

g#-SOURCE- means "on all lines with a -SOURCE-"
.,/-END-/ selects the range "from the current line (the one matching -SOURCE-) to the next line with -END-"
d deletes the line selection

--
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: