Skip to content
igaurab edited this page Nov 18, 2026 · 3 revisions

Press f1 (or ? in cell mode) to see all keys in gpython. The source of that list is src/gpython/keymap.py.

Related pages: Vim for the editor keys, Commands for : commands.

Modes

Mode Badge color What the keys do
INSERT INSERT green Type text
NORMAL NORMAL yellow Vim commands in the editor
VISUAL VISUAL purple Vim selection in the editor
REPLACE REPLACE red Type over text
CELL CELL blue Work on cells
DEBUG DEBUG red The debugger is paused in a cell

How to change mode:

Key Change
escape INSERT → NORMAL → CELL
enter or i in cell mode CELL → NORMAL. Press i again to type
Click on a cell header Select that cell
Click in an editor, while you edit Go to that editor

In cell mode, a click only selects the cell.

The mode (cell mode or editor) applies to the full notebook. It stays the same when you move to a different cell, delete, undo, search or change tabs. A markdown cell that shows its text, and a cell with hidden code, are always selected as a cell.

Key conflicts

The editor is vim. Some keys have a vim meaning and an application meaning.

  • In the editor, the vim meaning applies.
  • In cell mode, the application meaning applies. Press escape first.

The affected keys are ctrl+d, ctrl+e, ctrl+n, ctrl+o, ctrl+p, ctrl+v, and in insert mode also ctrl+h, ctrl+k, ctrl+t and ctrl+w. See What changed for vim.

Colors

Item Color
Cursor A block in the color of the mode badge
Bar of the selected cell (cell mode) Blue
Bar of the cell you edit The color of the vim mode
Bar of a stale cell Salmon
Bar of the cell where the debugger is paused Red

:set cursor=bar or :set cursor=underline uses the cursor of the terminal, in the same colors.

Keys for all modes

Run

Key Action
shift+enter Run the cell, then go to the next cell. On the last cell, make a new cell. A markdown cell shows its text
ctrl+enter, ctrl+shift+enter Run the cell and stay
alt+enter Run the cell and add a new cell below
ctrl+e Run the cell and stay. Cell mode only
f5 Run all cells
f4 Run the stale cells
f3 Change the run mode: lazy or reactive. Saved
ctrl+k Stop the code that runs. Not in insert mode

Cells

Key Action
ctrl+n New cell below. Cell mode only
ctrl+shift+n New cell above
ctrl+d Delete the cell. Cell mode only. u brings it back
alt+↑ / alt+↓, ctrl+↑ / ctrl+↓ Previous / next cell
ctrl+home / ctrl+end First / last cell
alt+shift+↑ / alt+shift+↓ Move the cell up / down

When you delete a cell, the cells that used its variables become stale. In reactive mode they run again.

Files, panels and windows

Key Action
ctrl+s Save. gpython asks for a name if the notebook has none
ctrl+q Quit. gpython asks if there are changes that are not saved
ctrl+b Show or hide the file explorer
ctrl+o Show or hide the outline panel. Cell mode only
ctrl+v Show or hide the variables panel. Cell mode only
ctrl+p Command palette: a list of all commands. Cell mode only
ctrl+t Theme picker. Not in insert mode
f6 Python environment picker
f1 Help
ctrl+h / ctrl+l Go to the window on the left / right. Not in insert mode
backspace Same as ctrl+h, outside insert mode
ctrl+w … Window commands. Not in insert mode. See Windows

Cell mode

Move and select

Key Action
j / k Select the next / previous cell. 3j moves three cells
gg / G Select the first / last cell
3G Select the third cell
g 6 Select cell c6
/ /3 goes to cell 3. /text selects the next cell that contains the text
n / N Select the next / previous cell that matches the last search
gt / gT / 2gt Next / previous / second tab
escape Clear the keys you typed and the search highlight

Edit cells

Key Action
enter / i Edit the cell. On a markdown cell, show its source
a / b Add a cell above / below
o / O Add a cell below / above and start in insert mode
dd Delete the cell. 3dd deletes three cells
yy / x Copy / cut the cell
p / P Paste the cell below / above
J / K Move the cell down / up
u or z Undo
ctrl+r Redo
m / y Change the cell to markdown / code

Undo is one history for the full notebook. It contains typed text in all cells, and cell deletes, moves, additions and markdown/code changes. u goes to the cell that changed. The history keeps 500 steps.

Show and hide

Key Action
h Hide or show the code of the cell. On a markdown cell, fold or unfold it
H Hide or show the code of all cells
c Collapse or expand the output
C Clear the output
v Show the image of the cell on the full screen. See Images
l Show or hide line numbers
t Show or hide the run time in each cell header

Run

r and a second key runs cells. See The r keys.

Other

Key Action
space f f Find a file by name. See File finder
: Type a command
? Help

Keys in the panels

Panel Where the keys are
File explorer Files, windows and tabs
Outline Files, windows and tabs
Window manager Files, windows and tabs
Variables Variables and the debugger
Debugger Variables and the debugger
Image viewer Images

Text pages

K, :g/pat/ and :digraphs open a page of text above the notebook.

Key Action
j / k Scroll one line
ctrl+d / ctrl+u Scroll half a page
g / G Top / bottom
q, escape Close

Typing in the editor

Key Result
enter Adds an indent after : or an open bracket. Removes an indent after return, pass and similar words
backspace in the indent Removes one indent level
tab Inserts four spaces, or completes a name. See Completion

Clone this wiki locally