17.4. Edits Between Files
When you give a yank buffer (temporary holding buffer) a one-letter name, you have a convenient way to move text from one file to another. Named buffers are not cleared when a new file is loaded into the vi buffer with the :e command (Section 17.3). Thus, by yanking (copying) or deleting text from one file (into multiple named buffers if necessary), calling in a new file with :e and putting the named buffer into the new file, you can transfer material between files.
The following table illustrates how to transfer text from one file to another. Type the keystrokes exactly as shown to achieve the stated result.
If you yank into a buffer and type the buffer name as an uppercase letter, your new text will be added to the text already in the buffer. For example, you might use "f4yy to yank four lines into the buffer named f. If you then move somewhere else and type "F6yy with an uppercase F, that will add six more lines to the same f buffer -- for a total of ten lines. You can yank into the uppercase buffer name over and over. To output all of the yanked text, use the lowercase letter -- like "fp. To clear the buffer and start over, use its lowercase name ("fy...) again.
-- LL and JP
Copyright © 2003 O'Reilly & Associates. All rights reserved.