fix zsh inline calculator
This commit is contained in:
parent
baa87509da
commit
3f0fdef139
@ -12,13 +12,17 @@ aliases[=]='noglob __calc'
|
||||
|
||||
|
||||
function accept-line() {
|
||||
if [[ $BUFFER =~ '^[ ]?\(?[-+]?[0-9]+[^a-zA-Z]+' ]]; then
|
||||
if [[ -z "${BUFFER}" ]]; then
|
||||
echo
|
||||
test "$BUFFER[1]" != " " && print -S -- "$BUFFER" # saving the command to history
|
||||
__calc "$BUFFER" | sed 's/\.$//'
|
||||
ls
|
||||
elif [[ ${BUFFER} =~ '^[ ]?\(?[-+]?[0-9]+[^a-zA-Z]+' ]]; then
|
||||
echo
|
||||
test "${BUFFER[1]}" != " " && print -S -- "${BUFFER}" # saving the command to history
|
||||
__calc "${BUFFER}" | sed 's/\.$//'
|
||||
BUFFER=
|
||||
fi
|
||||
zle .$WIDGET
|
||||
|
||||
zle .${WIDGET}
|
||||
}
|
||||
|
||||
zle -N accept-line
|
||||
|
||||
@ -81,20 +81,3 @@ cddotdot() {
|
||||
zle -N cddotdot
|
||||
bindkey "^O" cddotdot
|
||||
bindkey -M vicmd "^O" cddotdot
|
||||
|
||||
|
||||
accept-line-or-list-dir() {
|
||||
if [ -n "${LBUFFER}${RBUFFER}" ]; then
|
||||
zle .accept-line
|
||||
return
|
||||
fi
|
||||
|
||||
echo
|
||||
ls
|
||||
echo
|
||||
zle reset-prompt
|
||||
}
|
||||
|
||||
zle -N accept-line-or-list-dir
|
||||
bindkey "^M" accept-line-or-list-dir
|
||||
bindkey -M vicmd "^M" accept-line-or-list-dir
|
||||
Loading…
x
Reference in New Issue
Block a user