1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-21 20:00:07 +00:00

do not infer nix_shell from PATH unless POWERLEVEL9K_NIX_SHELL_INFER_FROM_PATH is set to true (#2246)

This commit is contained in:
Roman Perepelitsa 2023-04-12 11:07:32 +02:00
parent fb1287fedb
commit bab655fb1f
5 changed files with 20 additions and 4 deletions

View file

@ -752,6 +752,9 @@
# Nix shell color. # Nix shell color.
typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=74 typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=74
# Display the icon of nix_shell if PATH contains a subdirectory of /nix/store.
# typeset -g POWERLEVEL9K_NIX_SHELL_INFER_FROM_PATH=false
# Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line. # Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line.
# typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION= # typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION=

View file

@ -750,6 +750,9 @@
# Nix shell color. # Nix shell color.
typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=4 typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=4
# Display the icon of nix_shell if PATH contains a subdirectory of /nix/store.
# typeset -g POWERLEVEL9K_NIX_SHELL_INFER_FROM_PATH=false
# Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line. # Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line.
# typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION= # typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION=

View file

@ -746,6 +746,9 @@
# Nix shell color. # Nix shell color.
typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=74 typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=74
# Display the icon of nix_shell if PATH contains a subdirectory of /nix/store.
# typeset -g POWERLEVEL9K_NIX_SHELL_INFER_FROM_PATH=false
# Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line. # Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line.
# typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION= # typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION=

View file

@ -777,6 +777,9 @@
typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=0 typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=0
typeset -g POWERLEVEL9K_NIX_SHELL_BACKGROUND=4 typeset -g POWERLEVEL9K_NIX_SHELL_BACKGROUND=4
# Display the icon of nix_shell if PATH contains a subdirectory of /nix/store.
# typeset -g POWERLEVEL9K_NIX_SHELL_INFER_FROM_PATH=false
# Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line. # Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line.
# typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION= # typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION=

View file

@ -4956,13 +4956,11 @@ function prompt_nix_shell() {
} }
_p9k_prompt_nix_shell_init() { _p9k_prompt_nix_shell_init() {
typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='${IN_NIX_SHELL:#0}${${path[(I)/nix/store/*]}:#0}' typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"=$_p9k_nix_shell_cond
} }
function instant_prompt_nix_shell() { function instant_prompt_nix_shell() {
_p9k_prompt_segment prompt_nix_shell 4 $_p9k_color1 NIX_SHELL_ICON 1 \ _p9k_prompt_segment prompt_nix_shell 4 $_p9k_color1 NIX_SHELL_ICON 1 "$_p9k_nix_shell_cond" '${(M)IN_NIX_SHELL:#(pure|impure)}'
'${IN_NIX_SHELL:#0}${${path[(I)/nix/store/*]}:#0}' \
'${(M)IN_NIX_SHELL:#(pure|impure)}'
} }
function prompt_terraform() { function prompt_terraform() {
@ -7651,6 +7649,12 @@ _p9k_init_params() {
# If set to true, time will update every second. # If set to true, time will update every second.
_p9k_declare -b POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME 0 _p9k_declare -b POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME 0
_p9k_declare -b POWERLEVEL9K_NIX_SHELL_INFER_FROM_PATH 0
typeset -g _p9k_nix_shell_cond='${IN_NIX_SHELL:#0}'
if (( _POWERLEVEL9K_NIX_SHELL_INFER_FROM_PATH )); then
_p9k_nix_shell_cond+='${path[(r)/nix/store/*]}'
fi
local -i i=1 local -i i=1
while (( i <= $#_POWERLEVEL9K_LEFT_PROMPT_ELEMENTS )); do while (( i <= $#_POWERLEVEL9K_LEFT_PROMPT_ELEMENTS )); do
local segment=${${(U)_POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[i]}//İ/I} local segment=${${(U)_POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[i]}//İ/I}