Skip to content
Snippets Groups Projects

add new plugin

Closed Baptiste Girard-Carrabin requested to merge watch-plugin into master
8 files
+ 55
2
Compare changes
  • Side-by-side
  • Inline
Files
8
+ 46
0
# ------------------------------------------------------------------------------
# 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 [[ -n $EDITOR && $BUFFER == $EDITOR\ * ]]; then
# if [[ ${#LBUFFER} -le ${#EDITOR} ]]; then
# RBUFFER=" ${BUFFER#$EDITOR }"
# LBUFFER="sudoedit"
# else
# LBUFFER="sudoedit ${LBUFFER#$EDITOR }"
# fi
# elif [[ $BUFFER == sudoedit\ * ]]; then
# if [[ ${#LBUFFER} -le 8 ]]; then
# RBUFFER=" ${BUFFER#sudoedit }"
# LBUFFER="$EDITOR"
# else
# LBUFFER="$EDITOR ${LBUFFER#sudoedit }"
# fi
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 -M emacs '^\e' watch-command-line
bindkey -M vicmd '^\e' watch-command-line
bindkey -M viins '^\e' watch-command-line
Loading