Lets say I wrote a simple CSS rule like this:
.star_10 {
background: url(stars.png) no-repeat 0 0;
}
And I need 10, so I copied it 9 times.>
You can do it easily with a macro. Lets say you have only this:
.star_10 {
background: url(stars.png) no-repeat 0 0;
}
Place your cursor over the first dot (in .star10
) and type the following in normal mode:
qa3yy3jp^Xjt;18^Xk0q
Explaining:
qa
will start a macro recording in register "a".3yy
will yank (copy) the following 3 lines.3j
will place the cursor 3 lines down.p
will paste the past yanked text.^X
(ctrl+x) will decrement the star class number.j
will place your cursor one line down.t;
will place your cursor before the next ;
in the current line.18^X
will decrement the y coordinate of backround by 18;k
will put the cursor one line up,0
will put the cursor at the beggining of the line.q
will finish the macro recording.After that, you may have something like this.
.star_10 {
background: url(stars.png) no-repeat 0 0;
}
.star_9 {
background: url(stars.png) no-repeat 0 -18;
}
That's it. Just place your cursor at the dot on .star_9 and press 8@a
to execute the macro recorded in register a
eight more times.