Skip to content

Files windows and tabs

igaurab edited this page Nov 18, 2026 · 4 revisions

gpython opens several notebooks at once, the way vim opens several files: each notebook is a window, windows can be split, and tabs group windows. Every notebook has its own kernel (its own variables, its own __file__).

File explorer

Open with ctrl+b, :Ex, :e with no name. A tree of the notebook's folder on the left: folders and .py/.ipynb files, hidden files and other extensions behind .. Keys inside it:

Key Action
j / k, gg / G Move
h / l Collapse (or go to the parent) / expand a folder; l on a file opens it
enter / o / t Open the file in its own tab (a folder expands); a blank untitled window is reused
e Open the file in the current window (like :e)
s / v Open in a horizontal / vertical split
- Go up: the parent folder becomes the root
C Make the folder under the cursor the root
% New notebook in the folder under the cursor
/, n Search file names, repeat
. Show hidden and non-notebook files
R Reload
q, escape, ctrl+b Hide the explorer

ctrl+b toggles the explorer from anywhere, also in vim normal mode (it is not page up). While the explorer has the keyboard the mode badge stays NORMAL, as in vim; its keys are the ones in the table above. The explorer stays open after a file is opened; ctrl+h or ctrl+w h from the leftmost window (or ctrl+w w) goes back to it while it is shown, and ctrl+l returns to the notebook. Terminals send ctrl+h as backspace, so backspace does the same outside insert mode. A file that is already open is shown (its tab focused) instead of being opened twice. Clicking a file opens it too.

Outline

Open with ctrl+o, :outline, :tags. The explorer's twin on the right: one node per cell (c2 defines np, xs, a markdown cell shows its heading), expandable to the names it defines: imports, variables, functions with their signature, classes. Once a cell has run, variables show the kernel's type and value (xs list [1, 2, 3]). The cursor follows you: the current cell, or the function or class whose lines hold the editor cursor, like tagbar. A footer shows the cell's edges in the dependency graph (← uses c1, c2 → used by c4). ctrl+w l from the rightmost window focuses it, then:

key action
j / k Move through the cells and their definitions
enter Jump: a cell selects it, a definition opens the cell's editor on that line
h / l Collapse / expand a cell
q Hide the outline and go back to the notebook
escape, ctrl+w h Back to the notebook, the outline stays

It replaces the old f2 variables table. In insert mode ctrl+o keeps vim's meaning (one normal-mode command); use :outline there.

Windows

ctrl+w then a key, as in vim (not in insert mode, where ctrl+w deletes a word):

Key Action
ctrl+w s / :sp [file] Split: a new window below (an untitled notebook, or file)
ctrl+w v / :vs [file] Vertical split: a new window to the right
ctrl+w h j k l Focus the window to the left / below / above / right
ctrl+w w / ctrl+w p Next / previous window (the explorer counts as the first)
ctrl+w q / :q Close this window (asks if unsaved; closing the last one quits)
ctrl+w o / :only Keep only this window
ctrl+w T Move this window to a new tab
ctrl+w M / :tabmerge The reverse: put the window back where T took it from (else into the previous tab)
ctrl+w z / :zoom Zoom: the window fills the tab; again brings the splits back (like tmux's prefix z)
ctrl+w x Swap this window with the next one in its row or column
ctrl+w r / R Rotate the windows of this row or column forward / back
ctrl+w H J K L Move the window to the far left / bottom / top / right, full height or width (turns side-by-side into stacked and back)
ctrl+w space / :windows The window manager (below)
ctrl+w =, + - < > Equalize / resize

Moving to another window, splitting or closing undoes a zoom. While zoomed, the status line says so and the tab line marks the tab with ⤢.

Window manager

Open with ctrl+w space or :windows: a floating list of every tab, the windows in each, and the hidden buffers, with a map of the selected tab's layout and what the selected notebook is (path, kernel, unsaved). The keys are printed at the bottom of the popup:

Key Action
j k / arrows, g G, click Move (click the selected row, or double-click, to go there)
enter Go there: a tab, a window, or show a hidden buffer in the current window
s / v Put the selected notebook in a split below / beside the window you came from (it moves from another tab, or a hidden buffer is shown)
t Give it a tab of its own
z Go there and zoom it
x Close its window (or a whole tab); the notebook stays a hidden buffer
d / D Delete the buffer and stop its kernel (D even when unsaved)
J / K Move its tab right / left (:tabmove N does the same)
1-9 Go to that tab
/ Filter by name; esc clears the filter, esc again closes

When a tab has several windows each shows a status line with its file name, dirty mark and kernel state; the active window's line is highlighted.

Tabs

:tabnew [file], gt / gT / 2gt (normal and cell mode), :tabn, :tabp, :tabclose, :tabonly, :tabmove N. The tab line appears above the notebook once there are two tabs (or a hidden buffer, see below); click a tab to switch. gpython a.py b.py opens one tab per file.

Buffers

As in vim, every opened notebook is a buffer with its own kernel, numbered in opening order. Closing a window (:q, ctrl+w q, :tabclose) only hides its notebook: variables and outputs stay, and the tab line lists hidden buffers (click one to show it).

Command Action
:ls / :buffers List buffers: %a current, a shown, h hidden, + unsaved
:b N / :b name Show that buffer in the current window (a partial, unique name works)
:bn / :bp Next / previous buffer in the current window
:bd [N] Delete the buffer and stop its kernel (asks if unsaved; :bd! does not)
:e file Open a file in the current window (refuses if unsaved; :e! file discards)

:w saves the current notebook, :wa saves every buffer, :q on the last window quits (asking about any unsaved buffer), :qa quits, :wqa saves everything and quits. Hidden buffers keep their kernel process alive; :bd frees it.

Clone this wiki locally