A plugin that allows you to run math calcuations without a prefix.
$ 10 + 20 30 $ 10 gigabyte / 100 megabyte 100
zsh-calc relies on an external calculation program.
By default it supports: qalc which has highlighting unit calculations and conversion, physical constants, symbolic calculations, etc;
calc, and bc. You can also configure other calculation programs see configuring. I recommend qalc.
#arch linux sudo pacman -S libqalculate # for other distros, search with your package manager for qalculate or qalc
To install the plugin itself, run the install.sh
.
To activate the plugin, source it at the bottom of your .zshrc
.
... source /usr/share/zsh/plugins/zsh-calc/zsh-calc.zsh
The auto detection system will pick the calculation program in this order:
To explicitly use a program, set CALC_CMD
to one of the values below
#qalc CALC_CMD="echo \$BUFFER > /tmp/"$USER"qalctemp; qalc -t -c -f /tmp/"$USER"qalctemp" #calc CALC_CMD="echo \$BUFFER > /tmp/"$USER"calctemp; calc -f /tmp/"$USER"calctemp" #bc CALC_CMD='echo \$BUFFER | bc -l' # custom # BUFFER is your command line CALC_CMD='echo \$BUFFER | CUSTOM_CALC'
If you are using zsh-sytnax-highlight, you can add this regex-highlight to highlight digits:
typeset -A ZSH_HIGHLIGHT_REGEXP ZSH_HIGHLIGHT_REGEXP+=('[0-9]' fg=cyan) ZSH_HIGHLIGHT_HIGHLIGHTERS+=(main regexp)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4