Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Linux

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-20-2008, 01:13 PM
Artnut
 
Posts: n/a
Copying to a new file

Hi all,

The other day I was browsing through the Vimtutor which runs as a command.
It opens as a tutorial. I would like to know how can I copy, paste the
entire contents to a new file. If I yank the contents, they can only be
copied to the same file. Maybe I am doing something wrong but does VIM
really have a facility/command to copy to another file?
I tried the usual cp command but that copies the command and its code for
the Vimtutor.

Also, how do I read the lessons numbered as |usr_1.txt| ?


Thank you in advance.

Arty


Reply With Quote
  #2 (permalink)  
Old 06-20-2008, 01:47 PM
sk8r-365
 
Posts: n/a
Re: Copying to a new file

Feverishly pounding upon a keyboard Artnut typed:

<snip>
> Also, how do I read the lessons numbered as |usr_1.txt| ?


:help usr_01.txt

--
sk8r-365
But the children of the kingdom shall be cast out into outer
darkness: there shall be weeping and gnashing of teeth.
-- Matthew 8:12
Reply With Quote
  #3 (permalink)  
Old 06-20-2008, 02:27 PM
sk8r-365
 
Posts: n/a
Re: Copying to a new file

Feverishly pounding upon a keyboard Artnut typed:
> Hi all,
>
> The other day I was browsing through the Vimtutor which runs as a command.
> It opens as a tutorial. I would like to know how can I copy, paste the
> entire contents to a new file. If I yank the contents, they can only be
> copied to the same file.

<snip>

I don't bother with that. I use gnome-terminal's menu, but maybe this
will help if you open a second buffer:
http://www.cs.fsu.edu/general/vimanual.html#copypaste

--
sk8r-365
Philip, and Bartholomew; Thomas, and Matthew the publican; James
the son of Alphaeus, and Lebbaeus, whose surname was Thaddaeus;
-- Matthew 10:3
Reply With Quote
  #4 (permalink)  
Old 06-20-2008, 07:36 PM
Beej Jorgensen
 
Posts: n/a
Re: Copying to a new file

Artnut <art@yahoo.com> wrote:
>The other day I was browsing through the Vimtutor which runs as a command.
>It opens as a tutorial. I would like to know how can I copy, paste the
>entire contents to a new file.


If you want the entire contents, you can just write the whole buffer to
a new file:

:w foo.txt

-Beej

Reply With Quote
  #5 (permalink)  
Old 06-21-2008, 08:54 PM
coffee
 
Posts: n/a
Re: Copying to a new file

On Fri, 20 Jun 2008 18:43:11 +0530, Artnut wrote:

> Hi all,
>
> The other day I was browsing through the Vimtutor which runs as a
> command. It opens as a tutorial. I would like to know how can I copy,
> paste the entire contents to a new file. If I yank the contents, they
> can only be copied to the same file. Maybe I am doing something wrong
> but does VIM really have a facility/command to copy to another file? I
> tried the usual cp command but that copies the command and its code for
> the Vimtutor.
>
> Also, how do I read the lessons numbered as |usr_1.txt| ?
>
>
> Thank you in advance.
>
> Arty


Arty;


cp origional-file.txt newfile.txt

To assemble avi slices from newsgroups:

cat firstfile.avi.0* > movie.avi

Or, You can copy the contents of a file also by:

cat originalfile.txt > newfile.txt

helps?


coffee
Reply With Quote
  #6 (permalink)  
Old 06-22-2008, 08:01 AM
Artnut
 
Posts: n/a
Re: Copying to a new file


"coffee" <coffee@the-bunker.com> wrote in message
news:9oWdnUbt15wM98DVnZ2dnUVZ_szinZ2d@giganews.com ...
> On Fri, 20 Jun 2008 18:43:11 +0530, Artnut wrote:
>
>> Hi all,
>>
>> The other day I was browsing through the Vimtutor which runs as a
>> command. It opens as a tutorial. I would like to know how can I copy,
>> paste the entire contents to a new file. If I yank the contents, they
>> can only be copied to the same file. Maybe I am doing something wrong
>> but does VIM really have a facility/command to copy to another file? I
>> tried the usual cp command but that copies the command and its code for
>> the Vimtutor.
>>
>> Also, how do I read the lessons numbered as |usr_1.txt| ?
>>
>>
>> Thank you in advance.
>>
>> Arty

