Sublime Text 2 在 CMD 中执行代码

Python.sublime-build

{
    "cmd": ["python", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",
    "encoding":"utf-8",
    "variants": 
    [
        {
            "name": "Run", 
            "shell": true,
            "cmd" : ["start", "cmd", "/k", "python", "${file_path}/${file_base_name}.py"] 
        }
    ]
}

Ruby.sublime-build

{
    "cmd": ["ruby", "$file"],
    "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
    "selector": "source.ruby",
    "encoding":"utf-8",
    "variants": 
    [
        {
            "name": "Run", 
            "shell": true,
            "cmd" : ["start", "cmd", "/k", "ruby", "${file_base_name}.rb"] 
        }
    ]
}

C++.sublime-build

{
    "cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c, source.c++",
    "encoding":"cp936",
    "variants":
    [
        {
            "name": "Run", 
            "shell": true,
            "cmd" : ["start", "cmd", "/k", "${file_path}/${file_base_name} &&echo. & pause && exit"] 
        }
    ]
}

JavaC.sublime-build

{
    "cmd": ["javac", "-encoding", "utf-8", "$file"],
    "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
    "selector": "source.java",
    "encoding":"utf-8",
    "variants": 
    [
        {
            "name": "Run", 
            "shell": true,
            "cmd" : ["start", "cmd", "/k", "java", "${file_base_name}"] 
        }
    ]
}
    原文作者:WenryXu
    原文地址: https://segmentfault.com/a/1190000000480773
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