add nix_shell prompt segment; see #448

pull/450/head
romkatv 5 years ago
parent 0a4b832b25
commit 73878f398a

@ -78,6 +78,7 @@
nnn # nnn shell (https://github.com/jarun/nnn) nnn # nnn shell (https://github.com/jarun/nnn)
vim_shell # vim shell indicator (:sh) vim_shell # vim shell indicator (:sh)
midnight_commander # midnight commander shell (https://midnight-commander.org/) midnight_commander # midnight commander shell (https://midnight-commander.org/)
nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
vi_mode # vi mode (you don't need this if you've enabled prompt_char) vi_mode # vi mode (you don't need this if you've enabled prompt_char)
# vpn_ip # virtual private network indicator # vpn_ip # virtual private network indicator
# load # CPU load # load # CPU load
@ -548,6 +549,16 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='⭐'
#[ nix_shell: nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) ]##
# Nix shell color.
typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=74
# Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line.
# typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION=
# Custom icon.
# typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐'
##################################[ disk_usgae: disk usage ]################################## ##################################[ disk_usgae: disk usage ]##################################
# Colors for different levels of disk usage. # Colors for different levels of disk usage.
typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=35 typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=35

@ -78,6 +78,7 @@
nnn # nnn shell (https://github.com/jarun/nnn) nnn # nnn shell (https://github.com/jarun/nnn)
vim_shell # vim shell indicator (:sh) vim_shell # vim shell indicator (:sh)
midnight_commander # midnight commander shell (https://midnight-commander.org/) midnight_commander # midnight commander shell (https://midnight-commander.org/)
nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
# vpn_ip # virtual private network indicator # vpn_ip # virtual private network indicator
# load # CPU load # load # CPU load
# disk_usage # disk usage # disk_usage # disk usage
@ -544,6 +545,16 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='⭐'
#[ nix_shell: nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) ]##
# Nix shell color.
typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=4
# Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line.
# typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION=
# Custom icon.
# typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐'
##################################[ disk_usgae: disk usage ]################################## ##################################[ disk_usgae: disk usage ]##################################
# Colors for different levels of disk usage. # Colors for different levels of disk usage.
typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=2 typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=2

@ -78,6 +78,7 @@
nnn # nnn shell (https://github.com/jarun/nnn) nnn # nnn shell (https://github.com/jarun/nnn)
vim_shell # vim shell indicator (:sh) vim_shell # vim shell indicator (:sh)
midnight_commander # midnight commander shell (https://midnight-commander.org/) midnight_commander # midnight commander shell (https://midnight-commander.org/)
nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
# vpn_ip # virtual private network indicator # vpn_ip # virtual private network indicator
# load # CPU load # load # CPU load
# disk_usage # disk usage # disk_usage # disk usage
@ -544,6 +545,16 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='⭐'
#[ nix_shell: nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) ]##
# Nix shell color.
typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=74
# Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line.
# typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION=
# Custom icon.
# typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐'
##################################[ disk_usgae: disk usage ]################################## ##################################[ disk_usgae: disk usage ]##################################
# Colors for different levels of disk usage. # Colors for different levels of disk usage.
typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=35 typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=35

@ -78,6 +78,7 @@
nnn # nnn shell (https://github.com/jarun/nnn) nnn # nnn shell (https://github.com/jarun/nnn)
vim_shell # vim shell indicator (:sh) vim_shell # vim shell indicator (:sh)
midnight_commander # midnight commander shell (https://midnight-commander.org/) midnight_commander # midnight commander shell (https://midnight-commander.org/)
nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
vi_mode # vi mode (you don't need this if you've enabled prompt_char) vi_mode # vi mode (you don't need this if you've enabled prompt_char)
# vpn_ip # virtual private network indicator # vpn_ip # virtual private network indicator
# load # CPU load # load # CPU load
@ -550,6 +551,17 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='⭐'
#[ nix_shell: nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) ]##
# Nix shell color.
# typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=0
# typeset -g POWERLEVEL9K_NIX_SHELL_BACKGROUND=4
# Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line.
# typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION=
# Custom icon.
# typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐'
##################################[ disk_usgae: disk usage ]################################## ##################################[ disk_usgae: disk usage ]##################################
# Colors for different levels of disk usage. # Colors for different levels of disk usage.
# typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=3 # typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=3

