LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-08-2005, 05:23 AM   #1
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 637

Rep: Reputation: 32
Question How do you copy and paste a line in VI?


It would be great to be able to copy and paste a line in VI. Is there a command to do that?
 
Old 05-08-2005, 05:34 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
hit v to enter visual mode, select the text you want and hit y to copy. then hit p to paste in the destination

you should print out a cheatsheet, or become more familiar with the manpages to avoid needing to ask questions like this. Gentoo have a great cheet to print out: http://www.gentoo.org/doc/en/vi-guide.xml
 
Old 05-08-2005, 05:39 AM   #3
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 637

Original Poster
Rep: Reputation: 32
I've got a cheat sheet going... that's basically the last thing I needed. thanks for the help!
 
Old 05-08-2005, 05:46 AM   #4
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
Please note: "v" is a vim command and is not supported in all implementations of vi. I do love visual mode though... and vim adds a lot of things to make vi easier to use on a daily basis.

The easiest way to copy a whole line (which will work in any version of vi) is "yy" and then "p" or "P" where you want it.

Almost any movement command can be used in conjuntion with "y" to select text.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to copy-paste on command line? jameshao Linux - General 3 02-02-2009 01:14 AM
copy/paste help abk4523 Linux - Newbie 4 05-31-2005 06:29 AM
how to copy and paste acd copy cd paschim Linux - General 2 04-05-2004 09:25 AM
copy-paste bash Linux - Software 1 09-08-2003 02:45 PM
Copy Paste under command line? Stingreen Linux - General 7 02-10-2002 06:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration