Key binding. How to run a external script (external command/program) in sublime text 2 when pressing a key?

exec, keyboard, shortcut, sublimetext2

Solution

Here is a solution:

Preferences->Key Bindings - User and put this in the file (overriding the `[`,`]` inside):

[
    { "keys": ["<your shortucut>"], "command": "exec", "args": { "cmd": ["<path to your script>"]} }
]

Where `<your shortcut>` as the name says is the shortcut (examples: F1, ctrl+shift+F1, etc.) and `<path to your command>` is the location of your command (examples: `echo`, `/home/user/scripts/my_script.py`, `ls`, etc.)

Problem

I would like to run a external python script (or external command/program) when I press a key on Sublime Text 2. How can I do this?

Original source