I believe that the lack of the exec
command is due to the fact that Merge doesn’t support plugins yet (although it is on the roadmap) and the exec
command from Sublime is defined in a plugin. I don’t think Merge has the ability to execute arbitrary programs directly, but you can use it to execute git
commands, and you can set up arbitrary git aliases to do pretty much whatever you want, so that might help you out.
For example, I created /home/tmartin/test.py
with the following content and made it executable:
#!/bin/env python3
import sys
print("I'm a python script running for '%s'" % sys.argv[1])
I then set up an alias named script
to invoke it in my git config:
[alias]
script = "!f() { /home/tmartin/test.py $1; }; f"
I then set up a File.sublime-menu
file in my merge User
package like so:
[
{ "caption": "-" },
{
"caption": "Run my script",
"command": "git", "args": {
"argv": ["script", "$path"]
}
},
]
This uses the internal git
command to execute git with any arguments you provide, which here are the alias script
and also the path of the current file.
So now the command is in the menu:
After picking the command, you can click the Show Git Output
button in the header (to the left of the branch name) to see what it did:
I’ve never done anything like this on Windows or MacOS, but I would imagine that git should support aliases for them in the same way.