skuroda / ImprovedMacros

MIT License
12 stars 2 forks source link

ImprovedMacros

This plugin is incomplete. Macro recording, which is the general goal of this plugin, is not yet complete. However, the ability to manually define macros via a file or as a key binding argument is functional.

Installation

Note it may be necessary to restart the editor after installing the plugin.

Package Control

Installation through package control is recommended. It will handle updating your packages as they become available. To install, do the following.

Manual

Clone or copy this repository into the packages directory. By default, the Package directory is located at:

or

Usage

Macros can be define as part of a key binding, or in a file. The content of args for a key binding will match what is defined in a file.

Commands

Below are the commands currently exposed.

Defining a macro

Sample usage

Below is an example of run_multiple_commands

{
    "keys": ["f12"], "command": "run_multiple_commands",
    "args": {
        "commands": [{
            "context": "window",
            "command": "next_view"
        },{
            "context": "view",
            "command": "insert",
            "args": {
                "characters": "qwerty"
            },
            "delay": 1000
        }]
    }
 }

Below is an example of run_multiple_commands_from_file. First is a key binding entry. Note that file name can either be Packages/<package name>/<macro name> or an absolute path.

{
    "keys": ["f11"], "command": "run_multiple_commands_from_file",
    "args": {
        "file_name": "Packages/User/test.macro"
    }
}

Below is the content of test.macro

[{
    "context": "window",
    "command": "next_view"
}, {
    "context": "view",
    "command": "insert",
    "args": {
        "characters": "qwerty"
    },
    "delay": 1000
}]

Notes

Thank you to sashabe and nilium from the ST forum.