把sublime从台式移植来笔记本,按F5开交互突然没反应了。
找了不少帖子,国内有效的解决贴是这个:Sublime插件sublimeREPL快捷键无响应问题。但是没有提到原因。
把这段(旧代码)
{
"keys": ["f5"],
"caption": "SublimeREPL: Python - RUN current file",
"command": "run_existing_window_command",
"args": {
"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"
}
},
换成这段(新代码)就行了。具体原因我还在google(查明了,请往下看)
{
"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"}
},
} ,
--------------------------------------2021/3/10------------
新代码的出处是旧代码里的这个文件"file": "config/Python/Main.sublime-menu"
文件中的一段"caption": "Python - RUN current file"的那段
在stackflow上找到答案了:https://stackoverflow.com/questions/55198793/cant-run-py-files-by-using-hot-key-in-sublimetext3
原来是因为旧代码里的"run_existing_window_command"被新版本sublime弃用了
It appears that Sublime Text 3 build 3200 has broken the
run_existing_window_command
command. .... From this directory, if you openSublimeREPL/config/Python/Main.sublime-menu
, you'll see a big ole json file that looks something like this:就像上面这张截图 ...Notice that the innermostchildren
key is a list of dictionaries withcommand
s andargs
. We're going to copy those into thesublime-keymap
file and replace thecommand
andargs
that are already there.现在直接在sublime_menu里找一段,复制到key binding,开头加上自己要的快捷键 就能直接用了。 就像新代码那样
----------------------------结案----------------------寻找过程小结----------------------------
因为两台电脑都是前几年不同时间装的sublime,一时忽略了版本的问题。
也去找过是不是repl的原因,但repl/config/python/Main.sublime-menu从2015开始就没修改过了:https://github.com/wuub/SublimeREPL/blob/master/config/Python/Main.sublime-menu