add plenv prompt segment; see #342

pull/411/head
romkatv 5 years ago
parent d8b847c67f
commit a9620d7dca

@ -64,6 +64,7 @@
fvm # flutter version management (https://github.com/leoafarias/fvm) fvm # flutter version management (https://github.com/leoafarias/fvm)
luaenv # lua version from luaenv (https://github.com/cehoffman/luaenv) luaenv # lua version from luaenv (https://github.com/cehoffman/luaenv)
jenv # java version from jenv (https://github.com/jenv/jenv) jenv # java version from jenv (https://github.com/jenv/jenv)
plenv # perl version from plenv (https://github.com/tokuhirom/plenv)
kubecontext # current kubernetes context (https://kubernetes.io/) kubecontext # current kubernetes context (https://kubernetes.io/)
terraform # terraform workspace (https://www.terraform.io) terraform # terraform workspace (https://www.terraform.io)
aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html)
@ -744,6 +745,17 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_JENV_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_JENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
###########[ plenv: perl version from plenv (https://github.com/tokuhirom/plenv) ]############
# Perl color.
typeset -g POWERLEVEL9K_PLENV_FOREGROUND=67
# Hide perl version if it doesn't come from one of these sources.
typeset -g POWERLEVEL9K_PLENV_SOURCES=(shell local global)
# If set to false, hide perl version if it's the same as global:
# $(plenv version-name) == $(plenv global).
typeset -g POWERLEVEL9K_PLENV_PROMPT_ALWAYS_SHOW=false
# Custom icon.
# typeset -g POWERLEVEL9K_PLENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
################[ terraform: terraform workspace (https://www.terraform.io) ]################# ################[ terraform: terraform workspace (https://www.terraform.io) ]#################
# Terraform color. # Terraform color.
typeset -g POWERLEVEL9K_TERRAFORM_FOREGROUND=38 typeset -g POWERLEVEL9K_TERRAFORM_FOREGROUND=38

@ -64,6 +64,7 @@
fvm # flutter version management (https://github.com/leoafarias/fvm) fvm # flutter version management (https://github.com/leoafarias/fvm)
luaenv # lua version from luaenv (https://github.com/cehoffman/luaenv) luaenv # lua version from luaenv (https://github.com/cehoffman/luaenv)
jenv # java version from jenv (https://github.com/jenv/jenv) jenv # java version from jenv (https://github.com/jenv/jenv)
plenv # perl version from plenv (https://github.com/tokuhirom/plenv)
kubecontext # current kubernetes context (https://kubernetes.io/) kubecontext # current kubernetes context (https://kubernetes.io/)
terraform # terraform workspace (https://www.terraform.io) terraform # terraform workspace (https://www.terraform.io)
aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html)
@ -720,6 +721,17 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_JENV_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_JENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
###########[ plenv: perl version from plenv (https://github.com/tokuhirom/plenv) ]############
# Perl color.
typeset -g POWERLEVEL9K_PLENV_FOREGROUND=67
# Hide perl version if it doesn't come from one of these sources.
typeset -g POWERLEVEL9K_PLENV_SOURCES=(shell local global)
# If set to false, hide perl version if it's the same as global:
# $(plenv version-name) == $(plenv global).
typeset -g POWERLEVEL9K_PLENV_PROMPT_ALWAYS_SHOW=false
# Custom icon.
# typeset -g POWERLEVEL9K_PLENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
#############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]#############
# Kubernetes context classes for the purpose of using different colors, icons and expansions with # Kubernetes context classes for the purpose of using different colors, icons and expansions with
# different contexts. # different contexts.

@ -64,6 +64,7 @@
fvm # flutter version management (https://github.com/leoafarias/fvm) fvm # flutter version management (https://github.com/leoafarias/fvm)
luaenv # lua version from luaenv (https://github.com/cehoffman/luaenv) luaenv # lua version from luaenv (https://github.com/cehoffman/luaenv)
jenv # java version from jenv (https://github.com/jenv/jenv) jenv # java version from jenv (https://github.com/jenv/jenv)
plenv # perl version from plenv (https://github.com/tokuhirom/plenv)
kubecontext # current kubernetes context (https://kubernetes.io/) kubecontext # current kubernetes context (https://kubernetes.io/)
terraform # terraform workspace (https://www.terraform.io) terraform # terraform workspace (https://www.terraform.io)
aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html)
@ -766,6 +767,18 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_JENV_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_JENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
###########[ plenv: perl version from plenv (https://github.com/tokuhirom/plenv) ]############
# Perl color.
# typeset -g POWERLEVEL9K_PLENV_FOREGROUND=0
# typeset -g POWERLEVEL9K_PLENV_BACKGROUND=4
# Hide perl version if it doesn't come from one of these sources.
typeset -g POWERLEVEL9K_PLENV_SOURCES=(shell local global)
# If set to false, hide perl version if it's the same as global:
# $(plenv version-name) == $(plenv global).
typeset -g POWERLEVEL9K_PLENV_PROMPT_ALWAYS_SHOW=false
# Custom icon.
# typeset -g POWERLEVEL9K_PLENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
################[ terraform: terraform workspace (https://www.terraform.io) ]################# ################[ terraform: terraform workspace (https://www.terraform.io) ]#################
# Terraform color. # Terraform color.
# typeset -g POWERLEVEL9K_TERRAFORM_FOREGROUND=4 # typeset -g POWERLEVEL9K_TERRAFORM_FOREGROUND=4

