Monday, January 14, 2013

Re: Save part from file.txt to file1.txt ?

On Mon, Jan 14, 2013 at 11:15 AM, Ben Fritz <fritzophrenic@gmail.com> wrote:
> On Monday, January 14, 2013 9:41:42 AM UTC-6, Jack Gates wrote:
>> I haven't found it in help yet because I'm probably not searching correctly.
>>
>>
>>
>> I want save the yanked text from one large file and save it to another
>>
>> file. I can do this manually with no problem but how to do it
>>
>> automated has escaped me so far.
>>
>>
>>
>> I want to generate file1.txt, file2.txt, file3.txt from file.txt with a mapping.
>>
>>
>>
>> I open file.txt yank "a50Y another "b50Y another "c50Y
>>
>>
>>
>> :tabnew 3 times paste a, b, c into the 3 files.
>>
>>
>>
>> Now I have 4 files open and 3 not saved. How to tell Vim to save and
>>
>> name them file1.txt file2.txt file3.txt
>>
>>
>>
>> Will someone point me to the correct help file please.
>
> Look through :help :write and :help :write_f for the various ways to write output to a file.
>
> For example,
>
> :7,42w >> blah.txt
>
> Will append lines 7-42 of the current file to the end of existing other file blah.txt.
>

Manually that works. I did find that help section. But I want to do it
automated. Is my answer in that help file? I will go back and read it
again. If I have file.txt and I run a mapping that yanks some lines
and start a new file and dumps the yanked text into that file and then
:w how will Vim know what to name that file? How do I tell Vim what to
name that file without doing it manually myself?

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: