Tuesday, November 22, 2011

Re: How to find/delete block between matching lines?

Hello!

On Tue, Nov 22, 2011 at 10:25 AM, Asis Hallab
<asis.hallab@googlemail.com> wrote:
> I want to find blocks of text from a line matching my first regex up to a
> line matching my second regex.
> I'd like to be able to include or exclude the matching lines
> and I'd love to be able to execute a deletion or other command on such the
> found blocks.
>
> How do I accomplish this?

Use marks. Set marks on the lines you found using regular expression and then
provide range for your commands. For example to delete all lines between marks
a and b

:'a,'b d

See help for :range. You can even use patterns directly in the range, but this
is risky :)

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