I know VIm has multiple registers, but I don't use them enough. I use some clipboard managers that essentially solve the same problem OS-wide (though the solution isn't as slick as VIm's), but there are still times where I need the same level of control with my "intra-vim" clipboards.

Here's a great overview from StackOverflow, edited slightly to use register a instead of k:

Registers in Vim let you run actions or commands on text stored within them. To access a register, you type "a before a command, where a is the name of a register. If you want to copy the current line into register a, you can type

"ayy

Or you can append to a register by using a capital letter

"Ayy

You can then move through the document and paste it elsewhere using

"ap

I think the key for me was remembering that, in VIm-language, " is means select register and not pick an action with which to use a register. (I kept entering these patterns in reverse when I tried without looking the syntax back up.)

That is, the command is:

  1. " - select register
  2. a - name of register
  3. p - action (here, paste)

Labels: