0

I am trying to assign a short cut key to "Run selected text or current line in console" by passing the below code in settings>Advanced Settings editor>Keyboard Shortcuts> user overrides .

{
      "title": "Run In Console",
      "selector": ".jp-Notebook.jp-mod-editMode",
      "keys": [
        "F9"
      ],
      "category": "Notebook Cell Operations",
      "command": "notebook:run-in-console"
    }

I can see the above code also in my /home//.jupyter/lab/user-settings/@jupyterlab/shortcuts-extension/plugin.jupyterlab-settings

itthrill
  • 1,241
  • 2
  • 17
  • 36
  • Could this be of any help: https://stackoverflow.com/a/66942396/6646912? If not, could you be more precise about in which component (please provide a screenshot) you would want which action to be performed? – krassowski Apr 27 '21 at 07:36
  • (this is because there are multiple things that users refer to as "console" in JupyterLab and multiple editors have access to different "consoles" and usually the issue is not identifying the shortcut for the correct one). – krassowski Apr 27 '21 at 07:37

1 Answers1

0

I took a default key and used the same patter and it worked.

{
    "notebook:run-cell-and-insert-below-1": {
      "title": "Run Cell(s) and Insert Below",
      "selector": ".jp-Notebook:focus",
      "keys": [
        "Alt Enter"
      ],
      "category": "Notebook Cell Operations",
      "command": "notebook:run-cell-and-insert-below"
    },


    "notebook:run-in-console": {
      "title": "Run In Console",
      "selector": ".jp-Notebook.jp-mod-editMode",
      "keys": [
        "F9"
      ],
      "category": "Notebook Cell Operations",
      "command": "notebook:run-in-console"
    }
}
Rub
  • 2,071
  • 21
  • 37
itthrill
  • 1,241
  • 2
  • 17
  • 36