简体   繁体   中英

Sublime Text Command Palette for playing macro

Is it possible to play a saved macro using the command palette?

I know that it is possible to assign a keyboard shortcut to a macro but that is another thing to remember and not very feasible when you have more than a few macros.

Yes, it is possible. You need to save your macro to a file at ../sublime-text-3/Packages/User/ YOUR_MACRO_NAME .sublime-macro. Then add the following code to file ../sublime-text-3/Packages/User/Default.sublime-commands:

[
    {
    "caption": "ADD TEXT TO BE DISPLAYED ON COMMAND PALETTE",
    "command": "run_macro_file",
    "args":
        {
            "file": "res://Packages/User/YOUR_MACRO_NAME.sublime-macro"
        }
    }
]

I haven't been able to run a macro from the command palette but I have found the Macroptimize package to be helpful in running my macros - one hotkey gives you a list of defined macros to choose from. Not quite what you're looking for but perhaps it will be helpful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM