Add a standard accelerator/shortcut keystroke for Restart Kernel and Clear All Outputs
Per summary.
Hi @javabrett, thanks for opening this issue!
Keyboard shortcuts are always tricky in JupyterLab since we are balancing browser shortcuts, the number of reasonable key combinations (we usually aim for three or less keys at a time), and the many commands in JupyterLab. If you do want to push for this to be a standard shortcut, it would help if you could add
- What shortcut you would prefer (and how it overlaps with existing ones, if possible).
- Why you think this shortcut should be standard instead of configured by a user.
Since you said "standard" in the title, I'm guessing you are aware that you can set your own shortcuts in JupyterLab. Just in case, you can find more on how to personalize your shortcuts on the docs.
Let me know if I can do anything else to help here!
In jupyter notebook 6 the keyboard shortcuts that I used the most were:
- restart kernel and clear all output (no confirmation dialog)
- restart kernel (no confirmation dialog)
- restart kernel and run all cells (no confirmation dialog)
None of the actions are available now in the Keyboard shortcut settings. From my perspective it is OK if these actions are not assigned by default, but I would very much like the option of being able to set these. Having to navigate using a mouse for these very common actions is affecting my productivity in notebook 7.
I would very much like the option of being able to set these
You can set these in JSON Setting Editor → Keyboard Shortcuts. For example I have "restart kernel and run all cells" bound to Ctrl + R. We are tracking adding a way to add shortcuts for commands without default shortcuts in https://github.com/jupyterlab/jupyterlab/issues/13705 / https://github.com/jupyterlab/jupyterlab/pull/14015 - help would be welcome!
Thank you, I was able to find the appropriate commands in the JSON Setting Editor. This doesn't include the versions without the dialog, but I think that may be solved by a recent merge that includes a checkbox to disable the the dialog.
"shortcuts": [
{
"args": {},
"command": "kernelmenu:restart-and-clear",
"keys": [
"`",
"`"
],
"selector": "[data-jp-kernel-user]:not(.jp-mod-readWrite) :focus:not(:read-write)"
},
{
"args": {},
"command": "kernelmenu:restart",
"keys": [
"`",
"1"
],
"selector": "[data-jp-kernel-user]:not(.jp-mod-readWrite) :focus:not(:read-write)"
},
{
"args": {},
"command": "runmenu:restart-and-run-all",
"keys": [
"`",
"2"
],
"selector": "[data-jp-kernel-user]:not(.jp-mod-readWrite) :focus:not(:read-write)"
},
]