Accessing Register Contents

Now that we have learned how to yank text into a named register and review register contents, lets see how to retrieve values from registers.

Similar to the pattern for yanking text into a register, the pattern for accessing text in a register is:

"{name}

So, to paste the contents of register a into the buffer we would execute "ap.

To demonstrate, consider the following buffer and cursor position.

Initial buffer content
Beautiful·is·better·than·ugly.
Explicit·is·better·than·implicit.
Simple·is·better·than·complex.
Complex·is·better·than·complicated.
NORMAL
Top
1:1
 

Our goal is to move the first line to the bottom of the buffer. We will accomplish this in a few steps. First, we will enter visual-line mode using V, then delete the selection and store it in register a using "ad:

Select and delete line
V"ad
Explicit·is·better·than·implicit.
Simple·is·better·than·complex.
Complex·is·better·than·complicated.
NORMAL
Top
1:1
 

Now move the cursor to the bottom of the buffer using G

Move to bottom of buffer
G
Explicit·is·better·than·implicit.
Simple·is·better·than·complex.
Complex·is·better·than·complicated.
NORMAL
75%
3:1
 

and finally paste from register a:

Paste from register a
"ap
Explicit·is·better·than·implicit.
Simple·is·better·than·complex.
Complex·is·better·than·complicated.
Beautiful·is·better·than·ugly.
NORMAL
80%
4:1