In my C
code I am dealing with many variables of type
RxMsgType0
RxMsgType1
RxMsgType2
RxMsgType3
...
My Question: Is there a way in VIM by which I can create 4 more variables which follow the same format?
Expected output: [Type Some Command]
RxMsgType4
RxMsgType5
RxMsgType6
RxMsgType7
In the future I would like to pass the
name (RxMsgType assumed here )
number( we assumed 4 here)
as an argument to get the variable names formed.
That is my final aim.
i
and so put in your vimrc :let @i='yyp^A'
where^A
is the actualCTRL-A
character that you can insert with<c-v><c-a>
. Than you can do[count]@i
. Note that this increases the first number on the line. If you have a more complex line, add a line-motion betweenyyp
and^A
to place your cursor in the right spot. Also consider looking:help nrformats
let @i = "yyp\<C-A>"
, using double quotes allow using\<...>
to refer to keystrokes by name, so no need to insert a special character in vimrc for that. Using a mapping is also possible (though I actually quite like the idea of the dedicated register!)RxMsgType4
toRxMsgType[4]
:-P