SublimeREPL(Python)在Sublime Text3中配置快捷键的方法

用sublime运行python,如果有input()函数,ctrl+b是不能输入数据的,所以下载安装sublimeREPL增加python的交互模式。具体方法可以看文章

Sublime Text3安装SublimeREPL插件配置运行python交互模式及出现问题的解决方法

但是sublimeREPL没有自定义快捷键,所以只有自己设置。

首先找到sublimerepl的配置文件。

步骤:首选项-->浏览插件-->SublimeREPL文件夹-->config文件夹-->Python文件夹-->Default.sublime-commands(以文本格式打开)

[
    {
        "caption": "SublimeREPL: Python",
        "command": "run_existing_window_command", "args":
        {
            "id": "repl_python",
            "file": "config/Python/Main.sublime-menu"
        }
    },
    {
        "caption": "SublimeREPL: Python - PDB current file",
        "command": "run_existing_window_command", "args":
        {
            "id": "repl_python_pdb",
            "file": "config/Python/Main.sublime-menu"
        }
    },
    {
        "caption": "SublimeREPL: Python - RUN current file",
        "command": "run_existing_window_command", "args":
        {
            "id": "repl_python_run",
            "file": "config/Python/Main.sublime-menu"
        }
    },
    {
        "command": "python_virtualenv_repl",
        "caption": "SublimeREPL: Python - virtualenv"
    },
    {
        "caption": "SublimeREPL: Python - IPython",
        "command": "run_existing_window_command", "args":
        {
            "id": "repl_python_ipython",
            "file": "config/Python/Main.sublime-menu"
        }
    }
]
这是SublimeREPL的配置文件,找到你需要的命令复制下来。
{
        "caption": "SublimeREPL: Python - RUN current file",
        "command": "run_existing_window_command", "args":
        {
            "id": "repl_python_run",
            "file": "config/Python/Main.sublime-menu"
        }
    },

打开首选项-->快捷绑定-用户,加入以下代码。

代码如下

[
    {
            "keys": ["f5"],//这是自己设的快捷键    
            "command": "run_existing_window_command", 
            "args":
            {
                "id": "repl_python_run",
                "file": "config/Python/Main.sublime-menu"
            }
    }
]
最后保存就行了。
按下F5就可以直接出现交互模式了。

版权声明:
作者:水东柳
链接:https://shuidl.com/2099.html
来源:水东柳博客
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
< <上一篇
下一篇>>