ref(zsh): cli calculator
This commit is contained in:
parent
634f0dee30
commit
2c3e82d3ed
@ -9,10 +9,10 @@ aliases[=]='noglob __calc'
|
|||||||
|
|
||||||
|
|
||||||
function accept-line() {
|
function accept-line() {
|
||||||
if [[ $BUFFER =~ '^[ ]?\(?[-+]?[0-9]+' ]]; then
|
if [[ $BUFFER =~ '^[ ]?\(?[-+]?[0-9]+[^a-zA-Z]+' ]]; then
|
||||||
echo
|
echo
|
||||||
test "$BUFFER[1]" != " " && print -S -- "$BUFFER" # saving the command to history
|
test "$BUFFER[1]" != " " && print -S -- "$BUFFER" # saving the command to history
|
||||||
__calc "$BUFFER"
|
__calc "$BUFFER" | sed 's/\.$//'
|
||||||
BUFFER=
|
BUFFER=
|
||||||
fi
|
fi
|
||||||
zle .$WIDGET
|
zle .$WIDGET
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user