Recording a Macro

See Also

A macro consists of a series of commonly used keystroke combinations, which are invoked by a simpler keystroke combination. You can define a macro by recording a series of keystrokes. The recorded macros is available for all other files of the same type.

To record a Source Editor macro:

  1. Open a file in the Source Editor.
  2. Determine the keystroke sequence required to repeat the task you want your macro to accomplish. It might be helpful to write this sequence down before recording your macro.

    You should not use the mouse while recording a macro. If any of the steps of your macro cannot be done with a keyboard shortcut, create a shortcut for that step as described in Setting Keyboard Shortcuts.

  3. Position the insertion point in the Source Editor where you want to begin recording your macro.
  4. Type Ctrl-J, S to start recording.

    "Recording" appears in the Source Editor status line.

  5. Use keystrokes to perform the steps of your macro.
  6. Type Ctrl-J, E to end recording.

    The Recorded Macro dialog box is displayed.

  7. Type a name for your macro in the Name field.
  8. If desired, edit the keystroke sequence shown in the Macro field. This displays the actions taken during the macro recording and playback. These actions are simple keystrokes in quotes, keyboard shortcuts, or a combination of both.
  9. Click the Add button.

    The Add Keybinding dialog box is displayed.Press the key sequence you want to use to run this macro in the Shortcut Sequence field, and click OK.

    As you press the key sequence, the correct syntax for that sequence automatically appears in the text field. For example, if you simultaneously hold down the Alt key, the Control key, and the J key, "Ctrl+Alt+J" appears.

  10. Click OK in the Recorded Macro dialog box. Your macro can now be run using the keyboard shortcut you specified in the previous step.
See Also
Editing a Macro
Running a Macro
Using Code Completion
Sharing Source Editor Settings

Legal Notices