Thursday, April 19, 2012

Re: Delete including newlines

On Thursday, 19 April, 2012 at 19:13:37 BST, Tim Chase wrote:
> Alternatively, if you can identify the 2nd "Something important", you can do
> things like
>
> :g/^# Start of the range/.,/^# Something important/-1d
>
> which will delete from "Start of the range" through the line before ("-1")
> the next line matching "^# Something important".

I need to make sure that the lines between are all comments, so I can't do such a range.

>I'd usually use
>
> :g/^# Start of the range\n#.*\n#/.,+2d
>
>which does as you describe.

That's a little shorter than using norm, I'll use it. Thanks.

--

.

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