ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Chain of Command

by jisaacks ALL

Sublime text plugin to run a chain of commands

Details

  • 2014.01.26.09.05.33
  • github.​com
  • github.​com
  • 11 years ago
  • 28 minutes ago
  • 11 years ago

Installs

  • Total 18K
  • Win 9K
  • Mac 6K
  • Linux 3K
Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11
Windows 0 2 2 4 1 0 1 1 0 4 0 5 0 1 2 0 3 0 0 0 0 0 0 0 1 4 0 1 0 2 0 0 0 0 1 0 0 2 1 1 0 0 1 2 0 3
Mac 0 1 0 1 0 0 0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
Linux 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 1 1

Readme

Source
raw.​githubusercontent.​com

Chain of Command

Sublime text plugin to run a chain of commands


Usage

To run a chain of commands you run the chain window commands and pass it a list of commands to run. Each command is defined as a list where the first argument is the name of the command to run and any additional arguments will be passed directly to the command.

For example, to run the select_all command and then run the copy command you would call:

window.run_command("chain",{"commands":[["select_all"],["copy"]]})

Or if you wanted to focus the first group in a window:

window.run_command("chain",{"commands":[["focus_group",{"group":0}]]})

The point is to be able to build custom key bindings to run a sequence of commands. Lets say you wanted a key binding to duplicate the current file. You could set this key binding:

{
  "keys": ["super+shift+option+d"], 
  "command": "chain", 
  "args": {
    "commands": [
      ["select_all"],
      ["copy"],
      ["new_file"],
      ["paste"],
      ["save"]
    ]
  }
}

This would select all the text, copy it, create a new file, paste the text, then open the save file dialog.