ref(zsh): cli calculator
This commit is contained in:
parent
634f0dee30
commit
2c3e82d3ed
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user