Macros are the basic automation facility that includes a sequence of commands. You can use macros whenever you need to perform an operation which includes same steps.
Macro files are JSON files with an extension called .sublime-micro and are considered to be very helpful.
Recording a macro defines the procedure to keep a set of commands needed for the given file. You can record a macro in two ways −
Use the shortcut key Ctrl+Q for recording a macro in Windows and Cmd+Q in Mac.
Use the record option in Tools → Record Macro.
Once the macro has started recording, you can see the following message in Sublime Text editor −
You can use the shortcut key Ctrl+Shift+Q on Windows and Cmd+Shift+Q for Mac, to play a macro recorded by the user in Sublime Text. Note that this shortcut plays the last recorded macro in Sublime.
You can save a recorded macro using the option Tools → Save Macro. The following screenshot shows how to save a macro using this option.
You can also redefine the macros using various options in Tool menu bar, as shown below −