ap schrieb:
> 
> On Jan 9, 1:52 pm, Andy Wokula <[EMAIL PROTECTED]> wrote:
>> I tried to write a function that collects all the matches for a given
>> pattern in the text.
>>
>> For that purpose, it would be very nice if the following worked:
>>     :%s/{pattern}/\=MyAddMatch(submatch(0))/gn
> 
> Remove the 'n' and let MyAddMatch() return submatch(0).
> Not very eficient, but easy.
> I am sorry if that is beside your point.

Yeah, this could be accepted as a workaround.

but: it doesn't work safely in all situations (e.g. ambigious NUL
characters in the returned string).

Also it would unnecessarily change the buffer (ugly in readonly
buffers) and add useless undo information.
 
>> but it doesn't, because the "n" flag disables evaluation of the
>> expression after '\='.
>>
>> IMHO the "n" flag should only ignore the result of the expression.
>>
>> --
>> Andy
> 
> -ap

-- 
Andy

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui