On 04/19/12 17:54, Paul wrote:
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".

if you want to ensure that only comment-lines are found, you can use a branching regexp conjunction:

  /^\(# Something important\|[^#]\)/

since you back off by one line either way (either you've found a part of the comments that is important, or you've found a line that isn't a comment).

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

If shorter is what you want, the "." is optional/default, so you can do

 :g/regex/,+2d

-tim


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

Reply via email to