calcli 0.4.0

Fast terminal calculator (TUI) with history, variables and engineering helpers
Documentation
# Example calcli configuration.
#
# Copy to your config directory to customize defaults:
#   $XDG_CONFIG_HOME/calcli/config.toml   (or ~/.config/calcli/config.toml)
#
# Every key is optional; omitted keys keep the built-in default shown below.
# Merging is per key, not per section: setting one colour leaves the rest alone.
#
# A config.toml written for calcli 0.2 (a flat `[theme]` table and a top-level
# `glyphs`) still loads; its colours are mapped onto the sections below. The 0.2
# shape is deprecated but supported, with one exception: `history_zebra` was
# removed, and an unknown key is an error rather than a shrug. Delete that one
# line and the rest of the file loads as it always did.


## Calculation and display ####################################################

# Default notation: "decimal", "scientific" or "siprefixed".
notation = "decimal"

# Fractional digits in decimal and scientific notation.
decimals = 3

# Default angle mode for trig functions: "rad" or "deg".
angle_mode = "rad"

# Decimal mark used for display and accepted on input: "." or ",".
# (The other of . / , is always accepted as a thousands separator on input.)
decimal_separator = "."

# Thousands group separator used for display (a space by default; "" disables).
thousands_separator = " "

# Drop trailing fractional zeros on display (12 instead of 12.000, 1.5 k instead
# of 1.500 k). `decimals` still caps the precision. Toggle at runtime with F6.
trim_trailing_zeros = true

# Maximum number of history lines kept.
max_history = 500

# On startup, restore the last session's settings (true) or always start from
# the defaults above (false). Variables and history are restored either way.
restore_last_settings = true


## Behaviour ##################################################################

# Show a live result preview / validity warning on the input border as you type.
live_feedback = true

# Ask before deleting a history line, clearing the history or resetting the
# variables.
confirm_delete = true

# Ask before the soft quit (`q` outside the input, or the `:q` command).
# The hard `Ctrl+Q` chord always exits at once and never asks.
confirm_quit = false


## The history list ###########################################################

# Blank lines inserted after each history entry's result.
history_spacing = 1

# Draw a separator line in the gap between history entries (needs spacing >= 1).
# These rules replaced the alternating background tint of calcli 0.2; a leftover
# `history_zebra` key in this file is now a startup error, so delete the line.
history_separator = true

# Max height (in text lines) the input field grows to as a long expression wraps.
input_max_lines = 5


## Appearance #################################################################

[appearance]
# The theme: "calcli" (the default), "default", "monochrome", or any theme you
# define under [themes.<name>] below. Cycle it at runtime in the Settings view.
theme = "calcli"

# Glyph set: "unicode" or "ascii".
glyphs = "unicode"

# Per-colour overrides on top of the selected theme. The names are the palette's
# own; anything else is ignored with a warning. Values are "#rrggbb", "#rgb",
# "rgb(r, g, b)" or a colour name.
#
#   accent  accent_dim  accent_vivid
#   foreground  foreground_dim  foreground_muted
#   background  header  footer  panel  surface
#   selection  cursor  input_bg  input_bg_active  border  border_focus
#   success  warning  error  info
[appearance.colors]
# The block cursor in the input field, deliberately distinct from the accent.
cursor = "#d65c5c"

# The input field's resting and focused fills. Left to itself the toolkit derives
# these by lightening `surface`, which overshoots on calcli's near-black surface.
# At rest the field recedes into the content; focused it lifts clearly above it,
# but stays below its own border.
input_bg = "#100e15"
input_bg_active = "#262336"

# The frame around the input box. `border_focus` is what it draws while the
# field has the keyboard; left out it follows `border`, and overriding `border`
# alone drags it along, so the focused frame never sinks into its own border.
# The `calcli` theme sets both, so neither needs an override here.
#
# border = "#3e3e3e"
# border_focus = "#4a7c60"

# The tint behind the selected history entry and the selected list row. Derived
# by mixing a third of the accent into `surface`, which shouts on calcli's dark
# surface; this keeps the accent hue at the weight of the focused input field.
selection = "#354440"


## Syntax highlighting ########################################################

# Token colours for the expression (input, history and in-place editing).
# Operators are always rendered bold, parentheses dim, `ans` underlined and
# comments italic; these set the colour only.
[highlight]
function = "#78c2b3"
constant = "#7c94ff"
operator = "#fe7057"
number = "#e5cb49"
variable = "#b27cde"
ans = "#7dcfff"
comment = "#67c1e5"
unit = "#ff79c6"


## Custom themes ##############################################################

# Define your own theme and select it with `[appearance].theme`. Only `accent`,
# `foreground` and `background` are required; the neutrals are derived from the
# background unless you set them.
#
# [themes.solarized]
# accent = "#268bd2"
# foreground = "#839496"
# background = "#002b36"
# header = "#00212b"
# footer = "#00212b"
# surface = "#073642"
# border = "#0a4a5a"
# border_focus = "#1d7f96"   # omit it and it is derived from `border`
#
# A theme may set: accent, foreground, background, header, footer, panel,
# surface, border, border_focus, success, warning, error, info. Anything else
# (cursor, selection, the input fills, …) is derived by the toolkit and belongs
# in [appearance.colors]; naming it here is reported and ignored.


## Key bindings ###############################################################

# Rebind any action. A value is one key or a list of keys. Modifiers are
# `ctrl+`, `alt+` and `shift+`. On a character, shift is carried by the case
# (`D` is Shift+D) and `shift+` is ignored; on any other key it is part of the
# chord, so `shift+left` and `left` are two different keys. Function keys are
# `f1`..`f12`; named keys are `enter`, `esc`, `tab`, `backtab`, `space`,
# `backspace`, `insert`, `del`, `home`, `end`, `pgup`, `pgdn` and the arrows.
#
# `ctrl+q` is not bindable: it is the toolkit's unconditional escape hatch, and
# `f1` toggles the shortcut hints. Both are shown in the footer's Global group.
#
# A key already claimed by an earlier action in an overlapping context is
# ignored with a warning, so a shadowed binding never fails silently.
#
# [keys]
# # Views (the Calc view is a text field, so bare digits stay typeable)
# view_calc = "alt+1"
# view_variables = ["alt+2", "f4"]
# view_settings = "alt+3"
#
# # Settings, reachable from every view
# notation = "f2"
# angle_mode = "f3"
# decimal_separator = "f5"
# trim_zeros = "f6"
#
# # Global
# help = ["f12", "?"]
# quit = "q"
# copy_result = "ctrl+y"
# search_history = "ctrl+r"
# palette = "ctrl+p"
#
# # The input field
# submit = "enter"
# enter_history = ["up", "pgup"]
# clear_input = "esc"
#
# # Editing a history line in place
# apply_edit = "enter"
# cancel_edit = "esc"
#
# # Any list (history, variables, settings)
# up = "up"
# down = "down"
# page_up = "pgup"
# page_down = "pgdn"
# top = "home"
# bottom = "end"
# copy = "y"
# copy_displayed = "Y"
# back = "esc"
#
# # The history list
# edit = ["enter", "e"]
# insert_below = "o"
# insert_above = "O"
# move_up = "alt+up"
# move_down = "alt+down"
# delete = ["d", "del"]
# clear = "D"
#
# # The variables list
# insert_variable = "enter"
# delete_variable = ["d", "del"]
# reset_variables = "R"
#
# # The settings list
# prev_value = "left"
# next_value = ["right", "enter"]