On 04/08/10 22:56, Jim Green wrote:
On Aug 4, 4:22pm, Adam<[email protected]> wrote:
I actually just figured this out earlier today. First clear a register (qaq
to clear a for example). Then go like this: `g:/regex/:silent y A` to copy
all the lines that match into register A.
See also :help :redir about how to capture the results "displayed" by
any Vim command (in this case :g/re/p but it could be :version or :map
or :hi or :au or whatever) to a file, a register or a variable.
If you want to copy just the regex there is a function
here:http://vim.wikia.com/wiki/Copy_the_search_results_into_clipboard but don't
use it with a *lot* of matches or it'll freeze vim.
Adam I am curious what u do after u put the text in register A, do u
copy it to another buffer?
Thanks, I guess I don't fully understand the power of registers, looks
like I only use it to record macros.
:-) I only rarely use registers to record macros; when I do it's
practically always register q so I don't store "permanent" data in that one.
Registers are very useful, especially since they can be remembered from
one Vim session to the next thanks to the viminfo file (see ":help
'viminfo'"). I use most of the 26 "lettered" registers to remember such
more or less permanent data: either difficult to remember by head (e.g.
I use register d for a "typical" HTML <!DOCTYPE line consistent with the
kind of HTML I write), or text which I need frequently.
Then there are the "special" registers: / is the latest search, = to use
an expression wherever you could use a register, + for the clipboard, etc.
The meat of the help about registers comes starting at
|linewise-register| or |characterwise-register| (which both point to the
same help paragraph) but there is more above it in the same helpfile:
see sections 1, 2 and 5 of |change.txt|. Then there are |let-register|
and |expr-register| in the eval.txt helpfile, about using a register as
you would use a variable, and, as I mentioned, |'viminfo'| about
remembering registers (and other stuff too) from one Vim session to the
next.
Best regards,
Tony.
--
I get up each morning, gather my wits.
Pick up the paper, read the obits.
If I'm not there I know I'm not dead.
So I eat a good breakfast and go back to bed.
Oh, how do I know my youth is all spent?
My get-up-and-go has got-up-and-went.
But in spite of it all, I'm able to grin,
And think of the places my get-up has been.
-- Pete Seeger
--
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