calcli
A fast terminal calculator (TUI) with an editable history, stored variables and a few helpers engineers reach for. Built with Ratatui.
Type an expression, press Enter, keep going. The previous result is available as ans, every line stays in an editable history (editing a line recomputes everything below it), and results keep full f64 precision internally even when the display is rounded.
Features
- History with recompute – each entry shows the input with its result on the line below (both soft-wrap long content). Edit any earlier line and every line below is re-evaluated, so ans chains stay correct.
- Full precision – the rounded value you see is only for display; further math always uses the exact internal value.
- Three views – Calc, Variables and Settings, switched with Alt+1 / Alt+2 / Alt+3 (the Calc view is a text field, so bare digits stay typeable). The active view is restored on the next start.
- Variables – save with =name (stores the last answer) or name = expr. Manage them in their own view: insert, copy, delete, reset all. Persisted.
- Notation – cycle decimal / scientific / SI-prefixed (F2); trailing fractional zeros are dropped by default (12, not 12.000), toggle with F6 or the trimtrailingzeros config key.
- Angle mode – toggle degrees / radians for trig (F3).
- Lenient input – spaces, and the non-decimal one of ./, are accepted as thousands separators; SI prefixes like 3.3k, 100u are expanded. Function arguments use ; (e.g. max(1;2)).
- Clipboard – y copies the plain, full-precision value (no grouping); Y copies it as shown (rounded, grouped).
- Growing input – long expressions soft-wrap and the input field grows (up to inputmaxlines); ↑/↓ move the caret across the wrapped lines, ↑ on the first line enters the history.
- Syntax highlighting – functions, constants, operators (bold), numbers, defined variables, units, parentheses and ans are coloured in the input, the history and while editing. Colours are configurable in the [highlight] table; unknown identifiers stay neutral.
- Live feedback – as you type, the input border shows a dim = value preview while the expression is valid and a subtle warning marker when it looks complete but won't parse (silent while still mid-typing). Toggle with livefeedback in the config.
- Settings view – every display setting on one editable list (←/→ steps the focused value, applied live), including the theme and the glyph set. The function keys keep working from every view.
- Shortcut hints – the footer lists the current view's keys, grouped, with a closing Global group. F1 hides the whole band (the state is remembered); F12 or ? opens the scrollable, fuzzy-filtered help overlay.
- Persistence – settings, variables, history and the interface state (active view, theme, glyphs, hint visibility) are saved on exit and restored next time (settings restore is configurable). Writes are atomic, and a state.toml from any older calcli still loads.
Install
calcli builds on Rust 1.88 or newer (MSRV).
From crates.io:
cargo install calcliOr from a local checkout:
cargo install --path .Or run without installing:
cargo run --releaseCommand line
calcli has exactly one job and therefore no subcommands: called without arguments it opens the calculator.
Usage: calcli [OPTIONS]
Options:
--demo Fills the session with sample data and leaves the saved state alone
-h, --help Shows this help and exits
-V, --version Shows the version and exits