> I have some text like this:
>
> # Something important
> # Start of the range
> # anything could be here
> # anything could be here
> # Something important
>
> I want to delete a range like this:
>
> :g/^# Start of the range\n#.*\n#.*/norm 3dd
>
> That is: the start of the range, followed by the next two lines but only if they're also comments (I'm going to automate it, so I must make sure that those lines are such).
>
> :g/^# Start of the range\n#.*\n#.*/d
>
> doesn't work, because it deletes only the first line. Is my 'norm 3dd' method the best way?
>
The problem is that the command ran by your :g command defaults to acting on the line where the entire match starts. So by specifying a multi-line match, the match starts on the first line, and the d command will only act on that line.
You need to specify a range for your d command, as Tim suggests.
--
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:
Post a Comment