Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display and edit all Jupyter shortcuts in vscode (similar to typical `jupyter-notebook`)?

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

like image 269
Ryan Y Avatar asked Jan 15 '20 00:01

Ryan Y


People also ask

How do you make a VS Code like Jupyter Notebook?

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.

How do I edit keyboard shortcuts in Jupyter Notebook?

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.

How do I change VS Code 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.


2 Answers

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.

like image 129
wueli Avatar answered Oct 03 '22 15:10

wueli


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.

like image 22
Oliver.R Avatar answered Oct 03 '22 15:10

Oliver.R