I’m a little confused by something in ST3, and I’m not sure if the (unofficial) docs are wrong or I’m just
having a problem with the context that it’s talking about or what.
I"m trying to set up a key shortcut that will invoke an application that’s part of the project that I’m working on with the current file as an argument. I found this post from three years ago where someone was trying something similar but it seemed at the time that there was no recourse but to create a plugin to do it, which seems wrong somehow.
My key binding attempt is:
{
"keys": ["ctrl+shift+alt+l"],
"command": "exec",
"args":
{
"cmd": ["$project_dir/Bin/dmlua", "$file"],
"working_dir": "$file_path",
"shell": true
},
"context":
[
{ "key": "setting.datamill", "operator": "equal", "operand": true },
{ "key": "selector", "operator": "equal", "operand": "source.lua" }
]
}
However when invoked, I get an error:
FileNotFoundError: [Errno 2] No such file or directory: '$file_path'
Naturally, if I remove the working_dir, then it can’t find the executable, and if I put the executable in
the path, it can’t file $file.
Is this really something that’s not possible without having to resort to using a plugin? The unofficial documentation page on commands says:
The same variables available to build systems are expanded in arguments to commands. See Build System Variables for more information.
So it seems like this should actually work, but it doesn’t. Am I just misunderstanding here? Do I really have
to go the plugin route for this? I’m not averse to that, just want to clarify that I’m either the docs are wrong or (more likely) I’m not understanding what they’re telling me.