Skip to content

Instantly share code, notes, and snippets.

@elig0n
Created April 23, 2020 11:53
Show Gist options
  • Save elig0n/9e7011a11dcacd502d68811f3f5fb108 to your computer and use it in GitHub Desktop.
Save elig0n/9e7011a11dcacd502d68811f3f5fb108 to your computer and use it in GitHub Desktop.
Display bash-like (args: N) when using multipliers
# Display NUMERIC too
zle -N digit-argument _digit_argument
zle -N neg-argument _digit_argument
function _digit_argument () {
if [[ $WIDGET = neg-argument ]]; then
if [[ -n $NUMERIC ]]; then
zle -M - ""
else
zle -M - -
fi
elif [[ $LASTWIDGET = neg-argument ]]; then
zle -M - "$((NUMERIC * $KEYS[-1] ? NUMERIC * $KEYS[-1] : $KEYS[-1]))"
else
zle -M - "(arg: $NUMERIC$KEYS[-1])"
fi
zle .$WIDGET
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment