This looks nice, will test it out
On Aug 10, 2013, at 21:06, John Little <John.B.Little@gmail.com> wrote:
> On Sunday, August 11, 2013 8:45:30 AM UTC+12, ping wrote:
>>
>> what I meant is, how to use these to actually do the compare in a vim ex command line?
>> sth like :
>>
>> :g#\(abc\d\+) bla bla \(abc\d\+\)#if /1 != /2 then echo "found a diff !"
>
> What you want is for submatch() to work in the context of :g. (Where's perl's $1, $2 ... when you want them...) You could fake it using a function and a substitute with the n flag:
>
> func! Diff(a,b)
> if a:a != a:b
> echo "found a diff!"
> endif
> endfunc
>
> :g#\(abc\d\+) bla bla \(abc\d\+\)#s//\=Diff(submatch(1),submatch(2))/n
>
> Regards, John Little
>
> --
> --
> 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/groups/opt_out.
--
--
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/groups/opt_out.
Saturday, August 10, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment