VIM: how to append yanked text to unnamed register

  1. Pick a free register among a-z (I prefer the register a)
  2. "ay{motion}
  3. "Ay{motion} ... (to append)
  4. Now you have all the yanked text in register a.
  5. And you have the same content in unnamed register as well!

(I happened to find that the unnamed register is synchronized to the named register in such operation.)

The benefit is ... You saves 2 keystrokes to put. ^_^

See h: quote_quote

NB: For operations d, c, s, x, you won't get the same appended text in the unnamed register as in the named register if you are using v7.4. (It's a bug, fixed in v8.0)


You can use this

:let @"=@".getline('.')

to append to the unnamed register. I do not believe there is a keyboard shortcut to do this. (However you could create a mapping if you wanted.)


The reason I say that there is no keyboard shortcut for this is because :h quote_alpha only talks about uppercase letters (for appending). And there is no equivalent statement in :h quote_quote

Tags:

Vim