Skip to content

Editing cells

Editing a cell with vim motions

jOtter is modal, like vim. Notebook mode works on whole cells: selecting, running, adding, deleting. Edit mode works on the text inside one cell, with its own vim-style normal and insert modes. The status line shows the mode (VIEW in notebook mode), and the cursor shape changes with it: a block in normal mode, a bar in insert mode.

Key Does
Enter Edit the selected cell, in normal mode
i Edit in insert mode, cursor at the start
A Edit in insert mode, cursor at the end
double-click Edit in insert mode at the click
Esc Insert mode → normal mode; normal mode → leave the cell

Leaving the cell keeps your changes in the notebook (it isn’t saved to disk until you press w).

As in vim, : opens a command line, both in notebook mode and in the editor’s normal mode: :w saves (and keeps you in the cell), :q leaves the cell, :wq does both. In notebook mode :q quits jOtter and :5 jumps to cell 5. See all commands. Shift+Enter and Ctrl+Enter work inside the editor too: they leave the cell and run it.

The default editor covers the vim keys you use most:

Keys Does
h j k l, arrows Move
w b e Next word, previous word, end of word
0 ^ $ Line start, first non-blank, line end
gg G First line, last line
i a I A Insert before / after the cursor, at line start / end
o O Open a line below / above
x D dd Delete a character, to end of line, the line
yy p P Yank the line, put below / above
u Ctrl+r Undo, redo

In insert mode, Tab inserts four spaces, or opens completion right after a name. Ctrl+\ splits the cell at the cursor.

The builtin editor deliberately stops there: no counts, no text objects, no visual mode, no macros. For those, you have two options:

  • Set editor = "nvim" and an embedded Neovim handles all cell editing, with your own config.
  • Press E in notebook mode to edit the cell in your $EDITOR.

f formats the selected code cell and F every code cell, with Ruff by default. See Formatting code for format_on_save and other formatters.

Long lines wrap to the terminal width instead of running off the edge, both while editing and when displayed. Wrapping is visual only: the source keeps its lines exactly as you typed them.

t (for type) cycles the selected cell through code → markdown → latex. A latex cell is a raw cell marked as text/latex, rendered entirely as math. See Markdown cells and Math and LaTeX.

Code cells are highlighted in the notebook’s language (Python, Julia, R, …), taken from the notebook’s metadata.