The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how i prepare a c++ code(c code) for implementing my own protocol format amitpansuria High Level Programming 1 09-06-2007 08:09 PM
Sun's 'Project Copy Linux' not a Linux copy - Register iBot UNIX and Linux RSS News 0 07-29-2007 02:31 AM
Copy code from shell yohoshua UNIX for Dummies Questions & Answers 1 10-11-2006 11:20 PM
SSH key code versus server key code Texan Security 1 04-12-2006 08:57 AM
Return code from PL/SQL Code Shaz UNIX for Advanced & Expert Users 7 06-03-2003 07:56 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 03-10-2004
Registered User
 

Join Date: Jul 2001
Posts: 62
Copy code to vi

Hi,

whenever I copy a code to vi session from other script it just goes weird.

It just goes across the whole screen and looks really bizzare
If the code is small I can manually remove the tabs and indent it correctly but if it is 2000 lines it makes it really difficult.

Is there something I can do about it and how can I copy efficiently without getting the code all over the place.

Your help will be highly appreciated

Thanks
Rooh
Reply With Quote
Forum Sponsor
  #2  
Old 03-10-2004
Registered User
 

Join Date: Jul 2002
Location: new york
Posts: 1,025
if the text you are copying to a vi session is from a script, i would have the script dump its output to a file, then edit it like that.
ie:
./somescript > someoutputfile
Reply With Quote
  #3  
Old 03-10-2004
oombera's Avatar
Registered User
 

Join Date: Aug 2002
Location: Cleveland, OH
Posts: 804
Re: Copy code to vi

Quote:
Originally posted by rooh
whenever I copy a code to vi session from other script it just goes weird.

It just goes across the whole screen and looks really bizzare
Where's this code coming from? Is it, like Norsk said, the output of a script? Are you just entering it on the command line?

Include the exact command you're using that's producing the undesirable results.
Reply With Quote
  #4  
Old 03-11-2004
Registered User
 

Join Date: Feb 2004
Posts: 3
If you are using vim then you might get better results by doing ":se paste" before the paste operation. Remember to reset the setting i.e. ":se nopaste" when going back to normal editting.

mpty
Reply With Quote
  #5  
Old 03-11-2004
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,249
Turn off autoindent with :set noai
or read-in the file using :r filename
Reply With Quote
  #6  
Old 03-12-2004
Registered User
 

Join Date: Jul 2001
Posts: 62
Hi ,

Basically this is what I am doing.

Suppose my .txt file looks like this
Code:
# check that the file exists
	Say Hello all
		Do it correctly
	place it on the server
	Do all you can
	Save as much as you can
	Think for the rainy day
	Life is a bed of thorns and face it,either smilingly or you wet ur face
Now when I copy these lines and paste it on a vi i.e.
vi tmp_rooh.ksh

It looks like the one below
***********************************************
Code:
# check that the file exists
        Say Hello all
                        Do it correctly
                                place it on the server
                                        Do all you can
                                                Save as much as you can
                                                        Think for the rainy day
                                                                Life is a bed of thorns and face it,either smilingly or you w
et ur face
*************************************************
I want it to look exactly the same as the one in .txt and not like the one above.

Hope this makes it a bit clear.
If it just a few lines of code I can manually do it but there are codes of 1000's of lines and I need to copy them from the text file and put it on unix .

Thanks

Code tags added -- Perderabo

Last edited by Perderabo; 03-12-2004 at 08:32 PM.
Reply With Quote
  #7  
Old 03-12-2004
Registered User
 

Join Date: Jul 2001
Posts: 62
Heah Guys,

The code pasted in the second part has changed it's formatting in here.

CAN YOU PLEASE TRY PASTING THE CODE ON YOUR VI session and hopefully you'll see what I mean as IT's formatting it here quiet well and thus I can't show you here.

Thanks
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 08:53 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0