Within Visual Studio Code, I would like to be view and customize my Jupyter-notebook shortcuts
e.g. ctrl-shift-c
to clear cell content, etc. similar to what is available using the typical browser-based interface.
However, I did not manage to find a way to do so. https://code.visualstudio.com/docs/python/jupyter-support-py
You can create a Jupyter Notebook by running the Jupyter: Create New Jupyter Notebook command from the Command Palette (Ctrl+Shift+P) or by creating a new . ipynb file in your workspace. Next, select a kernel using the kernel picker in the top right.
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.
All keyboard shortcuts in VS Code can be customized via the keybindings. json file. To configure keyboard shortcuts through the JSON file, open Keyboard Shortcuts editor and select the Open Keyboard Shortcuts (JSON) button on the right of the editor title bar. This will open your keybindings.
To extend on Oliver.R's answer.
Go to the keyboard shortcuts (with Ctrl+K
, Ctrl+S
or Ctrl+Shift+P
and search for Open Keyboard Shortcuts
and then search for notebook
which should list all the available bindings for Jupyter
.
Alternatively, you could search for the shortcuts themselves (using the record key feature) or just typing ctrl+shift+c
which shows you all bindings for that particular keys.
Once you have found the keybinding you want to change. You can click on it and push Enter
(or use the Change Keybinding
button to the left of the column) to change it.
However, I am not sure, if all the listed shortcuts work / are implemented. For me, only a fraction of the listed keybindings actually work.
In VSCode, the keyboard shortcuts (accessed by ctrl+K, then ctrl+S) in the namespace python.datascience
(search it in the shortcuts window) relate to notebook management such as running cells. I believe these are the only available built-in options however, and your example of "clear cell content" does not appear to be available.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With