mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-22 04:10:07 +00:00
add scalaenv prompt segment; see #991
This commit is contained in:
parent
6c8c6eea1b
commit
622130980c
6 changed files with 129 additions and 0 deletions
|
@ -66,6 +66,7 @@
|
||||||
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)
|
plenv # perl version from plenv (https://github.com/tokuhirom/plenv)
|
||||||
phpenv # php version from phpenv (https://github.com/phpenv/phpenv)
|
phpenv # php version from phpenv (https://github.com/phpenv/phpenv)
|
||||||
|
scalaenv # scala version from scalaenv (https://github.com/scalaenv/scalaenv)
|
||||||
haskell_stack # haskell version from stack (https://haskellstack.org/)
|
haskell_stack # haskell version from stack (https://haskellstack.org/)
|
||||||
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)
|
||||||
|
@ -1115,6 +1116,19 @@
|
||||||
# Custom icon.
|
# Custom icon.
|
||||||
# typeset -g POWERLEVEL9K_PHPENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
# typeset -g POWERLEVEL9K_PHPENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||||
|
|
||||||
|
#######[ scalaenv: scala version from scalaenv (https://github.com/scalaenv/scalaenv) ]#######
|
||||||
|
# Scala color.
|
||||||
|
typeset -g POWERLEVEL9K_SCALAENV_FOREGROUND=160
|
||||||
|
# Hide scala version if it doesn't come from one of these sources.
|
||||||
|
typeset -g POWERLEVEL9K_SCALAENV_SOURCES=(shell local global)
|
||||||
|
# If set to false, hide scala version if it's the same as global:
|
||||||
|
# $(scalaenv version-name) == $(scalaenv global).
|
||||||
|
typeset -g POWERLEVEL9K_SCALAENV_PROMPT_ALWAYS_SHOW=false
|
||||||
|
# If set to false, hide scala version if it's equal to "system".
|
||||||
|
typeset -g POWERLEVEL9K_SCALAENV_SHOW_SYSTEM=true
|
||||||
|
# Custom icon.
|
||||||
|
# typeset -g POWERLEVEL9K_SCALAENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||||
|
|
||||||
##########[ haskell_stack: haskell version from stack (https://haskellstack.org/) ]###########
|
##########[ haskell_stack: haskell version from stack (https://haskellstack.org/) ]###########
|
||||||
# Haskell color.
|
# Haskell color.
|
||||||
typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=172
|
typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=172
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
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)
|
plenv # perl version from plenv (https://github.com/tokuhirom/plenv)
|
||||||
phpenv # php version from phpenv (https://github.com/phpenv/phpenv)
|
phpenv # php version from phpenv (https://github.com/phpenv/phpenv)
|
||||||
|
scalaenv # scala version from scalaenv (https://github.com/scalaenv/scalaenv)
|
||||||
haskell_stack # haskell version from stack (https://haskellstack.org/)
|
haskell_stack # haskell version from stack (https://haskellstack.org/)
|
||||||
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)
|
||||||
|
@ -1092,6 +1093,19 @@
|
||||||
# Custom icon.
|
# Custom icon.
|
||||||
# typeset -g POWERLEVEL9K_PHPENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
# typeset -g POWERLEVEL9K_PHPENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||||
|
|
||||||
|
#######[ scalaenv: scala version from scalaenv (https://github.com/scalaenv/scalaenv) ]#######
|
||||||
|
# Scala color.
|
||||||
|
typeset -g POWERLEVEL9K_SCALAENV_FOREGROUND=1
|
||||||
|
# Hide scala version if it doesn't come from one of these sources.
|
||||||
|
typeset -g POWERLEVEL9K_SCALAENV_SOURCES=(shell local global)
|
||||||
|
# If set to false, hide scala version if it's the same as global:
|
||||||
|
# $(scalaenv version-name) == $(scalaenv global).
|
||||||
|
typeset -g POWERLEVEL9K_SCALAENV_PROMPT_ALWAYS_SHOW=false
|
||||||
|
# If set to false, hide scala version if it's equal to "system".
|
||||||
|
typeset -g POWERLEVEL9K_SCALAENV_SHOW_SYSTEM=true
|
||||||
|
# Custom icon.
|
||||||
|
# typeset -g POWERLEVEL9K_SCALAENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||||
|
|
||||||
##########[ haskell_stack: haskell version from stack (https://haskellstack.org/) ]###########
|
##########[ haskell_stack: haskell version from stack (https://haskellstack.org/) ]###########
|
||||||
# Haskell color.
|
# Haskell color.
|
||||||
typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=3
|
typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=3
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
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)
|
plenv # perl version from plenv (https://github.com/tokuhirom/plenv)
|
||||||
phpenv # php version from phpenv (https://github.com/phpenv/phpenv)
|
phpenv # php version from phpenv (https://github.com/phpenv/phpenv)
|
||||||
|
scalaenv # scala version from scalaenv (https://github.com/scalaenv/scalaenv)
|
||||||
haskell_stack # haskell version from stack (https://haskellstack.org/)
|
haskell_stack # haskell version from stack (https://haskellstack.org/)
|
||||||
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)
|
||||||
|
@ -1092,6 +1093,19 @@
|
||||||
# Custom icon.
|
# Custom icon.
|
||||||
# typeset -g POWERLEVEL9K_PHPENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
# typeset -g POWERLEVEL9K_PHPENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||||
|
|
||||||
|
#######[ scalaenv: scala version from scalaenv (https://github.com/scalaenv/scalaenv) ]#######
|
||||||
|
# Scala color.
|
||||||
|
typeset -g POWERLEVEL9K_SCALAENV_FOREGROUND=160
|
||||||
|
# Hide scala version if it doesn't come from one of these sources.
|
||||||
|
typeset -g POWERLEVEL9K_SCALAENV_SOURCES=(shell local global)
|
||||||
|
# If set to false, hide scala version if it's the same as global:
|
||||||
|
# $(scalaenv version-name) == $(scalaenv global).
|
||||||
|
typeset -g POWERLEVEL9K_SCALAENV_PROMPT_ALWAYS_SHOW=false
|
||||||
|
# If set to false, hide scala version if it's equal to "system".
|
||||||
|
typeset -g POWERLEVEL9K_SCALAENV_SHOW_SYSTEM=true
|
||||||
|
# Custom icon.
|
||||||
|
# typeset -g POWERLEVEL9K_SCALAENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||||
|
|
||||||
##########[ haskell_stack: haskell version from stack (https://haskellstack.org/) ]###########
|
##########[ haskell_stack: haskell version from stack (https://haskellstack.org/) ]###########
|
||||||
# Haskell color.
|
# Haskell color.
|
||||||
typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=172
|
typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=172
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
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)
|
plenv # perl version from plenv (https://github.com/tokuhirom/plenv)
|
||||||
phpenv # php version from phpenv (https://github.com/phpenv/phpenv)
|
phpenv # php version from phpenv (https://github.com/phpenv/phpenv)
|
||||||
|
scalaenv # scala version from scalaenv (https://github.com/scalaenv/scalaenv)
|
||||||
haskell_stack # haskell version from stack (https://haskellstack.org/)
|
haskell_stack # haskell version from stack (https://haskellstack.org/)
|
||||||
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)
|
||||||
|
@ -1175,6 +1176,20 @@
|
||||||
# Custom icon.
|
# Custom icon.
|
||||||
# typeset -g POWERLEVEL9K_PHPENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
# typeset -g POWERLEVEL9K_PHPENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||||
|
|
||||||
|
#######[ scalaenv: scala version from scalaenv (https://github.com/scalaenv/scalaenv) ]#######
|
||||||
|
# Scala color.
|
||||||
|
# typeset -g POWERLEVEL9K_SCALAENV_FOREGROUND=0
|
||||||
|
# typeset -g POWERLEVEL9K_SCALAENV_BACKGROUND=1
|
||||||
|
# Hide scala version if it doesn't come from one of these sources.
|
||||||
|
typeset -g POWERLEVEL9K_SCALAENV_SOURCES=(shell local global)
|
||||||
|
# If set to false, hide scala version if it's the same as global:
|
||||||
|
# $(scalaenv version-name) == $(scalaenv global).
|
||||||
|
typeset -g POWERLEVEL9K_SCALAENV_PROMPT_ALWAYS_SHOW=false
|
||||||
|
# If set to false, hide scala version if it's equal to "system".
|
||||||
|
typeset -g POWERLEVEL9K_SCALAENV_SHOW_SYSTEM=true
|
||||||
|
# Custom icon.
|
||||||
|
# typeset -g POWERLEVEL9K_SCALAENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||||
|
|
||||||
##########[ haskell_stack: haskell version from stack (https://haskellstack.org/) ]###########
|
##########[ haskell_stack: haskell version from stack (https://haskellstack.org/) ]###########
|
||||||
# Haskell color.
|
# Haskell color.
|
||||||
# typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=0
|
# typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=0
|
||||||
|
|
|
@ -143,6 +143,7 @@ function _p9k_init_icons() {
|
||||||
HASKELL_ICON 'hs'
|
HASKELL_ICON 'hs'
|
||||||
PACKAGE_ICON 'pkg'
|
PACKAGE_ICON 'pkg'
|
||||||
JULIA_ICON 'jl'
|
JULIA_ICON 'jl'
|
||||||
|
SCALA_ICON 'scala'
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
'awesome-fontconfig')
|
'awesome-fontconfig')
|
||||||
|
@ -270,6 +271,7 @@ function _p9k_init_icons() {
|
||||||
HASKELL_ICON 'hs'
|
HASKELL_ICON 'hs'
|
||||||
PACKAGE_ICON 'pkg'
|
PACKAGE_ICON 'pkg'
|
||||||
JULIA_ICON 'jl'
|
JULIA_ICON 'jl'
|
||||||
|
SCALA_ICON 'scala'
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
'awesome-mapped-fontconfig')
|
'awesome-mapped-fontconfig')
|
||||||
|
@ -400,6 +402,7 @@ function _p9k_init_icons() {
|
||||||
HASKELL_ICON 'hs'
|
HASKELL_ICON 'hs'
|
||||||
PACKAGE_ICON 'pkg'
|
PACKAGE_ICON 'pkg'
|
||||||
JULIA_ICON 'jl'
|
JULIA_ICON 'jl'
|
||||||
|
SCALA_ICON 'scala'
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
'nerdfont-complete'|'nerdfont-fontconfig')
|
'nerdfont-complete'|'nerdfont-fontconfig')
|
||||||
|
@ -528,6 +531,7 @@ function _p9k_init_icons() {
|
||||||
HASKELL_ICON '\uE61F' #
|
HASKELL_ICON '\uE61F' #
|
||||||
PACKAGE_ICON '\uF8D6' #
|
PACKAGE_ICON '\uF8D6' #
|
||||||
JULIA_ICON '\uE624' #
|
JULIA_ICON '\uE624' #
|
||||||
|
SCALA_ICON '\uE737' #
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
ascii)
|
ascii)
|
||||||
|
@ -653,6 +657,7 @@ function _p9k_init_icons() {
|
||||||
HASKELL_ICON 'hs'
|
HASKELL_ICON 'hs'
|
||||||
PACKAGE_ICON 'pkg'
|
PACKAGE_ICON 'pkg'
|
||||||
JULIA_ICON 'jl'
|
JULIA_ICON 'jl'
|
||||||
|
SCALA_ICON 'scala'
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -780,6 +785,7 @@ function _p9k_init_icons() {
|
||||||
HASKELL_ICON 'hs'
|
HASKELL_ICON 'hs'
|
||||||
PACKAGE_ICON 'pkg'
|
PACKAGE_ICON 'pkg'
|
||||||
JULIA_ICON 'jl'
|
JULIA_ICON 'jl'
|
||||||
|
SCALA_ICON 'scala'
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -2673,6 +2673,69 @@ function _p9k_phpenv_global_version() {
|
||||||
_p9k_read_word ${PHPENV_ROOT:-$HOME/.phpenv}/version || _p9k__ret=system
|
_p9k_read_word ${PHPENV_ROOT:-$HOME/.phpenv}/version || _p9k__ret=system
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _p9k_scalaenv_global_version() {
|
||||||
|
_p9k_read_word ${SCALAENV_ROOT:-$HOME/.scalaenv}/version || _p9k__ret=system
|
||||||
|
}
|
||||||
|
|
||||||
|
# https://github.com/scalaenv/scalaenv
|
||||||
|
prompt_scalaenv() {
|
||||||
|
if [[ -n $SCALAENV_VERSION ]]; then
|
||||||
|
(( ${_POWERLEVEL9K_SCALAENV_SOURCES[(I)shell]} )) || return
|
||||||
|
local v=$SCALAENV_VERSION
|
||||||
|
else
|
||||||
|
(( ${_POWERLEVEL9K_SCALAENV_SOURCES[(I)local|global]} )) || return
|
||||||
|
_p9k__ret=
|
||||||
|
if [[ $SCALAENV_DIR != (|.) ]]; then
|
||||||
|
[[ $SCALAENV_DIR == /* ]] && local dir=$SCALAENV_DIR || local dir="$_p9k__cwd_a/$SCALAENV_DIR"
|
||||||
|
dir=${dir:A}
|
||||||
|
if [[ $dir != $_p9k__cwd_a ]]; then
|
||||||
|
while true; do
|
||||||
|
if _p9k_read_word $dir/.scala-version; then
|
||||||
|
(( ${_POWERLEVEL9K_SCALAENV_SOURCES[(I)local]} )) || return
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
[[ $dir == (/|.) ]] && break
|
||||||
|
dir=${dir:h}
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ -z $_p9k__ret ]]; then
|
||||||
|
_p9k_upglob .scala-version
|
||||||
|
local -i idx=$?
|
||||||
|
if (( idx )) && _p9k_read_word $_p9k__parent_dirs[idx]/.scala-version; then
|
||||||
|
(( ${_POWERLEVEL9K_SCALAENV_SOURCES[(I)local]} )) || return
|
||||||
|
else
|
||||||
|
_p9k__ret=
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ -z $_p9k__ret ]]; then
|
||||||
|
(( _POWERLEVEL9K_SCALAENV_PROMPT_ALWAYS_SHOW )) || return
|
||||||
|
(( ${_POWERLEVEL9K_SCALAENV_SOURCES[(I)global]} )) || return
|
||||||
|
_p9k_scalaenv_global_version
|
||||||
|
fi
|
||||||
|
local v=$_p9k__ret
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( !_POWERLEVEL9K_SCALAENV_PROMPT_ALWAYS_SHOW )); then
|
||||||
|
_p9k_scalaenv_global_version
|
||||||
|
[[ $v == $_p9k__ret ]] && return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( !_POWERLEVEL9K_SCALAENV_SHOW_SYSTEM )); then
|
||||||
|
[[ $v == system ]] && return
|
||||||
|
fi
|
||||||
|
|
||||||
|
_p9k_prompt_segment "$0" "red" "$_p9k_color1" 'SCALA_ICON' 0 '' "${v//\%/%%}"
|
||||||
|
}
|
||||||
|
|
||||||
|
_p9k_prompt_scalaenv_init() {
|
||||||
|
typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='${commands[scalaenv]:-${${+functions[scalaenv]}:#0}}'
|
||||||
|
}
|
||||||
|
|
||||||
|
function _p9k_phpenv_global_version() {
|
||||||
|
_p9k_read_word ${PHPENV_ROOT:-$HOME/.phpenv}/version || _p9k__ret=system
|
||||||
|
}
|
||||||
|
|
||||||
prompt_phpenv() {
|
prompt_phpenv() {
|
||||||
if [[ -n $PHPENV_VERSION ]]; then
|
if [[ -n $PHPENV_VERSION ]]; then
|
||||||
(( ${_POWERLEVEL9K_PHPENV_SOURCES[(I)shell]} )) || return
|
(( ${_POWERLEVEL9K_PHPENV_SOURCES[(I)shell]} )) || return
|
||||||
|
@ -7057,6 +7120,9 @@ _p9k_init_params() {
|
||||||
_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 -a POWERLEVEL9K_RBENV_SOURCES -- shell local global
|
||||||
_p9k_declare -b POWERLEVEL9K_RBENV_SHOW_SYSTEM 1
|
_p9k_declare -b POWERLEVEL9K_RBENV_SHOW_SYSTEM 1
|
||||||
|
_p9k_declare -b POWERLEVEL9K_SCALAENV_PROMPT_ALWAYS_SHOW 0
|
||||||
|
_p9k_declare -a POWERLEVEL9K_SCALAENV_SOURCES -- shell local global
|
||||||
|
_p9k_declare -b POWERLEVEL9K_SCALAENV_SHOW_SYSTEM 1
|
||||||
_p9k_declare -b POWERLEVEL9K_PHPENV_PROMPT_ALWAYS_SHOW 0
|
_p9k_declare -b POWERLEVEL9K_PHPENV_PROMPT_ALWAYS_SHOW 0
|
||||||
_p9k_declare -a POWERLEVEL9K_PHPENV_SOURCES -- shell local global
|
_p9k_declare -a POWERLEVEL9K_PHPENV_SOURCES -- shell local global
|
||||||
_p9k_declare -b POWERLEVEL9K_PHPENV_SHOW_SYSTEM 1
|
_p9k_declare -b POWERLEVEL9K_PHPENV_SHOW_SYSTEM 1
|
||||||
|
|
Loading…
Reference in a new issue