Indiana University
University Information Technology Services
  
What are archived documents?
Login>>
Login

Login is for authorized groups (e.g., UITS, OVPIT, and TCC) that need access to specialized Knowledge Base documents. Otherwise, simply use the Knowledge Base without logging in.

Close

In vi, how do I name cut buffers?

In vi, you can use the double quote ( " ) operator to name cut buffers. For example, you could type the double quote character, then the letter  e , then use dd to delete a line: "edd

Until you exit vi, you can paste that deleted line by typing the double quote character, then the letter  e , then  p : "ep

You can use this operation preceding any delete, yank, or paste command in vi to save or recall any text you like. This is particularly handy if you're cutting and pasting between two files. For example, you can start vi with the command: vi oldfile newfile

Then, if you want to cut the first three lines from oldfile and put them in newfile, use the following commands:

Command Action
"z3yy Place three lines in cut buffer 'z'
3dd Delete the lines
:w Write the file out
:n Edit the next file
"zP Put or paste the lines above the first line
:w Write the file out
:e # Go back to the previous file you were editing

At Indiana University, for personal or departmental Linux or Unix systems support, see At IU, how do I get support for Linux or Unix?

This is document adyb in domain all.
Last modified on August 22, 2008.

Comments/Questions/Corrections

Use this form to offer suggestions, corrections, and additions to the Knowledge Base. We welcome your input!

If you are affiliated with Indiana University and would like assistance with a specific computing problem, please use the Ask a Consultant form, or contact your campus Support Center.

Contact Information

Note: We will reply to your comment at this address. If your message concerns a problem receiving email, please enter an alternate email address.