无法通过sublimetext3中的热键运行py文件

时间:2019-03-16 16:11:06

标签: python-3.x sublimetext3 sublimerepl

我已经将sublime3更新到最新版本,所以我无法使用热键运行py文件。这是我的热键配置:

[
{
    "caption": "Tmpl: Create python",
    "command": "sublime_tmpl",
    "keys": ["ctrl+alt+p"], "args": {"type": "python"}
},
{
    "keys":["f1"],
    "caption": "SublimeREPL: Python",
    "command": "run_existing_window_command", "args":
    {
        "id": "repl_python",
        "file": "config/Python/Main.sublime-menu"
    }
},
{
    "keys":["f2"],
    "caption": "SublimeREPL: Python - RUN current file",
    "command": "run_existing_window_command", "args":
    {
        "id": "repl_python_run",
        "file": "config/Python/Main.sublime-menu"
    }
},

]

hot key configuration for my sublimeREPL

当我按 F2 F1 时,什么也没发生。

1 个答案:

答案 0 :(得分:0)

看来Sublime Text 3 build 3200破坏了format命令。正如this answer中提到的那样,解决方案是改为调用SublimeREPL菜单项正在使用的命令。

如果导航到Sublime Text 3软件包目录(在Windows上默认为i),则可以看到已安装的软件包。在此目录中,如果打开{},则会看到一个大的ole json文件,看起来像这样:

run_existing_window_command

请注意,最里面的AppData/Roaming/Sublime Text 3/键是具有SublimeREPL/config/Python/Main.sublime-menu[ { "id": "tools", "children": [{ "caption": "SublimeREPL", "mnemonic": "R", "id": "SublimeREPL", "children": [ {"caption": "Python", "id": "Python", "children":[ {"command": "repl_open", "caption": "Python", "id": "repl_python", "mnemonic": "P", "args": { "type": "subprocess", "encoding": "utf8", "cmd": ["python", "-i", "-u"], "cwd": "$file_path", "syntax": "Packages/Python/Python.tmLanguage", "external_id": "python", "extend_env": {"PYTHONIOENCODING": "utf-8"} } } <---snip---> ]} ] }] } ] 的词典列表。我们将把它们复制到children文件中,并替换已经存在的commandargs。例如,您打开python REPL的快捷方式现在看起来像:

sublime-keymap

击打command现在应该可以像以前一样工作了。