Jupyter Lab快捷方式修改 [英] Jupyter lab shortcut modification

查看:86
本文介绍了Jupyter Lab快捷方式修改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题与这个问题有关:

This question is related to this question:

在Jupyter Lab中,在Python控制台中执行编辑器代码

我想更新快捷方式以执行从编辑器到控制台的代码.默认值是Shift + Enter.但是我尝试更新一些默认的快捷方式,但无法获得能够执行从编辑器到终端的代码的功能.

I would like to update the shortcut to execute code from the editor to the console. The default one is Shift + Enter. But I have tried to update couple of the default shortcut and can't get the one that does execute the code from the editor to the terminal.

警告:答案之一建议使用:

WARNING: One of the answer suggest using :

{
// List of Keyboard Shortcuts
"shortcuts": [
    {
        "command": "notebook:run-in-console",
        "keys": [
            "F9"
        ],
        "selector": ".jp-Notebook.jp-mod-editMode"
    },
]

}

但这不是我想要的,因为这是将代码从.ipynb(笔记本)运行到控制台,而不是将编辑器(.py)运行到控制台.

But this is not what I want as this one is to run code from a .ipynb (notebook) to the console and not the editor (.py) to the console.

推荐答案

您应使用:

    {
        "command": "runmenu:run",
        "keys": [
            "F9"
        ],
        "selector": "[data-jp-code-runner]"
    }

通常,要查找所需的命令,只需转到键盘快捷方式",然后在左侧面板中的系统默认值"(System Defaults)搜索已知的默认快捷方式(可能会有一些结果,因为这些快捷方式是上下文相关的,并且上下文由CSS选择器定义).

In general to find the command you want simply go to the Keyboard Shortcuts and in the left panel "System Defaults" search for the known default shortcut (there might be a few results, as the shortcuts are context sensitive, with context defined by the CSS selector).

这篇关于Jupyter Lab快捷方式修改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