Someone over at the sublimetext channel on the freenode irc helped me out and answered my questions (shoutout to them on stackoverflow @Zren). Here is the final working script:
Description
- Ctrl+b compiles the "C" script using Cygwin (with the flags -std=c89, -pedantic, -Wall)
- If there are any errors you can see them underneath your code straight in the Sublime integrated window
- Press f4 and shift-f4 to navigate through them in Sublime Text
- If there are no errors it says finished in so and so seconds
- Ctrl+shift+b runs the script, it opens command prompt in a new window and runs the script there, and you can give input (Yay! :))
Code
{
"cmd" : ["gcc", "-std=c89", "-pedantic", "-Wall", "$file_name", "-o", "${file_base_name}.exe"],
"selector" : "source.c",
"path" : "C:/cygwin64/bin/",
"shell":true,
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"variants": [
{
"cmd": ["start", "cmd", "/k", "${file_base_name}.exe"],
"name": "Run",
"shell": true
}
]
}
In the future
Hopefully Google can lead people here since Sublime Text 2 documentation is very poor, and I don't want anybody else to struggle with this simple yet time consuming problem.
Tags: Sublime Text 2, gcc, cygwin, build, c, input, Windows