>
> Arty;
>
>
> cp origional-file.txt newfile.txt
>
> To assemble avi slices from newsgroups:
>
> cat firstfile.avi.0* > movie.avi
>
> Or, You can copy the contents of a file also by:
>
> cat originalfile.txt > newfile.txt
>
> helps?
>
>
> coffee



Hey Coffee and others, thanks indeed for the replies. Ideally cat abc.txt >
xyz.txt would help but vimtutor is a command which opens as tutorial in Vi
or Vim. If I yank those 970 lines and I open a blank new file, I cannot p
(paste) because it is not programmed that way. It means I can only paste the
yanked 970 lines in the same tutorial giving me additional 970 lines! I
don't understand why this limitation for a command related file. I can copy
from a normal vi file and paste into another new vi file but cannot do so
with a command output file.


Thank you,

Arty


Reply With Quote
  #7 (permalink)  
Old 06-22-2008, 08:21 AM
J.O. Aho
 
Posts: n/a
Re: Copying to a new file

Artnut wrote:

> Hey Coffee and others, thanks indeed for the replies. Ideally cat abc.txt >
> xyz.txt would help but vimtutor is a command which opens as tutorial in Vi
> or Vim. If I yank those 970 lines and I open a blank new file, I cannot p
> (paste) because it is not programmed that way. It means I can only paste the
> yanked 970 lines in the same tutorial giving me additional 970 lines! I
> don't understand why this limitation for a command related file. I can copy
> from a normal vi file and paste into another new vi file but cannot do so
> with a command output file.


Mark the text you want to copy in vi with your mouse (hold your left
mouse button pressed and move the pointer to the end of the text
visible), switch focus to the program which you want to save the text
with and press your middle button. Repeat this until you copied all the
rows and then save the newly created file.


--

//Aho
Reply With Quote
  #8 (permalink)  
Old 06-22-2008, 01:52 PM
sk8r-365
 
Posts: n/a
Re: Copying to a new file

Feverishly pounding upon a keyboard coffee typed:


To build upon coffee's info:

> cp origional-file.txt newfile.txt
>
> To assemble avi slices from newsgroups:
>
> cat firstfile.avi.0* > movie.avi


or

cat firstfile.avi.??? > movie.avi


> Or, You can copy the contents of a file also by:
>
> cat originalfile.txt > newfile.txt


The single '>' overwrites anything in newfile.txt. Which is OK if it's
empty, but using '>>' would be needed to add (append) text.


--
sk8r-365
And the same John had his raiment of camel's hair, and a leathern
girdle about his loins; and his meat was locusts and wild honey.
-- Matthew 3:4
Reply With Quote
  #9 (permalink)  
Old 06-23-2008, 10:38 AM
birre
 
Posts: n/a
Re: Copying to a new file

On 2008-06-20 15:13, Artnut wrote:
> Hi all,
>
> The other day I was browsing through the Vimtutor which runs as a command.
> It opens as a tutorial. I would like to know how can I copy, paste the
> entire contents to a new file. If I yank the contents, they can only be
> copied to the same file. Maybe I am doing something wrong but does VIM
> really have a facility/command to copy to another file?
> I tried the usual cp command but that copies the command and its code for
> the Vimtutor.
>
> Also, how do I read the lessons numbered as |usr_1.txt| ?
>
>
> Thank you in advance.
>
> Arty
>
>


You must remember that you can filter any range of your text to any unix
command, so you can also use the command cat to save a contents to a file.


Go to the last line you will cut to a file, mark it as a (ma)

Go to the first line and do !'a (you will get a ! on the bottom line
now type:
cat >filename<cr>

If you will have the contents back use undo (u)

/bb
Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Linux


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:49 PM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109