vi Macros

Some special macro variables exist as well, see the macros.xml file. These variables can be used inside macros, or entered on the vi bar. When used inside macros, they are expanded when playing back.

Macros can refer to template files, giving you a possibiliy to e.g. create header files.

You can also record and playback macros from the menu bar. In that case macro names are not limited to one character.

You might add a macro to do a substitute on all open pages by pressing:

qa
:%s/xxx/YYY/gc
:n
q

Then, after pressing 100@a, this macro is run 100 times, to substitute in (at most) 100 open files, it stops at the last tab.

You can also add a macro to update column numbers. If you have the following columns:

age income
20 1000
21 1010
22 1020
23 1030
24 1040

The next macro increments the income on current line with 100, and moves to the next line:

qb
w
"x
yw
cw
^R=^Rx+100
ESCAPE
0j
q