Hi,
I put a small patch together, which enables the 'p' flag for
searchpair() and searchpairpos(). I find it occasionally useful, to
know which of the 3 patterns (start,mid,end) actually matched, e.g.
for a script that swaps function arguments. If I'm not mistaken,
this must currently be done with (e.g.) an additional
search('\%#...') or something else. It should not break current
script code, because as of now the 'p' gives an error. (It would
break code, which uses a try block to check for the given flags,
maybe in a wrapper function....)
let subpat = searchpair('(',',',')','p')
let subpat = searchpairpos('(',',',')','p')[2]
subpat is 1,2,3 or 0 if search failed. 'p' and 'm' are mutually
exclusive.
http://www.fh-trier.de/~politza/vim/patch_sp_pflag.diff
-ap
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---