Copy code to vi


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Copy code to vi
# 1  
Old 03-10-2004
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
# 2  
Old 03-10-2004
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
# 3  
Old 03-11-2004
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.
# 4  
Old 03-11-2004
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
# 5  
Old 03-11-2004
Turn off autoindent with :set noai
or read-in the file using :r filename
# 6  
Old 03-12-2004
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 11:32 PM..
# 7  
Old 03-12-2004
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
 
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help with script to copy code to multiple servers

Hi, I am new to scripting and i am trying to use below script to copy code to multiple servers and multiple locations on each server. the script is not working or doesnt give any error. Any help is appreciated. basically i want a script to get the code from a location (dir below) and read the... (2 Replies)
Discussion started by: Ron0612
2 Replies

2. Shell Programming and Scripting

Copy-pasted code behaves diffrent

Heyas I'm currently attempting to apply the code of tui-select to tui-list. That is because tui-list simply made a 1 string list, while tui-select uses dynamicly up to 3 strings per line. Anyway, so i copy pasted the code, and just made the changes marked with red.... Know that both scripts... (2 Replies)
Discussion started by: sea
2 Replies

3. Shell Programming and Scripting

how to copy the directory but not copy certain file

Hi experts cp bin root src /mnt but not copy bin/bigfile any help? ( I post this thread in the "redhat" forum wrongly, I don't know how to withdraw that question in that wrong forum) Thanks (6 Replies)
Discussion started by: yanglei_fage
6 Replies

4. Solaris

Need help with copy

Hi Gurus, I need some help to fulfill the following requirement. I have a file A and some contents in it and I have file B and some conent in it. I need to append the contents on File A to FIle B. I am sure its Basics but missing it. Thank You, Rama (1 Reply)
Discussion started by: rama krishna
1 Replies

5. UNIX for Dummies Questions & Answers

What is in-core copy and disk-copy of i-node table?

I have found a question from the exercises of my study mat. The question is "Why are there a in-core copy and a disk-copy of i-node block and super block?" If any one know the proper answer then please send me..... (1 Reply)
Discussion started by: dearanik
1 Replies

6. UNIX for Dummies Questions & Answers

Copy code from shell

Hi everyone.. I'm a full-fledged newbie so bear with me. =) I'm running code in the shell, and I'd like to copy the lines into a text file. Everytime I try using Contrl-C, the lines repeat as code. Is there some sort of export history function I can use? (1 Reply)
Discussion started by: yohoshua
1 Replies
Login or Register to Ask a Question