Saturday, July 7, 2012

Re: yank matched portion of a selection of lines

On 07/07/12 06:35, Christian Brabandt wrote:
>> I'd favor a solution with
>> :%s/{pattern}/\=CollectMatch(submatch(0))/gn
>>
>> but '\=' and the "n" flag don't work together.
>> What about a todo item? Add another flag?

I must say I'm surprised that the \= and "n" flags don't play well
together. Though it would toggle 'modified', you could have
CollectMatch just return its argument for a noop replacement...

> Would a textobject like i/ work?

Two parts of me conflict on this: one thinks "wow, that's a cool
idea", the other thinks "what twisted sicko thought up that one?!"
:-) I suspect there are a bunch of odd edge-cases such as
search-offset modifiers, zero-width assertions of what can
precede/follow a given pattern, use of the \zs and \ze modifiers, etc.

-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

No comments: