分享

sublimeREPL快捷键F5无响应问题_sublimerepl快捷键无法运行

 共同成长888 2023-07-26 发布于广东

sublime从台式移植来笔记本,按F5开交互突然没反应了。

找了不少帖子,国内有效的解决贴是这个:Sublime插件sublimeREPL快捷键无响应问题。但是没有提到原因。

把这段(旧代码)

  1. {
  2. "keys": ["f5"],
  3. "caption": "SublimeREPL: Python - RUN current file",
  4. "command": "run_existing_window_command",
  5. "args": {
  6. "id": "repl_python_run",
  7. "file": "config/Python/Main.sublime-menu"
  8. }
  9. },

换成这段(新代码)就行了。具体原因我还在google(查明了,请往下看)

  1. {
  2. "keys": ["f5"],
  3. "command": "repl_open",
  4. "caption": "Python - RUN current file",
  5. "id": "repl_python_run",
  6. "mnemonic": "R",
  7. "args": {
  8. "type": "subprocess",
  9. "encoding": "utf8",
  10. "cmd": ["python", "-u", "$file_basename"],
  11. "cwd": "$file_path",
  12. "syntax": "Packages/Python/Python.tmLanguage",
  13. "external_id": "python",
  14. "extend_env": {"PYTHONIOENCODING": "utf-8"}
  15. },
  16. } ,

--------------------------------------2021/3/10------------

新代码的出处是旧代码里的这个文件"file": "config/Python/Main.sublime-menu"

浏览插件目录>sublimerepl  >sublimerepl  >config  >python  >Main.sublime_menu

文件中的一段"caption": "Python - RUN current file"的那段

代码来源

在stackflow上找到答案了:https:///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 open SublimeREPL/config/Python/Main.sublime-menu, you'll see a big ole json file that looks something like this:就像上面这张截图 ...Notice that the innermost children key is a list of dictionaries with commands and args. We're going to copy those into the sublime-keymap file and replace the command and args 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

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多