if [[ ! -o interactive ]]; then
    return
fi

compctl -K _rbenv rbenv

_rbenv() {
  local words completions
  read -cA words

  if [ "${#words}" -eq 2 ]; then
    completions="$(rbenv commands)"
  else
    completions="$(rbenv completions ${words[2,-1]})"
  fi

  reply=("${(ps:\n:)completions}")
}

if [[ ! -o interactive ]]; then
    return
fi

compctl -K _rbenv rbenv

_rbenv() {
  local word words completions
  read -cA words
  word="${words[2]}"

  if [ "${#words}" -eq 2 ]; then
    completions="$(rbenv commands)"
  else
    completions="$(rbenv completions "${word}")"
  fi

  reply=("${(ps:\n:)completions}")
}

--- 
+++ 
@@ -5,13 +5,14 @@
 compctl -K _rbenv rbenv
 
 _rbenv() {
-  local words completions
+  local word words completions
   read -cA words
+  word="${words[2]}"
 
   if [ "${#words}" -eq 2 ]; then
     completions="$(rbenv commands)"
   else
-    completions="$(rbenv completions ${words[2,-1]})"
+    completions="$(rbenv completions "${word}")"
   fi
 
   reply=("${(ps:\n:)completions}")
Add zsh support for completion of full command line
