Select Git revision
watch.plugin.zsh 810 B
# ------------------------------------------------------------------------------
# Description
# -----------
#
# watch will be inserted before the command
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Connard <baptiste.gc@student-cs.fr>
#
# ------------------------------------------------------------------------------
watch-command-line() {
[[ -z $BUFFER ]] && LBUFFER="$(fc -ln -1)"
if [[ $BUFFER == watch\ * ]]; then
if [[ ${#LBUFFER} -le 4 ]]; then
RBUFFER="${BUFFER#watch }"
LBUFFER=""
else
LBUFFER="${LBUFFER#watch }"
fi
else
LBUFFER="watch $LBUFFER"
fi
}
zle -N watch-command-line
# Defined shortcut keys: [Alt] [Esc]
bindkey '^\e' watch-command-line