使用热键启动 SublimeREPL
Starting SublimeREPL with hotkey
如何从 SublimeREPL
包中为 Python 添加启动 SublimeREPL
的热键。您可以通过键入它从命令面板启动它,但我想将它分配给键,比如 f2
.
这是我目前拥有的:
{ "keys": ["f2"], "command": "repl_open" ,"cmd": ["python", "-i", "-u"],
"cwd": "$file_path", "encoding": "utf8", "extend_env": {"PYTHONIOENCODING": "utf-8"},
"external_id": "python", "syntax": "Packages/Python/Python.tmLanguage", "type": "subprocess"} ,
但在控制台中我可以看到这个错误:
TypeError: run() missing 2 required positional arguments: 'encoding' and 'type'
repl_open
命令的参数需要在 args
字典中:
{
"keys": ["f2"],
"command": "repl_open" ,
"args": {
"cmd": ["python", "-i", "-u"],
"cwd": "$file_path",
"encoding": "utf8",
"extend_env": {"PYTHONIOENCODING": "utf-8"},
"external_id": "python",
"syntax": "Packages/Python/Python.sublime-syntax",
"type": "subprocess"
}
},
我还更改了语法的名称以反映其新名称。
如何从 SublimeREPL
包中为 Python 添加启动 SublimeREPL
的热键。您可以通过键入它从命令面板启动它,但我想将它分配给键,比如 f2
.
这是我目前拥有的:
{ "keys": ["f2"], "command": "repl_open" ,"cmd": ["python", "-i", "-u"],
"cwd": "$file_path", "encoding": "utf8", "extend_env": {"PYTHONIOENCODING": "utf-8"},
"external_id": "python", "syntax": "Packages/Python/Python.tmLanguage", "type": "subprocess"} ,
但在控制台中我可以看到这个错误:
TypeError: run() missing 2 required positional arguments: 'encoding' and 'type'
repl_open
命令的参数需要在 args
字典中:
{
"keys": ["f2"],
"command": "repl_open" ,
"args": {
"cmd": ["python", "-i", "-u"],
"cwd": "$file_path",
"encoding": "utf8",
"extend_env": {"PYTHONIOENCODING": "utf-8"},
"external_id": "python",
"syntax": "Packages/Python/Python.sublime-syntax",
"type": "subprocess"
}
},
我还更改了语法的名称以反映其新名称。