From 5397db3d0ec747d52e0daa2bf66c37fcba2a013b Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 6 Mar 2022 01:01:42 +0100 Subject: [PATCH] zsh: only print nix shell paths once --- config/zsh/prompt.zsh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/config/zsh/prompt.zsh b/config/zsh/prompt.zsh index 465e565..f1537d0 100644 --- a/config/zsh/prompt.zsh +++ b/config/zsh/prompt.zsh @@ -19,13 +19,11 @@ delta_prompt_symbol() { delta_prompt_nix_shell() { if [[ -n "$IN_NIX3_SHELL" || -n "$IN_NIX_SHELL" ]]; then - print -n " %F{cyan}>%F{blue}>%F{8}" + print -Pn " %F{cyan}>%F{blue}>%F{8}" tr : '\n' <<<$PATH | grep '^/nix/store' | while read storepath; do print -n " ${${storepath#*-}%/*}" done - print -n '%f\n ' - else - print -n ' ' + print -P '%f' fi } @@ -50,11 +48,10 @@ delta_prompt_init() { fi if [[ -n $SSH_CONNECTION ]]; then - PROMPT="$(delta_prompt_nix_shell)\$(delta_prompt_symbol \$? $symbol_color)Δ%f %F{8}$hostnamevar %c >%f " + PROMPT=" \$(delta_prompt_symbol \$? $symbol_color)Δ%f %F{8}$hostnamevar %c >%f " else - PROMPT="$(delta_prompt_nix_shell)\$(delta_prompt_symbol \$? $symbol_color)Δ%f %F{8}%c >%f " + PROMPT=" \$(delta_prompt_symbol \$? $symbol_color)Δ%f %F{8}%c >%f " fi - unfunction delta_prompt_nix_shell zstyle ':vcs_info:*' enable git zstyle ':vcs_info:*' use-simple true @@ -62,6 +59,9 @@ delta_prompt_init() { zstyle ':vcs_info:git*' actionformats '%b|%a' zstyle ':vcs_info:*' max-exports 2 + + delta_prompt_nix_shell + unfunction delta_prompt_nix_shell } delta_prompt_git_status() {