@ -121,6 +121,7 @@ function _p9k_init_icons() {
FLUTTER_ICON 'F' FLUTTER_ICON 'F'
GCLOUD_ICON 'G' GCLOUD_ICON 'G'
LUA_ICON 'lua' LUA_ICON 'lua'
PERL_ICON 'perl'
) )
;; ;;
'awesome-fontconfig') 'awesome-fontconfig')
@ -229,6 +230,7 @@ function _p9k_init_icons() {
FLUTTER_ICON 'F' FLUTTER_ICON 'F'
GCLOUD_ICON 'G' GCLOUD_ICON 'G'
LUA_ICON 'lua' LUA_ICON 'lua'
PERL_ICON 'perl'
) )
;; ;;
'awesome-mapped-fontconfig') 'awesome-mapped-fontconfig')
@ -341,6 +343,7 @@ function _p9k_init_icons() {
FLUTTER_ICON 'F' FLUTTER_ICON 'F'
GCLOUD_ICON 'G' GCLOUD_ICON 'G'
LUA_ICON 'lua' LUA_ICON 'lua'
PERL_ICON 'perl'
) )
;; ;;
'nerdfont-complete'|'nerdfont-fontconfig') 'nerdfont-complete'|'nerdfont-fontconfig')
@ -450,6 +453,7 @@ function _p9k_init_icons() {
FLUTTER_ICON 'F' FLUTTER_ICON 'F'
GCLOUD_ICON '\uF7B7' #  GCLOUD_ICON '\uF7B7' # 
LUA_ICON '\uE620' #  LUA_ICON '\uE620' # 
PERL_ICON '\uE769' # 
) )
;; ;;
*) *)
@ -558,6 +562,7 @@ function _p9k_init_icons() {
FLUTTER_ICON 'F' FLUTTER_ICON 'F'
GCLOUD_ICON 'G' GCLOUD_ICON 'G'
LUA_ICON 'lua' LUA_ICON 'lua'
PERL_ICON 'perl'
) )
;; ;;
esac esac

@ -2215,6 +2215,53 @@ function _p9k_jenv_global_version() {
_p9k_read_jenv_version_file ${JENV_ROOT:-$HOME/.jenv}/version || _p9k_ret=system _p9k_read_jenv_version_file ${JENV_ROOT:-$HOME/.jenv}/version || _p9k_ret=system
} }
function _p9k_read_plenv_version_file() {
[[ -r $1 ]] || return
local rest
read _p9k_ret rest <$1 2>/dev/null
[[ -n $_p9k_ret ]]
}
function _p9k_plenv_global_version() {
_p9k_read_plenv_version_file ${PLENV_ROOT:-$HOME/.plenv}/version || _p9k_ret=system
}
################################################################
# Segment to display plenv information
# https://github.com/plenv/plenv#choosing-the-perl-version
prompt_plenv() {
(( $+commands[plenv] || $+functions[plenv] )) || return
if [[ -n $PLENV_VERSION ]]; then
(( ${_POWERLEVEL9K_PLENV_SOURCES[(I)shell]} )) || return
local v=$PLENV_VERSION
else
(( ${_POWERLEVEL9K_PLENV_SOURCES[(I)local|global]} )) || return
[[ $PLENV_DIR == /* ]] && local dir=$PLENV_DIR || local dir="$_p9k_pwd_a/$PLENV_DIR"
while true; do
if _p9k_read_plenv_version_file $dir/.perl-version; then
(( ${_POWERLEVEL9K_PLENV_SOURCES[(I)local]} )) || return
local v=$_p9k_ret
break
fi
if [[ $dir == / ]]; then
(( _POWERLEVEL9K_PLENV_PROMPT_ALWAYS_SHOW )) || return
(( ${_POWERLEVEL9K_PLENV_SOURCES[(I)global]} )) || return
_p9k_plenv_global_version
local v=$_p9k_ret
break
fi
dir=${dir:h}
done
fi
if (( !_POWERLEVEL9K_PLENV_PROMPT_ALWAYS_SHOW )); then
_p9k_plenv_global_version
[[ $v == $_p9k_ret ]] && return
fi
_p9k_prompt_segment "$0" "blue" "$_p9k_color1" 'PERL_ICON' 0 '' "${v//\%/%%}"
}
################################################################ ################################################################
# Segment to display jenv information # Segment to display jenv information
# https://github.com/jenv/jenv # https://github.com/jenv/jenv
@ -5032,6 +5079,8 @@ _p9k_init_params() {
_p9k_declare -a POWERLEVEL9K_LUAENV_SOURCES -- shell local global _p9k_declare -a POWERLEVEL9K_LUAENV_SOURCES -- shell local global
_p9k_declare -b POWERLEVEL9K_JENV_PROMPT_ALWAYS_SHOW 0 _p9k_declare -b POWERLEVEL9K_JENV_PROMPT_ALWAYS_SHOW 0
_p9k_declare -a POWERLEVEL9K_JENV_SOURCES -- shell local global _p9k_declare -a POWERLEVEL9K_JENV_SOURCES -- shell local global
_p9k_declare -b POWERLEVEL9K_PLENV_PROMPT_ALWAYS_SHOW 0
_p9k_declare -a POWERLEVEL9K_PLENV_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
@ -5618,7 +5667,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=$'v20\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1' _p9k__param_pat=$'v21\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