【问题标题】:Starting SublimeREPL with hotkey使用热键启动 SublimeREPL
【发布时间】:2021-10-11 07:51:11
【问题描述】:

如何从 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'

【问题讨论】:

    标签: sublimetext3 sublimetext read-eval-print-loop sublimerepl


    【解决方案1】:

    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"
            }
        },
    

    我还更改了语法的名称以反映其新名称。

    【讨论】:

      猜你喜欢
      • 2015-04-16
      • 2017-02-02
      • 2013-03-20
      • 2018-05-13
      • 1970-01-01
      • 2012-05-03
      • 2015-03-22
      • 2021-12-21
      • 1970-01-01
      相关资源
      最近更新 更多