分屏键为Alt+Shift+数字
新建一个sublime build system
然后自动打开了一个文本,清空并写入以下内容:
{
"env": {"PYTHONIOENCODING": "utf8"},
"cmd": ["C:/Users/sen/AppData/Local/Programs/Python/Python35/python.exe", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
“env”: {“PYTHONIOENCODING”: “utf8”}, 是避免中文报错!
[“C:/Users/sen/AppData/Local/Programs/Python/Python35/python.exe”, “-u”, “$file”], 这里路径要替换成你电脑中python3的路径。
保存文件名为python3.sublime-build
按ctrl + shift + p输入Package Control点击Install Package
然后输入sublimeREPL,稍候一阵底部就会告诉你安装好了。
Prefereces -> key Bindings
输入代码
[
{
"keys": ["f4"],
"caption": "SublimeREPL: Python3 - RUN current file",
"command": "run_existing_window_command",
"args":
{
"id": "repl_python3_run",
"file": "config/Python3/Main.sublime-menu"
}
}
]
注意:每个键设置都在各自的花括号内,花括号内以逗号隔开各个语句;不同键之间也以逗号隔开。
"key": 为设置的快捷键对应的按键,第一个为F4,组合快捷键以“+”衔接,如 ["alt+p"]
"command": 为一段键的说明,可自定义。
"args": "id"为配置文件"file"内对应的ID,具体由对应的配置文件决定
"key": 为设置的快捷键对应的按键,第一个为F4,组合快捷键以“+”衔接,如 ["alt+p"]
"command": 为一段键的说明,可自定义。
"args": "id"为配置文件"file"内对应的ID,具体由对应的配置文件决定
Packages:Browse Package 找到 SublimeREPL的文件夹,再进入config文件夹,可以看到许多语言的配置文件,Python也在里面
在这里新建一个Python3的文件夹,在里面新建Default.sublime-commands和Main.sublime-menu两个文件(模仿Python文件夹)
Default.sublime-commands配置如下:
[
{
"caption": "SublimeREPL: Python3",
"command": "run_existing_window_command", "args":
{
"id": "repl_python3",
"file": "config/Python3/Main.sublime-menu"
}
},
{
"caption": "SublimeREPL: Python3 - RUN current file",
"command": "run_existing_window_command", "args":
{
"id": "repl_python3_run",
"file": "config/Python3/Main.sublime-menu"
}
}
]
Main.sublime-menu配置如下:
[
{
"id": "tools",
"children":
[{
"caption": "SublimeREPL",
"mnemonic": "R",
"id": "SublimeREPL",
"children":
[
{"caption": "python3",
"id": "python3",
"children":[
{"command": "repl_open",
"caption": "python3",
"id": "repl_python3",
"mnemonic": "P",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["C:/Users/sen/AppData/Local/Programs/Python/Python35/python.exe", "-i", "-u"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "Python3",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
}
},
{"command": "repl_open",
"caption": "python3 - RUN current file",
"id": "repl_python3_run",
"mnemonic": "R",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["C:/Users/sen/AppData/Local/Programs/Python/Python35/python.exe", "-u", "$file_basename"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "Python3",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
}
}
]}
]
}]
}
]