Keywords: xcoral

Next: Undo redo Up: Editing Previous: Mark and region

# Macros

A macro memorizes a sequence of commands.

- Ctrl-x ( starts a macro definition in the current window. The following commands are saved during their execution. Simultaneously the message Learn macro is displayed.

  Attention During macro definition you can switch to another window but in this case the macro definition is suspended until you move the pointer back to the window where you started the macro.

- Ctrl-x ) ends the macro definition. It is available from any text window.
- Ctrl-c plays the macro. All commands previously recorded are executed in order. With the commands Esc digits then Ctrl-c, the macro is played num times (see §2.7 page ).

Example:

In a buffer of 100 lines, you want to add an 'X' at the beginning of each line and an 'Y' at the end of each line. The following macro does this work: at the beginning of the first line type the following sequence: Ctrl-x ( X Ctrl-e Y Ctrl-f Ctrl-x ). Then Esc 99 and Ctrl-c.

Attention A macro can include only one search command. If you want to use several search commands or more generally, if you want to implement a complex macro, it is better to write a Smac function (see §4.9 page ).