On 2014-09-29 02:05, Axel Bender wrote:
> Given the following file:
>
> abc3
> abc4
> bcd1
> bcd3
>
> I'd like to find the line containing bcd1 having a gap (bcd2)
> between it and the next line.
Vim's regex engine(s) don't support doing arithmetic expressions in
the search side. I've wished for something like this in the past
(particularly when searching for IP addresses).
So you'd have to do a NOP replacement on either those you want or
don't want. Something like
:%s#^\(.\{-}\)\(\d\+\)\ze\n\1#\=submatch(0).(getline(line('.')+1)==submatch(1).(submatch(2)+1)?'':'<-- this')
(all one line)
It will mark the first line where the following line isn't one more
than that line, using "<-- this".
I think that's about the best you can do in raw vim without tapping
actual scripting.
-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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment