Have you tried just doing the following?
{
"cmd": ["gcc", "-o", "$file_base_name", "$file"],
"variants": [
{
"cmd": ["gcc", "-o", "$file_base_name", "$file", "&&", "start", "cmd", "/k", "$file_base_name"],
"shell": true,
"name": "Run"
}
]
}
&&
works the same way on the Windows cmd
command line as it does in Unix/Linux shells. Unfortunately, if you're just reading out the results of your build command in the bottom pane of Sublime, &&
doesn't seem to work, at least on the latest build of ST3 on Win8. So, you can just fall back to a good old batch file:
@echo off
gcc -o %1 %2
%1
Save this someplace in your PATH
as buildandrun.bat
. Next, create a new build system:
{
"cmd": ["buildandrun.bat", "$file_base_name", "$file"],
"selector": "source.c"
}
and save it as %APPDATA%\Sublime Text 3\Packages\User\buildandrun.sublime-build
. Select your source file in Sublime, go to Tools -> Build System
and select buildandrun
down at the bottom, then hit CtrlB to build.