As initially submitted at https://github.com/zsh-users/zsh/pull/116 :



As mentioned in the code comment:

  # 1 means last word, 2 second last, etc.

the numeric argument is supposed to be interpreted as an offset from the end.

The intended behavior is a lot more useful than the current behavior.






diff --git a/Functions/Zle/copy-earlier-word b/Functions/Zle/copy-earlier-word
index 90e862da3..1262c0c82 100644
--- a/Functions/Zle/copy-earlier-word
+++ b/Functions/Zle/copy-earlier-word
@@ -11,7 +11,7 @@ setopt typesetsilent
 typeset -g __copyword
 if (( ${NUMERIC:-0} )); then
   # 1 means last word, 2 second last, etc.
-  (( __copyword = ${NUMERIC:-0} ))
+  (( __copyword = -${NUMERIC:-0} ))
   zstyle -s :$WIDGET widget __copywidget
 elif [[ -n $__copyword && $WIDGET = $LASTWIDGET ]]; then
   (( __copyword-- ))