add POWERLEVEL9K_RBENV_SOURCES; see #333

pull/352/head
romkatv 5 years ago
parent 700910cd04
commit 1be144aed3

@ -655,7 +655,10 @@
#############[ rbenv: ruby version from rbenv (https://github.com/rbenv/rbenv) ]############## #############[ rbenv: ruby version from rbenv (https://github.com/rbenv/rbenv) ]##############
# Rbenv color. # Rbenv color.
typeset -g POWERLEVEL9K_RBENV_FOREGROUND=168 typeset -g POWERLEVEL9K_RBENV_FOREGROUND=168
# Don't show ruby version if it's the same as global: $(rbenv version-name) == $(rbenv global). # Hide ruby version if it doesn't come from one of these sources.
typeset -g POWERLEVEL9K_RBENV_SOURCES=(shell local global)
# If set to false, hide ruby version if it's the same as global:
# $(rbenv version-name) == $(rbenv global).
typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_RBENV_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_RBENV_VISUAL_IDENTIFIER_EXPANSION='⭐'

@ -631,7 +631,10 @@
#############[ rbenv: ruby version from rbenv (https://github.com/rbenv/rbenv) ]############## #############[ rbenv: ruby version from rbenv (https://github.com/rbenv/rbenv) ]##############
# Rbenv color. # Rbenv color.
typeset -g POWERLEVEL9K_RBENV_FOREGROUND=168 typeset -g POWERLEVEL9K_RBENV_FOREGROUND=168
# Don't show ruby version if it's the same as global: $(rbenv version-name) == $(rbenv global). # Hide ruby version if it doesn't come from one of these sources.
typeset -g POWERLEVEL9K_RBENV_SOURCES=(shell local global)
# If set to false, hide ruby version if it's the same as global:
# $(rbenv version-name) == $(rbenv global).
typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_RBENV_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_RBENV_VISUAL_IDENTIFIER_EXPANSION='⭐'

@ -669,7 +669,10 @@
# Rbenv color. # Rbenv color.
# typeset -g POWERLEVEL9K_RBENV_FOREGROUND=0 # typeset -g POWERLEVEL9K_RBENV_FOREGROUND=0
# typeset -g POWERLEVEL9K_RBENV_BACKGROUND=1 # typeset -g POWERLEVEL9K_RBENV_BACKGROUND=1
# Don't show ruby version if it's the same as global: $(rbenv version-name) == $(rbenv global). # Hide ruby version if it doesn't come from one of these sources.
typeset -g POWERLEVEL9K_RBENV_SOURCES=(shell local global)
# If set to false, hide ruby version if it's the same as global:
# $(rbenv version-name) == $(rbenv global).
typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_RBENV_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_RBENV_VISUAL_IDENTIFIER_EXPANSION='⭐'

@ -2111,18 +2111,23 @@ function _p9k_rbenv_global_version() {
# https://github.com/rbenv/rbenv#choosing-the-ruby-version # https://github.com/rbenv/rbenv#choosing-the-ruby-version
prompt_rbenv() { prompt_rbenv() {
(( $+commands[rbenv] || $+functions[rbenv] )) || return (( $+commands[rbenv] || $+functions[rbenv] )) || return
if [[ -n $RBENV_VERSION ]]; then
(( ${_POWERLEVEL9K_RBENV_SOURCES[(I)shell]} )) || return
local v=$RBENV_VERSION local v=$RBENV_VERSION
if [[ -z $v ]]; then else
(( ${_POWERLEVEL9K_RBENV_SOURCES[(I)local|global]} )) || return
[[ $RBENV_DIR == /* ]] && local dir=$RBENV_DIR || local dir="$_p9k_pwd_a/$RBENV_DIR" [[ $RBENV_DIR == /* ]] && local dir=$RBENV_DIR || local dir="$_p9k_pwd_a/$RBENV_DIR"
while true; do while true; do
if _p9k_read_rbenv_version_file $dir/.ruby-version; then if _p9k_read_rbenv_version_file $dir/.ruby-version; then
v=$_p9k_ret (( ${_POWERLEVEL9K_RBENV_SOURCES[(I)local]} )) || return
local v=$_p9k_ret
break break
fi fi
if [[ $dir == / ]]; then if [[ $dir == / ]]; then
(( _POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW )) || return (( _POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW )) || return
(( ${_POWERLEVEL9K_RBENV_SOURCES[(I)global]} )) || return
_p9k_rbenv_global_version _p9k_rbenv_global_version
v=$_p9k_ret local v=$_p9k_ret
break break
fi fi
dir=${dir:h} dir=${dir:h}
@ -4776,6 +4781,7 @@ _p9k_init_params() {
_p9k_declare -b POWERLEVEL9K_GO_VERSION_PROJECT_ONLY 1 _p9k_declare -b POWERLEVEL9K_GO_VERSION_PROJECT_ONLY 1
_p9k_declare -b POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY 1 _p9k_declare -b POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY 1
_p9k_declare -b POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW 0 _p9k_declare -b POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW 0
_p9k_declare -a POWERLEVEL9K_RBENV_SOURCES -- shell local global
_p9k_declare -b POWERLEVEL9K_RVM_SHOW_GEMSET 0 _p9k_declare -b POWERLEVEL9K_RVM_SHOW_GEMSET 0
_p9k_declare -b POWERLEVEL9K_RVM_SHOW_PREFIX 0 _p9k_declare -b POWERLEVEL9K_RVM_SHOW_PREFIX 0
_p9k_declare -b POWERLEVEL9K_CHRUBY_SHOW_VERSION 1 _p9k_declare -b POWERLEVEL9K_CHRUBY_SHOW_VERSION 1
@ -5315,7 +5321,7 @@ _p9k_must_init() {
[[ $sig == $_p9k__param_sig ]] && return 1 [[ $sig == $_p9k__param_sig ]] && return 1
_p9k_deinit _p9k_deinit
fi fi
_p9k__param_pat=$'v8\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1' _p9k__param_pat=$'v9\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1'
_p9k__param_pat+=$'${#parameters[(I)POWERLEVEL9K_*]}\1${(%):-%n%#}\1$GITSTATUS_LOG_LEVEL\1' _p9k__param_pat+=$'${#parameters[(I)POWERLEVEL9K_*]}\1${(%):-%n%#}\1$GITSTATUS_LOG_LEVEL\1'
_p9k__param_pat+=$'$GITSTATUS_ENABLE_LOGGING\1$GITSTATUS_DAEMON\1$GITSTATUS_NUM_THREADS\1' _p9k__param_pat+=$'$GITSTATUS_ENABLE_LOGGING\1$GITSTATUS_DAEMON\1$GITSTATUS_NUM_THREADS\1'
_p9k__param_pat+=$'$DEFAULT_USER\1${ZLE_RPROMPT_INDENT:-1}\1$P9K_SSH\1$__p9k_ksh_arrays' _p9k__param_pat+=$'$DEFAULT_USER\1${ZLE_RPROMPT_INDENT:-1}\1$P9K_SSH\1$__p9k_ksh_arrays'

Loading…
Cancel
Save