Repository navigation
Files windows and tabs
gpython can open more than one notebook at the same time, as vim opens more than one file.
| Term | Meaning |
|---|---|
| Buffer | An open notebook. Each buffer has its own kernel, thus its own variables and its own __file__
|
| Window | An area of the screen that shows one buffer |
| Tab | A group of windows |
| Hidden buffer | A buffer that no window shows. Its kernel continues to run |
The explorer is a tree of the folder of the notebook, on the left.
It shows folders, .py files and .ipynb files.
Open or close it with ctrl+b, :Ex, or :e without a name. ctrl+b works in all modes.
| Key | Action |
|---|---|
j / k, gg / G
|
Move |
h |
Close a folder, or go to the parent |
l |
Open a folder. On a file: open the file |
enter, o, t
|
Open the file in its own tab |
e |
Open the file in the current window, as :e does |
s / v
|
Open the file in a horizontal / vertical split |
- |
Make the parent folder the root |
C |
Make the folder at the cursor the root |
% |
Make a new notebook in the folder at the cursor |
/, n
|
Search file names; search again |
. |
Show hidden files and files that are not notebooks |
R |
Load the tree again |
q, escape, ctrl+b
|
Hide the explorer |
Rules:
- A click on a file opens it.
- The explorer stays open after you open a file.
- If the file is open, gpython goes to its tab. It does not open the file a second time.
- gpython uses an empty window without a name before it makes a new one.
- While the explorer has the keyboard, the mode badge shows NORMAL.
| Key | Action |
|---|---|
ctrl+h, ctrl+w h
|
From the leftmost window: go to the explorer, if it shows |
backspace |
Same as ctrl+h, because terminals send ctrl+h as backspace. Not in insert mode |
ctrl+l |
From the explorer: go back to the notebook |
ctrl+w w |
Next window. The explorer is the first window |
The finder is a popup that searches files by name.
Open it with space f f (cell mode or normal mode), :find [text], or the command palette.
| Key | Action |
|---|---|
| Type | Filter the list |
ctrl+n / ctrl+p, ↓ / ↑
|
Move |
enter |
Open the file in its own tab |
escape |
Close |
- The text matches when its letters are in the path in the same sequence. The letters can have other letters between them.
- gpython searches the root folder of the explorer.
- In a git checkout, the list comes from
git ls-files. Thus gpython obeys.gitignore. - In other folders, gpython ignores hidden folders and tool folders.
The outline is a panel on the right. It shows the structure of the notebook.
Open or close it with ctrl+o (cell mode), :outline or :tags.
What it shows:
- One node for each cell, for example
c2 defines np, xs. A markdown cell shows its heading. - Below each cell: its imports, variables, functions (with their parameters) and classes.
- After a cell ran: the type and value of each variable, for example
xs list [1, 2, 3]. - At the bottom: the links of the cell, for example
← uses c1, c2 → used by c4.
The cursor of the outline follows you. It shows the current cell, or the function or class that contains the editor cursor.
Go to the outline with ctrl+w l from the rightmost window.
| Key | Action |
|---|---|
j / k
|
Move through the cells and their definitions |
enter |
On a cell: select it. On a definition: open the editor on that line |
h / l
|
Close / open a cell |
q |
Hide the outline and go back to the notebook |
escape, ctrl+w h
|
Go back to the notebook. The outline stays |
In insert mode, ctrl+o is a vim key. Use :outline there.
Press ctrl+w, then a key, as in vim.
In insert mode ctrl+w deletes a word. Press escape first.
| Key | Command | Action |
|---|---|---|
ctrl+w s |
:sp [file] |
New window below. Without a file: an empty notebook |
ctrl+w v |
:vs [file] |
New window on the right |
ctrl+w q |
:q |
Close this window. gpython asks if there are changes. The last window quits |
ctrl+w o |
:only |
Keep only this window |
| Key | Action |
|---|---|
ctrl+w h j k l
|
Window on the left / below / above / on the right |
ctrl+h / ctrl+l
|
Window on the left / right |
ctrl+w w / ctrl+w p
|
Next / previous window |
| Key | Command | Action |
|---|---|---|
ctrl+w z |
:zoom |
The window fills the tab. Press again to show the splits |
ctrl+w x |
Swap with the next window in the row or column | |
ctrl+w r / R
|
Rotate the windows of the row or column forward / back | |
ctrl+w H J K L
|
Move the window to the far left / bottom / top / right, at full height or width | |
ctrl+w T |
Move the window to a new tab | |
ctrl+w M |
:tabmerge |
Put the window back where T took it from. If that is not possible: the previous tab |
ctrl+w = |
Make all windows the same size | |
ctrl+w + / -
|
Taller / shorter | |
ctrl+w > / <
|
Wider / narrower | |
ctrl+w space |
:windows |
Open the window manager |
- When you go to a different window, split or close, the zoom ends.
- While a window is zoomed, the status line says so and the tab line shows
⤢on the tab. - When a tab has more than one window, each window has a status line with the file name, a mark for changes, and the kernel state. The line of the active window is highlighted.
The window manager is a floating list of all tabs, their windows, and the hidden buffers.
Open it with ctrl+w space or :windows.
- The left side is the list.
- The right side is a map of the layout of the selected tab, and data about the selected notebook: path, kernel, changes.
- The popup shows its keys at the bottom.
- Moves and closes keep the popup open. Thus you can arrange a layout in one operation.
| Key | Action |
|---|---|
j k, arrows, g G
|
Move |
| Click on the selected row, or double-click | 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 / adjacent to the window you came from |
t |
Give it its own tab |
z |
Go there and zoom |
x |
Close its window, or a full tab. The notebook stays as a hidden buffer |
d |
Delete the buffer and stop its kernel |
D |
The same, also when there are changes that are not saved |
J / K
|
Move its tab right / left |
1–9
|
Go to that tab |
/ |
Filter by name. escape clears the filter. A second escape closes |
| Key or command | Action |
|---|---|
:tabnew [file] |
New tab |
gt / gT / 2gt
|
Next / previous / second tab. Normal mode and cell mode |
:tabn [N] / :tabp
|
Next tab (or tab N) / previous tab |
:tabfirst / :tablast
|
First / last tab |
:tabclose |
Close this tab |
:tabonly |
Close all other tabs |
:tabmove N |
Move this tab. 0 is the start, last is the end, +1 and -1 move one position |
- The tab line shows above the notebook when there are two or more tabs, or a hidden buffer.
- A click on a tab goes to it.
-
gpython a.py b.pyopens one tab for each file.
gpython gives each buffer a number in the sequence of opening.
When you close a window (:q, ctrl+w q, :tabclose), gpython only hides the notebook:
- Its variables and outputs stay.
- Its kernel process continues to run.
- The tab line lists the hidden buffers. A click on one shows it.
To release the kernel, delete the buffer with :bd.
| Command | Action |
|---|---|
:ls, :buffers
|
List the buffers |
:b N, :b name
|
Show that buffer in the current window. A part of the name is sufficient if only one buffer matches |
:bn / :bp
|
Next / previous buffer in the current window |
:bd [N] |
Delete the buffer and stop its kernel. gpython asks if there are changes |
:bd! [N] |
The same, and do not ask |
:e file |
Open a file in the current window. gpython refuses if there are changes |
:e! file |
The same, and discard the changes |
Marks in the :ls list:
| Mark | Meaning |
|---|---|
%a |
The current buffer |
a |
A window shows the buffer |
h |
Hidden |
+ |
Has changes that are not saved |
| Command | Action |
|---|---|
:w |
Save the current notebook |
:wa |
Save all buffers |
:q |
Close the window. On the last window: quit. gpython asks about each buffer that is not saved |
:qa |
Quit |
:wqa |
Save all and quit |
Use the notebook
- Getting started
- Command line
- Running cells
- Keys
- Commands
- Vim
- Markdown cells
- Variables and the debugger
- Images
Set up the workspace
Help and project