I've been using Jupyter Notebooks for a couple of years now. I've just headed over to Jupyter Lab, but I've found the lack of shortcuts to be a burden.
For example, I noticed that I can search for commands in the left hand palette. But I can't seem to easily bind them to a keyboard shortcut. Is this even possible?
For example, I want to collapse the current cell output with "O" and collapse all code cells with "Shift O".
This question is answered on GitHub here. You can also look here for the correct command
names to enter in your keyboard shortcut user overrides because they are not always the same as what is shown in the Commands side-bar.
The following are some that I use:
{
"shortcuts": [
{
"command": "notebook:hide-cell-outputs",
"keys": [
"O"
],
"selector": ".jp-Notebook:focus"
},
{
"command": "notebook:show-cell-outputs",
"keys": [
"O",
"O"
],
"selector": ".jp-Notebook:focus"
},
{
"command": "notebook:hide-all-cell-outputs",
"keys": [
"Ctrl L"
],
"selector": ".jp-Notebook:focus"
},
{
"command": "notebook:hide-all-cell-code",
"keys": [
"Shift O"
],
"selector": ".jp-Notebook:focus"
}
]
}
which allows you to hide a cell output by pressing O
once and showing the cell output by pressing O
twice. The last one collapses all cell code with Shift + O
as you requested.