Keyboard Shortcut Customization
Starting with Jupyter Notebook 5.0, you can customize the
command mode shortcuts from within the Notebook Application itself.
Head to the ``Help`` menu and select the ``Edit keyboard Shortcuts`` item. A dialog will guide you through the process of adding custom keyboard shortcuts.
Keyboard shortcut set from within the Notebook Application will be persisted to your configuration file. A single action may have several shortcuts attached to it.
Keyboard Shortcut Customization (Pre Notebook 5.0)
r key available for running a cell:
“By default the keypress
r, while in command mode, changes the type of the selected cell to
raw. This shortcut is overridden by the code in the previous cell, and thus the action no longer be available via the keypress
There are a couple of points to mention about this API:
help_indexfield is used to sort the shortcuts in the Keyboard Shortcuts help dialog. It defaults to
When a handler returns
falseit indicates that the event should stop propagating and the default action should not be performed. For further details about the
eventobject or event handling, see the jQuery docs.
If you don’t need a
help_indexfield, you can simply pass a function as the second argument to
Likewise, to remove a shortcut, use
If you want your keyboard shortcuts to be active for all of your notebooks, put the above API calls into your
Of course we provide name for majority of existing action so that you do not have to re-write everything, here is for example how to bind
r back to it’s initial behavior: