Cpp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
    "cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && open '${file_path}/${file_base_name}'"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c, source.c++",

    "variants":
    [
        {
            "name": "Run",
            "cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'<'${file_path}/${file_base_name}.in'>'${file_path}/${file_base_name}.out'"]
        }
    ]
}

Python

1
2
3
4
5
6
7
8
9
10
11
12
{
    "cmd": ["bash", "-c", "python -u '${file}' && chmod a+x '${file}' && open -a terminal '${file}'"],
    "selector": "source.python",

    "variants":
    [
        {
            "name": "Run",
            "cmd": ["bash", "-c", "python -u '${file}' && chmod a+x '${file}' && '${file}'<'${file_path}/${file_base_name}.in'>'${file_path}/${file_base_name}.out'"]
        }
    ]
}

Java

1
2
3
4
5
{
    "cmd": ["bash", "-c", "javac '${file}' && java '${file_base_name}'"],
    "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
    "selector": "source.java, source.java"
}

Conclusion

For cpp & python, the build-system can open a new terminal window, so I can interact(ep. input) with my program easily.

For java, I don’t know how to do that, only can show the outputs yet.