Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucsd!usc!sdd.hp.com!uakari.primate.wisc.edu!dali.cs.montana.edu!ogicse!unicorn!milton!uw-beaver!zephyr.ens.tek.com!tektronix!sequent!yuf From: yuf@sequent.UUCP (Kyle Grieser) Newsgroups: comp.editors Subject: Re: Some VI macros and ideas Message-ID: <40722@sequent.UUCP> Date: 15 Aug 90 23:15:25 GMT References: <3309@stl.stc.co.uk> Reply-To: yuf@crg2.UUCP (Kyle Grieser) Organization: Sequent Computer Systems Inc. Lines: 53 In article <3309@stl.stc.co.uk> jrd@stl.stc.co.uk (J.R.Davis) writes: >F8 and F9 are especially useful for transferring text between >two files - for example > > vi file1 > go to start of block to move > F3 > go to end of block to move > F8 > F5 > :wq > vi file2 > go to place you want text from file 1 > F9 > >Voilla! This is much easier done within the same vi session as follows: vi file1 go to begining of block mm /* mark place */ go to end of block "ay'm /* yank into buffer "a" */ :n file2 go to place you want text from file 1 "ap /* put contents of "a" buffer */*/ Macros can be used fo the marking, yanking and putting, but I just wanted to point out that one doesn't need the intermediate temp file and two vi sessions as vi retains it's named buffers between files. This is also nice because one can now do the following: :w /* write the changes to file2 */ ^^ /* control-^ to switch back to file1 */ move to another block to move mm go to end of block yank again ^^ again /* switch back to file2 */ place new stuff ... ... ... This can be repeated for quite a while when taking numerous blocks from one file to another. ---- Kyle Grieser ...!sequent!yuf Sequent Computer Systems Inc. sequent!yuf@uunet.uu.net 15450 S.W. Koll Parkway Beaverton, OR 97006 (503) 626-5700