内容目录
c++
{ "cmd": ["g++", "${file}","-std=c++11", "-stdlib=libc++", "-o", "${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}' -std=c++11 -stdlib=libc++ -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"] } ] }
java
{ "shell_cmd": "javac -encoding utf-8 $file_name && java $file_base_name", "file_regex": "^ *\\[javac\\] (.+):([0-9]+):() (.*)$", "selector": "source.java", "encoding": "gbk", "variants": [ { "name": "Run", "cmd": ["bash", "-c", "java '${file}' '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"] }] }
python
{ "shell_cmd": "python $file_name", "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.py", "variants": [ { "name": "Run", "cmd": ["bash", "-c", "python '${file}' "] }] }
若想从终端中运行c++程序 配置如下
{ "cmd": ["g++", "${file}", "-o", "${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}' && open '${file_path}/${file_base_name}'"] }] }
注意运行的是Run内cmd 编译不可用 需要执行sublime 运行命令 不知为何 注意cmd语法
终端下显示python的一个方法
{ "cmd": "python '${file_path}/${file_base_name}'", // "shell_cmd": "cd '' && '/usr/bin/pythonw' '$file_name' && echo Exit status: $? && exit 1", "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.py", "variants": [ { "name": "Run", "cmd": ["bash", "-c", "python '${file}' "], //终端显示 // "cmd": ["bash", "-c", "open -a '/Applications/Python 3.5/Python Launcher.app' '$file_name'"] }] }
终端运行java没有搞定 关键是终端java 。。。。.class 直接报类不存在错 什么鬼。。。。