@ -124,6 +124,7 @@ function _p9k_init_icons() {
PERL_ICON 'perl' PERL_ICON 'perl'
NNN_ICON 'nnn' NNN_ICON 'nnn'
TIMEWARRIOR_ICON 'tw' TIMEWARRIOR_ICON 'tw'
NIX_SHELL_ICON 'nix'
) )
;; ;;
'awesome-fontconfig') 'awesome-fontconfig')
@ -235,6 +236,7 @@ function _p9k_init_icons() {
PERL_ICON 'perl' PERL_ICON 'perl'
NNN_ICON 'nnn' NNN_ICON 'nnn'
TIMEWARRIOR_ICON 'tw' TIMEWARRIOR_ICON 'tw'
NIX_SHELL_ICON 'nix'
) )
;; ;;
'awesome-mapped-fontconfig') 'awesome-mapped-fontconfig')
@ -350,6 +352,7 @@ function _p9k_init_icons() {
PERL_ICON 'perl' PERL_ICON 'perl'
NNN_ICON 'nnn' NNN_ICON 'nnn'
TIMEWARRIOR_ICON 'tw' TIMEWARRIOR_ICON 'tw'
NIX_SHELL_ICON 'nix'
) )
;; ;;
'nerdfont-complete'|'nerdfont-fontconfig') 'nerdfont-complete'|'nerdfont-fontconfig')
@ -462,6 +465,7 @@ function _p9k_init_icons() {
PERL_ICON '\uE769' #  PERL_ICON '\uE769' # 
NNN_ICON 'nnn' NNN_ICON 'nnn'
TIMEWARRIOR_ICON '\uF132' #  TIMEWARRIOR_ICON '\uF132' # 
NIX_SHELL_ICON '\uF313' # 
) )
;; ;;
*) *)
@ -573,6 +577,7 @@ function _p9k_init_icons() {
PERL_ICON 'perl' PERL_ICON 'perl'
NNN_ICON 'nnn' NNN_ICON 'nnn'
TIMEWARRIOR_ICON 'tw' TIMEWARRIOR_ICON 'tw'
NIX_SHELL_ICON 'nix'
) )
;; ;;
esac esac

@ -4289,6 +4289,18 @@ function instant_prompt_vim_shell() {
_p9k_prompt_segment prompt_vim_shell green $_p9k_color1 VIM_ICON 0 '$VIMRUNTIME' '' _p9k_prompt_segment prompt_vim_shell green $_p9k_color1 VIM_ICON 0 '$VIMRUNTIME' ''
} }
function prompt_nix_shell() {
_p9k_prompt_segment $0 4 $_p9k_color1 NIX_SHELL_ICON 0 '' "${(M)IN_NIX_SHELL:#(pure|impure)}"
}
_p9k_prompt_nix_shell_init() {
typeset -g "_p9k__segment_cond_${_p9k_prompt_side}[_p9k_segment_index]"='${IN_NIX_SHELL:#0}'
}
function instant_prompt_nix_shell() {
_p9k_prompt_segment prompt_nix_shell 4 $_p9k_color1 NIX_SHELL_ICON 1 '${IN_NIX_SHELL:#0}' '${(M)IN_NIX_SHELL:#(pure|impure)}'
}
function prompt_terraform() { function prompt_terraform() {
local ws=default local ws=default
if [[ -n $TF_WORKSPACE ]]; then if [[ -n $TF_WORKSPACE ]]; then
@ -6441,7 +6453,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=$'v30\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1' _p9k__param_pat=$'v31\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