15 Most used Vscode Jupyter Notebooks Keyboard Shortcuts

Posted by Chaitanya Shahare on Wed, Aug 30, 2023

In the realm of data science, Jupyter Notebooks have long been a staple for interactive coding and analysis. Their seamless integration with Visual Studio Code (VS Code) has only added to their allure, providing a potent combination of code development, visualization, and documentation.

To further enhance your productivity, mastering keyboard shortcuts is essential.

In this guide, we’ll delve into some of the most valuable keyboard shortcuts for working with Jupyter Notebooks in VS Code (.ipynb files), enabling you to streamline your workflow and conquer your data-driven tasks with finesse.

Getting Started

Before we dive into the keyboard shortcuts, it’s crucial to ensure that you have the Jupyter extension installed in your Visual Studio Code. To do this:

  1. Open Visual Studio Code.
  2. Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window.
  3. Search for “Jupyter” and install the official Jupyter extension provided by Microsoft.

Once the extension is installed, you’re ready to supercharge your Jupyter Notebook experience with keyboard shortcuts.

Essential Keyboard Shortcuts

  1. Shift + Enter (⇧ + ↩): Execute the current cell and move to the next one. This is one of the fundamental shortcuts for running code in your notebook.

  2. Ctrl + Enter (⌃ + ↩): Execute the current cell and stay in the same cell. Useful for quickly rerunning code snippets.

  3. Alt + Enter (⌥ + ↩): Execute the current cell and insert a new cell below. This is a fantastic shortcut for rapid prototyping and experimentation.

  4. Esc (⎋): Exit edit mode in a cell. Pressing Esc allows you to navigate the notebook using keyboard shortcuts.

  5. Enter (↩): Enter edit mode in a cell. After pressing Enter, you can modify the content of the cell.

  6. Y: Change the cell type to code. When you’re in command mode (after pressing Esc), pressing ‘Y’ converts the selected cell to a code cell.

  7. M: Change the cell type to Markdown. Similarly, pressing ‘M’ in command mode converts the selected cell to a Markdown cell.

  8. A: Insert a new cell above the current cell. This is an efficient way to add cells without interrupting your flow.

  9. B: Insert a new cell below the current cell. Combined with ‘A’, this lets you effortlessly add cells wherever you need them.

  10. X: Cut the selected cell(s). You can then use ‘V’ to paste them elsewhere.

  11. C: Copy the selected cell(s). This is great for duplicating cells or moving them around.

  12. V: Paste cells below the selected cell. A simple way to reproduce or rearrange your work.

  13. Z: Undo cell deletion. Accidentally deleted a cell? Press ‘Z’ in command mode to bring it back.

  14. D, D (press ‘D’ twice): Delete the selected cell(s). A quick way to clean up your notebook.

Advanced Shortcuts

  1. Shift + M: Merge selected cells. If you have multiple cells selected, this combines them into a single cell.

  2. Shift + Up/Down Arrow: Extend the selected cell(s) by one row up or down. This is useful when you want to select multiple cells quickly.

  3. Ctrl + Shift + “-” (⌃ + ⇧ + “-”): Split the current cell into two cells at the cursor position. Perfect for dividing large cells.

  4. Shift + Tab (⇧ + ⇥): Indent or unindent the line where the cursor is located. Useful for organizing code neatly.

Conclusion

Keyboard shortcuts are the unsung heroes of productivity in the world of coding and data analysis. By mastering these shortcuts for Jupyter Notebooks in Visual Studio Code, you can navigate, edit, and execute your code swiftly and efficiently. Whether you’re a data scientist, analyst, or just someone who loves to tinker with data, these shortcuts will undoubtedly empower you to work with greater ease and confidence.

Remember, practice makes perfect. The more you incorporate these shortcuts into your workflow, the more seamless your experience with Jupyter Notebooks in VS Code will become.

Happy coding!