Friday, August 16, 2013

Re: Yank all lines in a file

On 2013-08-16 17:45, Benjamin Klein wrote:
> I have a silly question: What is the fastest way to yank all lines
> (V) in an opened file? I normally do:
>
> 1
> G
> V
> G
> yy
>
> Is that the simplest way to do this?

If you insist on visual mode, I think you mean "1GVGy" not
"1GVGyy". A couple variants:

ggVGy
ggyVG
1GyVG

Depending on my whim, I occasionally use that, but tend to reach for

:%y

most frequently, which one character shorter and allows me to also
specify certain target registers in one character rather than two
(the lettered ones do require a space to separate them, but most
frequently I'm doing this to get it in the system clipboard)

:%y+ " yank to the clipboard register

which is two extra characters with the method you suggest:

gg"+yVG
ggVG"+y
1G"+yVG
1GVG"+y

-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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: