In some of my programming, off late, I have often had to manually enter in the values of a long std::vector. So for a vector of size 30, I have to keep typing
myvec[0]=1.0;
myvec[1]=4.6;
myvec[2]=6.7;
myvec[3]=7.8;
.
.
myvec[29]=87;
I use Emacs as a text editor. Is it possible in Emacs for me to somehow specify that say from lines 30 to 59 insert the lines
myvec[0]= ;
myvec[1]= ;
myvec[2]= ;
.
.
myvec[29]= ;
The individual values of the vector will of course have to be manually entered, but it would save me a lot of typing or copy/pasting myvec[] again and again.
Keyboard Macros is
the simpler way to do it.
C-x(
myvec[C-xC-kC-i]RETC-x)= ;
inserts and increments the counter
definition
And then
M-3M-9C-xe
C-u
39and is used to send39as anargument
recorded
Thus the combination of both executes the macro 39 times.
You can also look in the manual to see how you can save them and edit them.