From 417c814e2ef6b3fd52a13b8fc04c0c9f09d61924 Mon Sep 17 00:00:00 2001 From: Masafumi Koba <473530+ybiquitous@users.noreply.github.com> Date: Mon, 12 Oct 2026 19:47:39 +0900 Subject: [PATCH] feat(rbenv): provide completion for `rbenv` command (#12891) Ref https://github.com/rbenv/rbenv/#shell-completions --- plugins/rbenv/README.md | 2 ++ plugins/rbenv/rbenv.plugin.zsh | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/rbenv/README.md b/plugins/rbenv/README.md index 43a2e93ac..720730337 100644 --- a/plugins/rbenv/README.md +++ b/plugins/rbenv/README.md @@ -3,6 +3,8 @@ The primary job of this plugin is to provide `rbenv_prompt_info` which can be added to your theme to include Ruby version and gemset information into your prompt. +Additionally, this plugin provides completion for the `rbenv` command. See also . + Some functionality of this plugin will not work unless you also have the rbenv plugin *gemset* installed. https://github.com/jf/rbenv-gemset diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh index d758aebae..8785fd659 100644 --- a/plugins/rbenv/rbenv.plugin.zsh +++ b/plugins/rbenv/rbenv.plugin.zsh @@ -24,6 +24,13 @@ if [[ $FOUND_RBENV -ne 1 ]]; then fi if [[ $FOUND_RBENV -eq 1 ]]; then + rbenv_completions="${commands[rbenv]:A:h:h}/completions" + if [[ -f "$rbenv_completions/_rbenv" ]]; then + fpath+=("$rbenv_completions") + autoload -Uz _rbenv + compdef _rbenv rbenv + fi + eval "$(rbenv init --no-rehash - zsh)" alias rubies="rbenv versions" @@ -65,4 +72,4 @@ else } fi -unset FOUND_RBENV rbenvdirs dir +unset FOUND_RBENV rbenvdirs dir rbenv_completions