Keyboard Shortcuts

Keyboard shortcuts for cells, editing, and navigation.

pynb has two modes: edit mode (cursor inside a cell editor) and command mode (cell selected but editor not focused). Press Escape to switch from edit mode to command mode, and Enter to switch back.

Cell Execution

ShortcutAction
Shift+EnterRun cell and advance to next
Cmd+EnterRun cell and stay
Alt+EnterRun cell and insert new cell below

File

ShortcutAction
Cmd+SSave notebook
Cmd+NNew notebook
Cmd+,Open Settings

Edit Mode (inside cell editor)

ShortcutAction
Cmd+/Toggle comment
Cmd+.Trigger autocomplete
Ctrl+SpaceTrigger autocomplete
Shift+TabInspect symbol
F12Go to definition
Cmd+Alt+DGo to definition
Alt+HShow hover info
F2Rename symbol
TabIndent (or insert spaces)
EscapeExit to command mode

Command Mode (cell selected, editor not focused)

ShortcutAction
EnterEnter edit mode
Up / kSelect previous cell
Down / jSelect next cell
aInsert cell above
bInsert cell below
d, dDelete cell (press d twice)
zUndo cell deletion
mChange cell to Markdown
yChange cell to Code
cCopy cell
xCut cell
vPaste cell
Shift+EnterRun cell and advance

Find

ShortcutAction
Cmd+FOpen find bar
Cmd+ZUndo (when not in editor, undoes cell deletion)

Standard macOS

These are inherited from the system and work automatically.

ShortcutAction
Cmd+ZUndo
Cmd+Shift+ZRedo
Cmd+ASelect All
Cmd+C / Cmd+X / Cmd+VCopy / Cut / Paste