LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Copy an entire document in Vi to clipboard (https://www.linuxquestions.org/questions/linux-newbie-8/copy-an-entire-document-in-vi-to-clipboard-417876/)

geokker 02-21-2006 03:11 AM

Copy an entire document in Vi to clipboard
 
When reading a document with vi on a remote machine over ssh, how can I 'select all' and copy to my local clipboard? I imagine selecting two points in the document and 'yanking' the text - how do I do it?

jschiwal 02-21-2006 04:18 AM

It would probably work better if you would use scp to copy the file. If you just want a part of the file, you can write out a range of lines or a block.
For example, in vim
:200,400w fragment
will write the lines from 200-400 to a file called fragment. Vim has a shell escape, ":!", so after that you could copy the file "fragment" to your local machine using the scp command.

gansvv 08-06-2009 03:14 PM

Re: Copy an entire document in Vi to clipboard
 
Use

:%y+

to yank all lines.

G/


All times are GMT -5. The time now is 08:54 AM.