Use $yy To Select and Copy All The yy command is used to yank or copy the current line but providing the line count we can select and copy all lines. First change to normal mode with the ESC.
Highlight the files you want to copy. Press the keyboard shortcut Command + C . Move to the location you want to move the files and press Command + V to copy the files.
To place the yanked line in a new line above the cursor, type P . The yy command works well with a count: to yank 11 lines, for example, just type 11yy . Eleven lines, counting down from the cursor, will be yanked, and vi indicates this with a message at the bottom of the screen: 11 lines yanked .
Place the cursor on the line you wish to copy. Type yy to copy the line. Move the cursor to the place you wish to insert the copied line. Type p to insert the copied line after the current line on which the cursor is resting or type P to insert the copied line before the current line.
I use the following instruction: :%y+
ggyG
(go to the first line, yank to the last line)
Edit: Ah, system clipboard. Doesn't exactly roll off the fingers, but: gg"+yG
A working solution in old vi is :r filename
in the new file.
Another method is this:
ggyG
Go to the top, and yank to the bottom.
I use the following instruction: :%y
.
ggyG
(Go to top, yank to bottom)
:0,$ y
I dunno which way is easier.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With