Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!ginosko!uunet!mcvax!hp4nl!phigate!nlgvax!hans
From: hans@nlgvax.UUCP (Hans Zuidam)
Newsgroups: comp.sys.amiga.tech
Subject: How to cut and paste in vi (was: Re: Minix, Unix on the Amiga...)
Keywords: vi, yank, put, vi-tidbits
Message-ID: <275@nlgvax.UUCP>
Date: 9 Aug 89 13:50:23 GMT
References: <3352@sol.warwick.ac.uk> <4031@cps3xx.UUCP> <7559@cbmvax.UUCP> <5067@ucdavis.ucdavis.edu> <439@xdos.UUCP> <7583@cbmvax.UUCP>
Followup-To: comp.editors
Organization: Philips Research Laboratories, Geldrop
Lines: 32

[I've redirected followups to comp.editors ++hz]

jesup@cbmvax.UUCP (Randell Jesup) writes:
>In article <439@xdos.UUCP> doug@xdos.UUCP (Doug Merritt) writes:
>>... Cut and paste is supported in vi in a way painful to vi-novices
>	BTW, what do VI users do when they want to cut and paste _between_
>files??  I never though of that before; it must be a pain.

Just for your (and other peoples') curiosity:

When vi switches files it throws away its delete and undo buffers.
Therefore you have to yank a piece of text to a named buffer, switch
files and put it back from the named buffer. So:

	[file a]    "ayw	Yank the current word to buffer 'a'
		    :n^M	Next file
	[file b]    "ap		Put the text from buffer 'a'

Note that the 'w' is a text selector. Thus you can also use '2w' for
'two words', '/regexp' for everything upto 'regexp', '2j' for 'this
and the next two lines' and so on.

Last week Maarten Litmaath posted a handy reference chart to comp.editors
msgid <2965@solo12.cs.vu.nl> dated august 1. Included is (was?) a nice
tutorial on writing macros. I can mail you a copy if you like ;-).

						Hans
-- 
Hans Zuidam                                    E-Mail: hans@pcg.philips.nl
Philips Telecommunications and Data Systems,   Tel: +31 40 892288
Project Centre Geldrop, Building XR
Willem Alexanderlaan 7B, 5664 AN Geldrop       The Netherlands