ref(zsh): cli calculator

This commit is contained in:
thek4n 2024-05-28 15:53:12 +03:00
parent 634f0dee30
commit 2c3e82d3ed

View File

@ -9,10 +9,10 @@ aliases[=]='noglob __calc'
function accept-line() {
if [[ $BUFFER =~ '^[ ]?\(?[-+]?[0-9]+' ]]; then
if [[ $BUFFER =~ '^[ ]?\(?[-+]?[0-9]+[^a-zA-Z]+' ]]; then
echo
test "$BUFFER[1]" != " " && print -S -- "$BUFFER" # saving the command to history
__calc "$BUFFER"
__calc "$BUFFER" | sed 's/\.$//'
BUFFER=
fi
zle .$WIDGET