Tutorial #6 - vi: copy and move text via buffers


1. Bring up my.address in vi.  

2. Delete four lines from your phone number listing and place 

them in buffer y.  Then delete another line and restore that line 

with u.

3. Place two lines without deleting them into buffer w.

4. Move to the end of the file, and put the contents of buffer y 

here.  Without moving the cursor, put the contents of buffer w into 

the file.

5. Move the cursor to the beginning of the phone number listing 

and insert the contents of buffer w at that point.  Notice that it is 

still the same.

6.Place the current directory listing (use !ls) into the file, then 

delete it from there and add it to buffer w.  Then insert buffer w at 

the end of the file.

7.Practice using the named buffers some more if you want.

8.  Save the file in its current state as buffer.stuff, and then 

abandon any changes you made to my.address.


If it doesn't work:

A.  You won't see any indication on the screen when something is placed 
into a buffer.  The only way you can examine a buffer is to put it (using 
p or P) into the file.  If you put extra lines into a file to check buffer 
contents, you can just delete them from the file; they will stay safely in 
the buffer.

Questions? Robert Katz:rkatz@ned.highline.edu
Last Update July 16, 2002