sublime搭建c++/java/lua/python/ruby的配置文件

本人电脑win7 64位

提前装一下convert to utf-8插件,编译运行出现乱码,组合键ctrl+shift+c把源文件转成gbk编码. 仍乱码的话,重启编辑器|电脑|重新编辑中文部分。

c++

{

"working_dir": "$file_path",

"cmd": "g++ -Wall -fexec-charset=GBK \"$file_name\" -o \"$file_base_name\"",

"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",

"selector": "source.c",

"variants":

[

{

"name": "Run",

"shell_cmd": "g++ -Wall -fexec-charset=GBK \"$file\" -o \"$file_base_name\" && start cmd /c \"\"${file_path}/${file_base_name}\" & pause\""

}

]

}

java

{
    "cmd": ["cmd","/c","javac -encoding gbk -d . ${file}"],
    "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
    "selector": "source.java",
    "encoding":"gbk",
    "variants": [{
        "name": "Run",
        "shell": true,
        "encoding":"gbk",
        "cmd": ["start", "cmd", "/c", "java ${file_base_name} & pause"],
        "working_dir": "${file_path}",
    }]
}

lua

{
    "cmd": ["cmd","/c","start","cmd","/c","lua ${file} & pause"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.lua",
}

php

{
    "cmd": ["cmd","/c","start","cmd","/c", "C:/wamp/bin/php/php5.5.12/php.exe $file & pause"],
    "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
    "selector": "source.php",
    "encoding":"gbk"
}

python

{
    "cmd": ["cmd","/c","start","cmd","/c","python ${file} & pause"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.py",
}

ruby

{
    "cmd": ["cmd","/c","start","cmd","/c","ruby ${file} & pause"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.rb",
}