Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy from one register to another

How to copy the contents of one register to another without pasting on clipboard? I'd yanked one text and it got yanked in the default " register. Now I want to copy another text without deleting/overwriting " register. So I want to move the contents of " register to say some a or b register so that I can copy the new text inside ". How to do this?

like image 521
bluegenetic Avatar asked Oct 01 '09 06:10

bluegenetic


2 Answers

To copy or swap values between registers you can use the :let command, for example to copy the contents of the b register to a:

:let @a=@b

Or copy the contents of the " register to a:

:let @a=@"

Check this Vim Tip for some good key mapping suggestions:

  • Comfortable handling of registers
like image 174
Christian C. Salvadó Avatar answered Nov 03 '22 23:11

Christian C. Salvadó


You can do something like this:

let @a = getreg('"')

That'll copy the " register to the a register.

like image 40
derobert Avatar answered Nov 03 '22 21:11

derobert