From 1fb9c83eb6cce967d9429aa1ee49d14c0f96d863 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Mon, 27 Jan 2003 16:41:15 +0000 Subject: 18143: cooperation between copy-earlier-word and smart-insert-last-word --- Functions/Zle/copy-earlier-word | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'Functions/Zle/copy-earlier-word') diff --git a/Functions/Zle/copy-earlier-word b/Functions/Zle/copy-earlier-word index bbc8af35c..63e7edaef 100644 --- a/Functions/Zle/copy-earlier-word +++ b/Functions/Zle/copy-earlier-word @@ -5,15 +5,20 @@ # and start from the word before last. Otherwise, it will operate on # the current line. +emulate -L zsh + if (( ${NUMERIC:-0} )); then - # 1 means last word, 2 second last, etc. - (( __copyword = ${NUMERIC:-0} )) + # 1 means last word, 2 second last, etc. + (( __copyword = ${NUMERIC:-0} )) + zstyle -s :$WIDGET widget __copywidget elif [[ -n $__copyword && $WIDGET = $LASTWIDGET ]]; then (( __copyword-- )) elif [[ $LASTWIDGET = *insert-last-word ]]; then __copyword=-2 + __copywidget=$LASTWIDGET else __copyword=-1 + zstyle -s :$WIDGET widget __copywidget fi -zle .insert-last-word 0 $__copyword +zle ${__copywidget:-.insert-last-word} 0 $__copyword -- cgit 1.4.1