How to use register with CTRL-A or CTRL-X in vim

Posted by Luc M on Super User See other posts from Super User or by Luc M
Published on 2012-06-11T21:02:15Z Indexed on 2012/06/12 4:42 UTC
Read the original article Hit count: 423

Filed under:

Suppose that I have a number into register r.

How could I use this value with CTRLA and CTRLX

Here's an example to make it clearer:

Suppose that I have this text file:

10
13
15

I want to to increase those numbers with the value in register r to obtain (if it contains 5)

15
18
20

Why I'm asking it ? Because I want to use CTRLA into a macro but the number of time that I need to apply CTRLA is only know at "run time".

In a more general way, how could I execute a command a number of times stored in a register ?

All of these questions and answers where interesting but they don't answer my question:
http://stackoverflow.com/questions/1497958/how-to-use-vim-registers
http://stackoverflow.com/questions/2405952/vim-register-use-in-ex-mode

© Super User or respective owner

Related posts about vim