Saturday, August 24, 2024

Jupyter Notebook keyboard shortcuts

 Jupyter Notebook provides a variety of keyboard shortcuts to streamline your workflow and make it more efficient. Here’s a list of some commonly used shortcuts:

Command Mode (Press Esc to enter):

  • Enter: Switch to Edit mode.
  • Shift + Enter: Run the current cell and select the cell below.
  • Ctrl + Enter: Run the current cell and stay in the same cell.
  • Alt + Enter: Run the current cell and insert a new cell below.
  • Y: Change the cell type to Code.
  • M: Change the cell type to Markdown.
  • R: Change the cell type to Raw.
  • D, D (press D twice): Delete the selected cell(s).
  • A: Insert a new cell above the current cell.
  • B: Insert a new cell below the current cell.
  • X: Cut the selected cell(s).
  • C: Copy the selected cell(s).
  • V: Paste the cut/copied cell(s) below the current cell.
  • Shift + V: Paste the cut/copied cell(s) above the current cell.
  • Z: Undo the last cell operation (e.g., delete).
  • S: Save the notebook.
  • H: Show keyboard shortcuts help dialog.
  • Shift + Up: Extend selection upwards.
  • Shift + Down: Extend selection downwards.
  • Ctrl + Shift + -: Split the current cell at the cursor position.
  • Shift + M: Merge selected cells.

Edit Mode (Press Enter on a cell to enter):

  • Esc: Switch to Command mode.
  • Shift + Enter: Run the current cell and select the cell below.
  • Ctrl + Enter: Run the current cell and stay in the same cell.
  • Alt + Enter: Run the current cell and insert a new cell below.
  • Tab: Code completion or indent.
  • Shift + Tab: Tooltip or outdent.
  • Ctrl + Shift + -: Split the current cell at the cursor position.
  • Ctrl + /: Toggle comment on selected lines.
  • Ctrl + Z: Undo last change.
  • Ctrl + Y: Redo last undone change.

Additional Useful Shortcuts:

  • Ctrl + S: Save the notebook.
  • Ctrl + Shift + P: Open the command palette.

These shortcuts can significantly enhance your efficiency while working in Jupyter Notebooks. You can also view all available shortcuts and customize them by pressing H in Command mode or accessing the Keyboard Shortcuts menu in the notebook interface.

No comments:

Post a Comment