2003-03-28 12:34:07 +01:00
|
|
|
emulate -L zsh
|
|
|
|
setopt extendedglob
|
|
|
|
|
|
|
|
autoload match-words-by-style
|
|
|
|
|
|
|
|
local curcontext=":zle:$WIDGET" word done
|
|
|
|
local -a matched_words
|
|
|
|
integer count=${NUMERIC:-1}
|
|
|
|
|
|
|
|
if (( count < 0 )); then
|
2007-04-19 16:16:22 +02:00
|
|
|
(( NUMERIC = -count ))
|
|
|
|
zle ${WIDGET##backward-}
|
|
|
|
return
|
2003-03-28 12:34:07 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
while (( count-- )); do
|
|
|
|
|
2007-04-19 16:16:22 +02:00
|
|
|
match-words-by-style
|
2003-03-28 12:34:07 +01:00
|
|
|
|
2007-04-19 16:16:22 +02:00
|
|
|
word="$matched_words[2]$matched_words[3]"
|
2003-03-28 12:34:07 +01:00
|
|
|
|
2007-04-19 16:16:22 +02:00
|
|
|
if [[ -n $word ]]; then
|
|
|
|
if [[ -n $done || $LASTWIDGET = *kill* ]]; then
|
|
|
|
CUTBUFFER="$word$CUTBUFFER"
|
2003-03-28 12:34:07 +01:00
|
|
|
else
|
2007-11-10 15:30:22 +01:00
|
|
|
zle copy-region-as-kill -- "$word"
|
2003-03-28 12:34:07 +01:00
|
|
|
fi
|
2007-04-19 16:16:22 +02:00
|
|
|
LBUFFER=$matched_words[1]
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
done=1
|
2003-03-28 12:34:07 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
return 0
|