vi Buffers
Linux Commands - Shells

 

There are 27 buffers in the vi editor.  The Unnamed buffer in the table above is often used however there are 26 other buffers.  The other 26 are the "named" buffers. Conveniently, they're named after the 26 letters of the alphabet.

There are two options for using a named buffer. If you use a lower-case letter, you'll overwrite the contents of that buffer. If you use an upper-case letter, you'll append to the contents of that buffer.

Lesson 2 | Lesson 4



To use a named buffer, just put a " and a letter of the alphabet in front of the editing commands that you saw on the last page. For example, if you want to cut a line of text to buffer a, just enter

"add

To copy a line of text to buffer b, enter:
"byy

To copy eight words to the end of buffer c, enter:

"C8yw

To paste the contents of buffer c to the right of the cursor, enter:

"cp

For paste operations, it doesn't matter whether you use a lower or upper-case letter in the buffer name.

Just try to come up with a system to keep track of what you have in all of your buffers.

You're probably wondering why you have to precede these commands with a quote symbol. That's because, if you strike certain letter keys without striking the quote symbol first, you'll switch vi into "insert" mode.

 


Copyright CyberMontana Inc. and BeginLinux.com
All rights reserved. Cannot be reproduced without written permission. Box 1262 Trout Creek, MT 59874