Re: yank matched portion of a selection of lines

2012-07-19 Thread Bram Moolenaar
Christian Brabandt wrote: On Sa, 07 Jul 2012, Tim Chase wrote: 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?

Re: yank matched portion of a selection of lines

2012-07-16 Thread Christian Brabandt
Bram, On Sa, 07 Jul 2012, Tim Chase wrote: 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

Re: yank matched portion of a selection of lines

2012-07-16 Thread Tim Chase
On 07/16/12 14:27, Christian Brabandt wrote: Bram, On Sa, 07 Jul 2012, Tim Chase wrote: 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?! Attached patch search_textobj.diff implements a match text-object. This

RE: yank matched portion of a selection of lines

2012-07-08 Thread John Beckett
Andy Wokula wrote: This does what you want (very useful!): http://vim.wikia.com/wiki/Copy_search_matches Somehow all of these solutions are less than ideal. The best solution according to correct pattern matching involves :substitute, but it modifies the buffer. You work around this

Re: yank matched portion of a selection of lines

2012-07-07 Thread Ben Fritz
On Friday, July 6, 2012 4:08:30 PM UTC-5, Hoss wrote: 123,456g#pattern# - operate on all lines between 123 and 456 (inclusive) which include a match for pattern exec norm! ... - do a normal-mode command on each line, as follows: /pattern\CR - search for the pattern \Ay - yank from

Re: yank matched portion of a selection of lines

2012-07-07 Thread Andy Wokula
Am 07.07.2012 01:25, schrieb John Beckett: Hoss wrote: Ideally, the yanked text would consist of each match within the range, concatenated together with a newline between each. This does what you want (very useful!): http://vim.wikia.com/wiki/Copy_search_matches John Somehow all of these

Re: yank matched portion of a selection of lines

2012-07-07 Thread Christian Brabandt
Hi Andy! On Sa, 07 Jul 2012, Andy Wokula wrote: Somehow all of these solutions are less than ideal. The best solution according to correct pattern matching involves :substitute, but it modifies the buffer. You work around this problem by creating a temporary buffer ... I'd favor a

Re: yank matched portion of a selection of lines

2012-07-07 Thread Tim Chase
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

yank matched portion of a selection of lines

2012-07-06 Thread Hoss
I have a buffer open. I hit /, put in a search, and the matched text, which is the text I am interested in, is highlighted. How do I yank that text, and only that text, in other words, not whole lines? Bonus points if I can also restrict it to a selection of lines, by number. -- You received

Re: yank matched portion of a selection of lines

2012-07-06 Thread Ben Fritz
On Friday, July 6, 2012 10:12:07 AM UTC-5, Hoss wrote: I have a buffer open. I hit /, put in a search, and the matched text, which is the text I am interested in, is highlighted. How do I yank that text, and only that text, in other words, not whole lines? Bonus points if I can also

RE: yank matched portion of a selection of lines

2012-07-06 Thread John Beckett
Hoss wrote: Ideally, the yanked text would consist of each match within the range, concatenated together with a newline between each. This does what you want (very useful!): http://vim.wikia.com/wiki/Copy_search_matches John -- You received this message from the vim_use maillist. Do not