Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

spectral-m2

A new face for the M2 prompt. It’s still the good old REPL underneath, just with a TUI that doesn’t feel like 1995.

cargo install spectral-m2 --locked
sp2

What’s nicer

  • Highlighting as you type, and Enter on an unfinished expression just continues it on the next line.
  • Rendered output: TeX becomes actual maths in the terminal (stacked fractions, ℚ if you like), long outputs fold, and help pages show up inline with clickable links.
  • Side views of your session: just the code, just the values, printed output, or the syntax tree of what you typed.
  • History with prefix search: type ide, press Up, get only things starting with ide. Shared live between open shells.
  • Sessions: your code is saved on exit and /resume brings it back (by re-running it). /save and /load work with any .m2 file.
  • Colour schemes: catppuccin, tokyo night, gruvbox, everforest, rosé pine, kanagawa… light and dark.

Your init.m2 and installed packages load as usual.

Getting around

Type / on an empty line and everything is listed. The ones you’ll use most:

Alt+C / V / P / TView code / values / printed output / syntax tree
Shift+EnterNew line
Alt+RRestart M2
Ctrl+OSettings (theme lives here)
Alt+KRebind keys
Ctrl+CQuit

You’ll need

  • M2 on your PATH
  • A terminal with true colour. Kitty, WezTerm, Ghostty, foot and the like are perfect.
  • A Nerd Font for the icons, or SPECTRAL_M2_BASIC_GLYPHS=1

Not yet

You can’t interrupt a running computation yet (a cell gives up after 5 minutes), and it’s one evaluation at a time.

Repository · crates.io