1.ubuntu安装sublime-text
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt-get update
sudo apt-get install sublime-text
2.Ubuntu中安装最新版的yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
3.配置c++编译运行环境:
安装gnome:
sudo apt-get remove gnome-terminal && sudo apt-get install gnome-terminal
建立build文件:
{
"cmd": ["g++ ${file} -o ${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++,source.cpp,source.cxx",
"shell": true,
"variants":
[
{
"name": "Run",
"cmd": ["${file_path}/${file_base_name}"]
},
{
"name": "RunInShell",
"cmd": ["gnome-terminal -x bash -c '${file_path}/${file_base_name};read' "]
}
]建立f10快捷键运行:
{ "keys": ["f10"], "command": "build","args": {"variant": "RunInShell"} },
windows下可以建立如下的c++配置文件:
{ "cmd": ["g++", "${file}", "-fexec-charset=gbk", "-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": ["cmd", "/c", "g++", "${file}", "-o", "${file_path}/${file_base_name}", "&&", "start", "cmd", "/c", "${file_path}/${file_base_name} & pause"] } ] }
4.配置python运行环境,建立python3 bulid文件:
{ "cmd": ["/usr/bin/python3","-u","$file"],#注可以用type python得到python的解释路径 "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.python", }
sublime不能从自带的终端输入,所以input之类的函数无法使用,可以安装插件sublimerepl.安装好了以后可以点击菜单栏tools-sublimerepl-python-run current file,会新弹出一个标签页面,就可以交互用input(),为了方便可以设置快键键,在preferences-key binds-user中输入如下代码:
{ "keys": ["f5"], "caption": "SublimeREPL:Python", "command": "run_existing_window_command", "args": { "id": "repl_python_run", "file": "config/Python/Main.sublime-menu" } },
5.设置编码字体:打开Preferences - settings,加上
"default_encoding": "UTF-8", "font_size": 16.0, "tab_size": 4,