Skip to content

Commands

igaurab edited this page Nov 18, 2026 · 3 revisions

Press : in cell mode or normal mode, type the command, then press enter. :help shows the keys and the commands in gpython. ctrl+p in cell mode shows the command palette.

Text in [ ] is optional.

Save and quit

Command Action
:w [file] Save. With a name, save as that file
:wa Save all notebooks
:q Close this window. The last window quits gpython. gpython asks about changes that are not saved
:q! Close this window and do not save
:wq, :x, :exit Save and close this window
:qa Quit. gpython asks about changes that are not saved
:qa! Quit and do not save
:wqa [file], :xa Save all notebooks and quit. The name is for a notebook that has none

Save and quit commands accept capital letters: :Q!, :WQ!, :Wq, :W, :X and :QA! work. Other commands do not: :D is not :d. :w!, :wq!, :x!, :wqa! and :xa! do the same as the forms without !.

Files and buffers

Command Action
:e file Open a file in this window. gpython refuses if there are changes that are not saved
:e! file Open a file in this window and discard the changes
:e or :e folder Open the file explorer
:Ex Show or hide the file explorer. Also :Explore, :tree
:find [text] Find a file by name. Same as space f f
:ls, :buffers List the buffers
:b N, :b name Show a buffer in this window
:bn / :bp Next / previous buffer
:bd [N] Close a buffer and stop its kernel
:bd! [N] The same, and do not ask about changes

Windows and tabs

Command Action
:sp [file] Split into top and bottom
:vs [file] Split into left and right
:split v [file] / :split h [file] Split into left and right / top and bottom. The direction comes before the file name
:only Close all other windows in this tab
:zoom Make this window fill the tab, or show the splits again
:windows, :wm Open the window manager
:tabnew [file] Make a new tab
:tabclose Close this tab
:tabonly Close all other tabs
:tabn [N] / :tabp Next tab (or tab N) / previous tab
:tabfirst / :tablast First / last tab
:tabmove N Move this tab. 0 is the start, last is the end, +1 and -1 move one position
:tabmerge Move this window back into the tab it came from

Run

Command Action
:run Run all cells
:run 6 Run cell c6, after the stale cells that it uses
:runabove Run the cells above this cell
:runbelow Run this cell and the cells below it
:stale Run the stale cells
:timeit [n] Measure the run time of this cell over n runs
:interrupt Stop the code that runs
:restart Restart the kernel
:lazy Change the run mode
:groups Show which cells can run at the same time
:debug Debug this cell
:stop if EXPR In the debugger: run until EXPR is true

Cells

Command Action
:N Go to cell N
:new Make a new cell below
:delete, :d Delete the cell. In the editor, :d deletes lines
:undo / :redo Undo / redo
:md / :code Change the cell to markdown / code
:hide / :show Hide / show the code of this cell, or fold / unfold a markdown cell
:foldclose [all] / :foldopen [all] The same, for this cell or for all cells
:clear Clear all outputs
:copy Copy this cell to the clipboard
:copy all Copy the notebook as code. Markdown cells become comments
:copy all metadata The same, and keep the # %% lines

Images

Command Action
:img [N] Show image N of this cell on the full screen
:img save [N] [file] Save it as PNG
:img open [N] Open it in the browser
:img save all / :img open all Use the images of all cells

See Images.

Panels

Command Action
:outline, :tags Show or hide the outline panel
:vars Show or hide the variables panel
:theme [name] Set the theme. Without a name, show the current theme
:help Show the keys and commands
:version Show the gpython version

Python environment

Command Action
:env Open the environment picker
:env name, :env path Change to that environment
:venv [folder] [python] Make an environment with python -m venv and use it
:uv venv [folder] [python] Make an environment with uv and use it
:uv add pkg Add a package to the project
:uv ... Run a different uv command in the project
:sync [name ...] Install what the uv project declares. A name is an extra or a dependency group
:pip pkg ... Install packages into the environment of the kernel
:pip Offer the packages that this cell needs
:pip list, :pip uninstall pkg List / remove packages

See Python environments.

Settings

Command Action
:set name / :set noname Turn a setting on / off
:set name=value Give a setting a value
:set debug_history? Show the value of a debug_ setting and where it comes from
:time Show or hide the run time in cell headers

All settings are on the Configuration page.

Text commands

These commands work on the lines of the editor. See Vim.

Command Action
:s/a/b/g, :%s/a/b/g Replace text
:&& Do the last replacement again, with its flags
:g/pat/cmd, :v/pat/cmd Run a command on each line that matches / does not match
:d, :j, :m, :t, :co, :>, :<, :normal Line commands on a range
:noh Remove the search highlight
:digraphs List the digraphs

Other names

Many commands have short or long forms, as in vim. Examples:

Command Other names
:q :quit, :close
:e :edit, :open
:sp / :vs :split / :vsplit, :vsp
:tabnew :tabe, :tabedit
:env :kernel, :envs
:img :image
:timeit :profile
:stale :runstale
:copy :yank
:find :fin, :Telescope

Clone this wiki locally