【Sublime】配置Sublime Text 3
[by_041_windows]
下载Sublime开启Coding新视界
事前准备(汉化)
- 打开Sublime Text,使用快捷键Shift+Ctrl+P,弹出管理框
- 下载输入并选择Package Control,回车下载插件管理器
- 再次打开管理框,选择Package Control: Install Package回车
- 等待一会(根据网速可能会是几分钟的事情)同样查找选择ChineseLocalizations回车
- 等待弹出插件的说明界面(Package Control Message)即安装成功,界面即汉化
- 若上个步骤完了还未见汉化,重启Sublime,在任务栏中的Help->最下面的Language->简体中文完成汉化
推荐插件
- 快捷键Shift+Ctrl+P,弹出管理框选择Package Control: Install Package即可下载插件
(p.s.Package Control还有其他插件管理命令)
ChineseLocalizations //汉化
A File Icon //图标好看
ConvertToUTF8 //自动转码
美化界面
{
"ignored_packages":
[
"ChineseLocalizations",
"Vintage"
],
"theme": "Adaptive.sublime-theme",
"auto_indent": true,
"caret_extra_bottom": 2,
"caret_extra_top": 2,
"caret_extra_width": 1,
"detect_indentation": true,
"encoding": "UTF-8",
"font_size": 15,
"highlight_line": true,
"index_files": false,
"match_selection": true,
"smart_indent": true,
"spell_check": false,
"tab_size": 4,
"theme": "Adaptive.sublime-theme",
"translate_tabs_to_spaces": false,
"trim_trailing_white_tab_on_save": false,
"update_check": true,
"word_wrap": true
}
配置C运行环境
- 找到工具 -> 编译系统 -> 新建编译系统,在新文件中输入以下代码:
{
"working_dir": "$file_path",
"cmd": "gcc -Wall \"$file_name\" -o \"$file_base_name\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"selector": "source.c",
"variants":
[
{
"name": "Run",
"shell_cmd": "gcc -Wall \"$file\" -o \"$file_base_name\" && start cmd /c \"\"${file_path}/${file_base_name}\" &echo / = = = E N D = = = / & pause\""
}
]
}
- 保存为
My_C_build.sublime-build
- 在运行前用Ctrl+Shift+B打开编译运行选项,选择上述预设的
- RUN
模式,即可在命令框中运行C程序
配置C++运行环境
- 找到工具 -> 编译系统 -> 新建编译系统,在新文件中输入以下代码:
{
/
"encoding": "utf-8",
"working_dir": "$file_path",
"shell_cmd": "g++ -Wall -std=c++11 \"$file_name\" -o \"$file_base_name\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"selector": "source.c++", "variants":
[
{
"name": "Run",
"shell_cmd": "g++ -Wall -std=c++11 \"$file\" -o \"$file_base_name\" && start cmd /c \"\"${file_path}/${file_base_name}\" &echo / = = = E N D = = = / & pause\""
}
]
}
- 保存为
My_C++_build.sublime-build
- 在运行前用Ctrl+Shift+B打开编译运行选项,选择上述预设的
- RUN
模式,即可在命令框中运行C++程序
配置Java运行环境
- 找到工具 -> 编译系统 -> 新建编译系统,在新文件中输入以下代码:
{
"cmd": ["javac", "-encoding", "gbk", "-d", ".", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.java",
"encoding": "gbk",
"variants": [{
"name": "Run in Steps",
"shell": true,
"cmd": ["start","cmd","/c","chcp 936&echo ====[Completing]====&echo.&echo javac running . . .&echo.&javac ${file_base_name}.java&echo.&echo javac done .&echo . &echo ====[Completed]====&pause&chcp 65001&echo.&echo = = = = = = = = = = = = = = = =[begin] = = = = = = = = = = = = = = = =&java -ea ${file_base_name}&echo = = = = = = = = = = = = = = = =[ end ] = = = = = = = = = = = = = = = =&pause"],
"working_dir": "${file_path}",
}]
}
- 保存为
My_Java_build.sublime-build
- 在运行前用Ctrl+Shift+B打开编译运行选项,选择上述预设的
- RUN in Steps
模式,即可在命令框中运行Java程序(第一个界面是以GBK编码显示的编译信息,任意键继续后的第二个界面就是转为UTF-8编码的运行内容liao~)
配置Python运行环境
- 找到工具 -> 编译系统 -> 新建编译系统,在新文件中输入以下代码:
{
"encoding": "gbk",
"cmd": ["C:/Users/Teloy_041/AppData/Local/Programs/Python/Python39/python.exe","-u","$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"variants":
[
{
"name": "Run",
"shell": true,
"cmd" : ["start","cmd","/c", "python ${file_base_name}.py &echo / = = = E N D = = = / & pause"],
}
]
}
- 保存为
My_Python_build.sublime-build
- 在运行前用Ctrl+Shift+B打开编译运行选项,选择上述预设的
- RUN
模式,即可在命令框中运行Python程序