Sublime Forum

Launching a program from keyboard binding


I’m configuring my setup for quick note taking in LaTeX, and I’ve settled on ipe to draw figures. I’ve tried to figure out how to launch this quickly with a keyboard shortcut from Sublime itself. How might I go about this? I’ve looked through the manual, but haven’t been able to find anything about launching an application. Am I missing something?



There is a built in command called exec that can launch an external program. It’s used by build systems to execute external tools. If you look in the documentation on build systems, the exec target options section lists the arguments that you can provide to the exec command, except that the variables like $file and such don’t work outside of a build system without some extra help.

So for example, you could create a binding such as the following:

    "keys": ["ctrl+shift+alt+t"],
    "command": "exec",
    "args": {
        "shell_cmd": "xterm",

Whatever you pass in shell_cmd is executed as if you entered that command from the terminal; in this case the Linux xterm command to open a command prompt.