Skip to content
Adrià Arrufat edited this page Jun 15, 2023 · 3 revisions

Qalculate! is a multipurpose cross-platform desktop calculator. It is simple to use but provides power and versatility normally reserved for complicated math packages, as well as useful tools for everyday needs (such as currency conversion and percent calculation). Features include a large library of customizable functions, unit calculations and conversion, physical constants, symbolic calculations (including integrals and equations), arbitrary precision, uncertainty propagation, interval arithmetic, plotting, and a user-friendly interface (GTK, Qt and CLI).

Creating a quick math prompt

It can be integrated into Kakoune as a drop-in replacement of bc for a math prompt:

map global normal = ': prompt math: %{exec "a%val{text}<lt>esc>|qalc -t +u8 -f -<lt>ret>"}<ret>'

Defining a command with autocompletion

We can also define a command that will perform computations and display the results on the status bar like this:

define-command qalc -docstring "compute equation with Qalculate!" -params .. %{echo %sh{qalc ${@}}}

Qalculate has many built-in functions and variables, we can improve the qalc command by generating autocomplete suggestions:

complete-command qalc shell-script-candidates %{
    { echo $(qalc +u8 --list-functions | head -n -3); echo $(qalc +u8 --list-variables | head -n -3); } | tr ' ' '\n' | sort -u
}
Clone this wiki locally