sublimeREPL插件应该是很多用sublime写python的用户的必备插件。配置该插件时按照以下教程在KeyBinding中设置好快捷键,发现按任何快捷键都没有反应。
{
"keys":["f5"],
"caption": "SublimeREPL: Python - RUN current file",
"command": "run_existing_window_command", "args": {"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"}
}
正确的做法应该如下:
在Sublime中点击Preferences ---》Browse Package,找到sublimeREPL插件的配置文件,Sublime Text 3\Packages\SublimeREPL-master\config\Python,在Sublime中打开 Main.sublime-menu 文件,根据需要设置的快捷键对应的功能复制对应的配置参数。我设置了F5运行,F8调试,配置如下:
{
//运行当前文件
"keys": ["f5"],
"command": "repl_open",
"caption": "Python - RUN current file",
"id": "repl_python_run",
"mnemonic": "R",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["python", "-u", "$file_basename"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
},
},
{
//调试当前文件
"keys": ["f8"],
"caption": "SublimeREPL: Python - PDB current file",
"command": "repl_open",
"mnemonic": "D",
"args":
{
"type": "subprocess",
"encoding": "utf8",
"cmd": ["python", "-i", "-u", "-m", "pdb", "$file_basename"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
},
},
重启Sublime后生效。