about summary refs log tree commit diff
path: root/Completion/Commands/_history_complete_word
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Commands/_history_complete_word')
-rw-r--r--Completion/Commands/_history_complete_word20
1 files changed, 6 insertions, 14 deletions
diff --git a/Completion/Commands/_history_complete_word b/Completion/Commands/_history_complete_word
index 8c531a12b..ecd2471e5 100644
--- a/Completion/Commands/_history_complete_word
+++ b/Completion/Commands/_history_complete_word
@@ -1,4 +1,4 @@
-#compdef -k complete-word \e/ \e,
+#compdef -K _history-complete-older complete-word \e/ _history-complete-newer complete-word \e,
 #
 # Complete words from the history
 #
@@ -19,19 +19,11 @@
 _history_complete_word () {
   local expl direction
 
-  case "$KEYS" in 
-    ',')  direction='newer'
-            ;;
-    '/')  direction='older'
-            ;;
-        *)  print <<EOF
-The keypress \`$KEYS\' was not understood by _history_complete_word.
-You must alter _history_complete_word if you want to bind it to keys
-other than the defaults, so that it knows which direction the key
-should move in the history.
-EOF
-            return 1
-  esac
+  if [[ $WIDGET = *newer ]]; then
+    direction=older
+  else
+    direction=newer
+  fi
 
   [[ -z "$compconfig[history_list]" ]] && compstate[list]=''