Решил доработкой одного маленького плагина
UPD 17.05.2018import sublime
import sublime_plugin
class RunMultipleCommand(sublime_plugin.TextCommand):
def exec_command(self, command, syntax):
if not 'command' in command:
raise Exception('No command name provided.')
if 'syntax' in command:
for s in command['syntax']:
if syntax.find(s) > -1:
break
else:
return False
args = None
if 'args' in command:
args = command['args']
# default context is the view since it's easiest to get the other contexts
# from the view
context = self.view
if 'context' in command:
context_name = command['context']
if context_name == 'window':
context = context.window()
elif context_name == 'app':
context = sublime
elif context_name == 'text':
pass
else:
raise Exception('Invalid command context "'+context_name+'".')
# skip args if not needed
if args is None:
context.run_command(command['command'])
else:
context.run_command(command['command'], args)
return True
def run(self, edit, commands=None):
if commands is None:
return # not an error
syntax = self.view.settings().get('syntax').split('/')[-1].lower()
for command in commands:
if self.exec_command(command, syntax) and command['end']:
return
Добавил возможность обрыва цепочки команд при помощи end:true
[
{
"keys": ["ctrl+d"],
"command": "run_multiple",
"args":
{
"commands": [
{
"syntax": ["python"],
"command": "auto_pep8",
"args":
{
"preview": false
},
"end": true
},
{
"syntax": ["css", "scss", "less", "sass"],
"command": "css_comb",
"end": true
},
{
"syntax": ["php"],
"command": "code_formatter",
"end": true
},
{
"syntax": ["html", "xml", "json"],
"command": "htmlprettify",
"end": true
},
{
"syntax": ["javascript", "typescript"],
"command": "typescript_format_document",
"end": true
}]
}
},
{
"keys": ["ctrl+shift+c"],
"command": "color_highlighter_pick_color",
"context": [
{
"key": "color_highlighter.color_highlighter_pick_color"
}]
}]