about summary refs log tree commit diff
path: root/Functions/Zle/copy-earlier-word
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2003-01-27 16:41:15 +0000
committerBart Schaefer <barts@users.sourceforge.net>2003-01-27 16:41:15 +0000
commit1fb9c83eb6cce967d9429aa1ee49d14c0f96d863 (patch)
treeac74015a933bc97f3284404e29ba70a8662b8a56 /Functions/Zle/copy-earlier-word
parentdae12df8cd7be415187cdb936e5103fb71436543 (diff)
downloadzsh-1fb9c83eb6cce967d9429aa1ee49d14c0f96d863.tar.gz
zsh-1fb9c83eb6cce967d9429aa1ee49d14c0f96d863.tar.xz
zsh-1fb9c83eb6cce967d9429aa1ee49d14c0f96d863.zip
18143: cooperation between copy-earlier-word and smart-insert-last-word
Diffstat (limited to 'Functions/Zle/copy-earlier-word')
-rw-r--r--Functions/Zle/copy-earlier-word11
1 files changed, 8 insertions, 3 deletions
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