[comp.sys.amiga.tech] How to cut and paste in vi

hans@nlgvax.UUCP (Hans Zuidam) (08/09/89)

[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