vim copy paste registers

vim_compThere’s an excellent way of storing yanked buffers in vim using numbered registers and named registers giving you a total of 36 buffers to bookmark your copied information and remember them as long as you don’t use the same register once again. This extends the regular yy/cc/dd/p/P… combinations that we use to yank/paste the default register.

numbered registers: "0 to "9 (total 10)
named registers: "a to "z OR "A to "Z (total 26)

Usage (applies to all the shortcuts yy, cc, dd, p, P):

  1. to copy 10 lines from the current line into the named register a, press "a10yy in vim command mode. Same for numbered registers, just replace a with the number of choice, for example "710yy.
  2. to paste the buffered line(s), paste "ap or "7P etc. again in the command mode.

Wait! There are some special registers too:

"" : the last defined register
": : the last entered command
"% : name of the file currently opened
"* : copy to system clipboard (X)
"+ : similar to "*

To see all the currently set registers, use :reg. To know more about registers type in

:help registers

2 thoughts on “vim copy paste registers”

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s