I'm using SublimeText-3 on macOS to do C++ programming, trying to take advantage of the build feature.
In this context I'll expect to (only) build my program by doing Cmd+B. And Cmd+Shift+B will run it.
But when I hit Cmd+B both happen, build and run.
Here are the contents of C++ Single File.sublime-build
:
{
"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",
"shell_cmd": "g++ -std=c++14 \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
}
]
}
Anything strange in it?
How do I split build and run to different commands?
Some reference: Sublime text 3 - compile program and run in terminal
In Preferences - Key Bindings I see:
{ "keys": ["f7"], "command": "build" },
{ "keys": ["super+b"], "command": "build" },
{ "keys": ["super+shift+b"], "command": "build", "args": {"select": true} },
I think it's ok.