diff options
author | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2023-04-12 12:07:32 +0300 |
---|---|---|
committer | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2023-04-12 12:07:32 +0300 |
commit | bab655fb1f457de5ae5ad9f3c425a2e5186aa6b8 (patch) | |
tree | 56bae27879797a4cb42313163754f3d001b4c0ec /internal | |
parent | fb1287fedbb877201572d164ba0bad5c9d375b4f (diff) |
do not infer nix_shell from PATH unless POWERLEVEL9K_NIX_SHELL_INFER_FROM_PATH is set to true (#2246)
Diffstat (limited to 'internal')
-rw-r--r-- | internal/p10k.zsh | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh index d638cfc1..64a58591 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -4956,13 +4956,11 @@ function prompt_nix_shell() { } _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() { - _p9k_prompt_segment prompt_nix_shell 4 $_p9k_color1 NIX_SHELL_ICON 1 \ - '${IN_NIX_SHELL:#0}${${path[(I)/nix/store/*]}:#0}' \ - '${(M)IN_NIX_SHELL:#(pure|impure)}' + _p9k_prompt_segment prompt_nix_shell 4 $_p9k_color1 NIX_SHELL_ICON 1 "$_p9k_nix_shell_cond" '${(M)IN_NIX_SHELL:#(pure|impure)}' } function prompt_terraform() { @@ -7651,6 +7649,12 @@ _p9k_init_params() { # If set to true, time will update every second. _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 while (( i <= $#_POWERLEVEL9K_LEFT_PROMPT_ELEMENTS )); do local segment=${${(U)_POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[i]}//İ/I} |