After writing my first Sublime Text macro and storing it to a .sublime-macro
file, I expected to be able to load it to the Playback Macro
button. Unfortunately I haven't found out how to do this and didn't find it under the (un)offical documentation.
Recoding the macro while playing it with Tools/Macros/User/MyMacro
worked, but I expect there is a more straightforward method.
What would be the proper way to load a macro?
As far as I know, if you create a .sublime-macro
file manually, then you can't use the Tools -> Playback Macro
option to activate simply because it is not recorded (but something you manually created, which should be listed in Tools -> Macros
depending on where you stored it in Packages
).
The option Tools -> Record Macro
will record a macro (for the current view) and you play it by using Tools -> Playback Macro
(& optionally save it using Tools -> Save Macro...
). As far as I can see, the recorded macro will vanish (if not saved) when you close the window (which might mean it's kind of an in memory thing).
If you want to use a macro with a key binding, then there is a command run_macro_file
. As an example
{
"keys": ["ctrl+shift+alt+5"],
"command": "run_macro_file",
"args": {
"file": "res://Packages/User/MyMacro.sublime-macro"
},
},