Friday, June 19, 2015

Re: move range to a file that is open in another buffer

On Friday, June 19, 2015 at 10:49:14 AM UTC-5, Ben Fritz wrote:
> On Friday, June 19, 2015 at 8:23:17 AM UTC-5, Rick Dooling wrote:
> > Dear Vim Wizards:
> >
> > If I'm in file1.txt and want to write a range to file2.txt, I can do:
> >
> > :'a,'bw >> file2.txt
> >
> > But if file2.txt is open in another buffer, I get an error E139.
> >
> > Is there a way to copy or move a range to another open buffer without getting this error?
> >
> > Thanks,
> >
> > Rick Dooling
> >
> > ps - I'll add the practical use I'm after. I often write in a main file, let's call it mainfile.txt but I also frequently cut paragraphs to a file of scraps, I'll call it scrapfile.txt
> >
> > So I'm trying to make a function that will append lines cut from mainfile.txt to scrapfile.txt, whether or not scrapfile.txt is open in another buffer.
> >
>
> Is there something wrong with the obvious method?
>
> :'a,'by
> " or :d instead of :y above for "cut" instead of "copy"
> :sp scrapfile.txt
> :$put
> :wq

Thanks, Ben. I like that. I don't often use :sp and didn't know it moved you around like that and landed back in the same place after the :wq.

Rick

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment