Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combining registers in vim

Is it possible to combine registers in vim? For example, if I have registers "a, "b, "c, can I easily create register "d which is a concatenation of all three? That is, without pasting them all and then selecting the whole thing.

like image 748
Marcin Avatar asked Oct 26 '09 20:10

Marcin


2 Answers

With the command :let @a = "something" you can assign to a register.

With the command :let @A = "another thing" or :let @a .= "another thing" you can append to a register.

Lets say your registers are filled as follows (inspected using the reg command)

:reg a b c
--- Registers ---
"a Apple^J
"b Pear^J
"c Banana^J

Then you can call

:let @D = @a
:let @D = @b
:ley @D = @c

or

:let @d = @a . @b . @c

And your register d looks like

:reg d
--- Registers ---
"d Apple^JPear^JBanana
like image 132
pkit Avatar answered Sep 28 '22 07:09

pkit


:let @d = @a . @b . @c
like image 24
ephemient Avatar answered Sep 28 '22 08:09

ephemient