Is it possible to chain key binding commands in sublime text 2?

Although the question is a year old, this might help people that are still looking for an answer.

Recently, a new package was developed by jisaacks, called Chain of command. It has the primary task to do exactly what you request, to chain several commands at once.

The package can be found here:
https://github.com/jisaacks/ChainOfCommand

An example of the working can be found below.

Let’s 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.

Source: https://sublime.wbond.net/packages/Chain%20of%20Command.

Leave a Comment