LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-16-2015, 09:16 AM   #1
Newman1
LQ Newbie
 
Registered: Feb 2015
Posts: 10

Rep: Reputation: Disabled
copy/paste in vi editor


Hello guys,

I am trying to copy a line in vi editor and paste it with below commands but paste command is not working and instead of paste action prints the p character!!

I should also mention that the server is Solaris...

1) crontab -e
2) j to move down
3) yy to copy the line
4) o to create a new line
5) p to paste it
 
Old 06-16-2015, 09:22 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,792

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
you do not need to press o before p (point 4 should be removed)
 
1 members found this post helpful.
Old 06-16-2015, 09:56 AM   #3
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
When you use yy, or dd, it copies (or deletes and copies) the whole line. This includes the newline
When you paste, it pastes the newline as well, creating its own line automatically underneath the current location.

o and O are used to type in text after creating a new line above or below the current line.
 
1 members found this post helpful.
Old 06-16-2015, 10:13 AM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
"o" creates a new line and switches to insert mode, which is why when you type "p", it just prints a literal "p". You need to be in command mode when you hit "p" to paste. You could press "esc" after "o" to switch back to command mode, but as was said above the "o" is redundant since the copy will copy the newline as well.
 
1 members found this post helpful.
Old 06-16-2015, 02:20 PM   #5
Newman1
LQ Newbie
 
Registered: Feb 2015
Posts: 10

Original Poster
Rep: Reputation: Disabled
Thank you guys...it really helped and solved my question.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
vi/vim copy and paste from another editor. theKbStockpiler Linux - General 9 09-23-2011 06:20 PM
How to Copy/Paste from Nano to an outside text editor big_matt Linux - Newbie 4 03-28-2011 02:50 AM
copy paste fro wondows to vi editor golestani Linux - General 3 02-03-2010 12:18 AM
Inquiry:How to Copy/Paste in vi text editor ? hadimotamedi Linux - Newbie 7 09-19-2009 05:28 AM
Inquiry:How to copy/paste in vi text editor hadimotamedi Linux - Newbie 7 08-31-2009 06:58 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:10 PM.

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