Sunday, November 27, 2011

Re: copy paragraphs containing

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 <beeyawned@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, visit http://www.vim.org/maillist.php
>

--
Albin Olsson, IT Consultant and Classic Connoisseur
www.albinolsson.se | albin.olsson@gmail.com
+46 707 831 830

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

Post a Comment