0

This question is related to this question:

In Jupyter Lab, execute editor code in Python console

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

}

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.

1 Answers1

0

You should use:

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

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).

krassowski
  • 13,598
  • 4
  • 60
  • 92