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

Chain of Command

by jisaacks ST2/ST3

Sublime text plugin to run a chain of commands

Details

  • 2014.01.26.09.05.33
  • github.​com
  • github.​com
  • 4 years ago
  • 16 hours ago
  • 4 years ago

Installs

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

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.