Sunday, November 27, 2011

Re: copy paragraphs containing

On Nov 27, 10:47 am, Albin Olsson <albin.ols...@gmail.com> wrote:
> I suggest
>
> :let @z=''
> :g/pattern/ normal "Zyap
>
> That would put all paragraphs in register z.
>
>
>
>
>
> On Sun, Nov 27, 2011 at 7:02 PM, Bee <beeyaw...@gmail.com> wrote:
> > I have a file containing groups of lines separated by an empty line.
>
> > In vim speak each group is called a paragraph and I can use the
> > following from motion.txt to move by paragraph:
>
> >              *{*
> > {     [count] paragraphs backward.  |exclusive| motion.
>
> >              *}*
> > }     [count] paragraphs forward.  |exclusive| motion.
>
> > How would I find all 'paragraphs' that contain a specific string and
> > copy each paragraph to another buffer or register?
>
> > I know how to do it with lines:
>
> > qaq
> > :g /string/y A
>
> > --
> > 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, visithttp://www.vim.org/maillist.php
>
> --
> Albin Olsson, IT Consultant and Classic Connoisseurwww.albinolsson.se| albin.ols...@gmail.com
> +46 707 831 830

Thank you. That works but if there is more than one occurrence of /
pattern/ in the paragraph, the paragraph is copied 'N' times. Is there
a way to get only one copy of the paragraph?

--
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: