Sublime Forum

A macro surrounding my selection

#1

I want a macro that “Surrounds” my selection, so I can select a block of code and surround it in an if(debug) (Or just insert the if(debug) if there’s nothing selected)

The macro I have is similar to this:

[
    {
        "args":
        {
            "characters": "\nif (debug) "
        },
        "command": "insert"
    },
    {
        "args":
        {
            "contents": "{${0:$SELECTION}}"
        },
        "command": "insert_snippet"
    },
    {
        "args":
        {
            "file": "res://Packages/Default/Add Line in Braces.sublime-macro"
        },
        "command": "run_macro_file"
    }
]
1 Like