Sublime Forum

Run specific command or macros on all opened file,- any suggestion?

#1

Any way to run specific command or macros on all opened files?

0 Likes

#2

There are ways to do that, though they require either a plugin or to enter some Python code in the console.

Do you want to do this frequently, or is it just a one off kind of thing?

0 Likes

#3

Sometimes edit lot of subtitles.
I want to find way to call commands from .py to all opened sheets.

Some example (template) with simple command that can be modified…

For now there is my solution, to join in to one line.

{   "caption": "multiple_commands:  ",
    "keys": ["f3"],
    "command": "run_multiple_commandss",
    "args": {
      "commands":[ 
        { //"caption": "find: ", 
                        "command": "show_panel", 
                            "args": {
                            "panel": "find",
                            "pattern": " --> ", 

                            "regex": true, 
                            "reverse": false,
                            "in_selection": false,
                            "highlight": true,
                            // "whole_word": false,
                            "case_sensitive": true,
                            "wrap": true
                                    }, 
                            "context": "window",
                            "delay":0
                        },

        {"command": "find_all", "args": {"close_panel": true}, "context": "window","delay":0},
        {"command": "simple_movement_eol",  "args":  {"extend": false}},
        {"command": "move",  "args": {"by": "characters", "forward": true}},
        {"command": "select_until",  "args": {"extend": true } }, 
        {"command": "insert_snippet","args": {"contents": "/\n$/"}, "context": "window"},
        {"command": "select", "context": "window"},
        {"command": "reverse_selection_direction", "context": "window","delay":100},
        {"command": "move",  "args":  {"by": "characters", "forward": false, "extend":true}, "context": "window","delay":100},
        {"command": "reg_replace",  "args":  {"replacements": ["line_Join_with_space"]}, "context": "window","delay":110},
    ]}},
0 Likes