From 60f853eee90ae4a41de9987d49147c71e42180b4 Mon Sep 17 00:00:00 2001 From: caem Date: Fri, 24 Jan 2025 13:36:36 +0100 Subject: [PATCH] my descend in to insanity is complete --- modules/home/caem/core/zsh/conf.d/ps1.zsh | 1 - modules/home/caem/core/zsh/default.nix | 31 +++++++++++++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/modules/home/caem/core/zsh/conf.d/ps1.zsh b/modules/home/caem/core/zsh/conf.d/ps1.zsh index 4cb90de..e09376f 100644 --- a/modules/home/caem/core/zsh/conf.d/ps1.zsh +++ b/modules/home/caem/core/zsh/conf.d/ps1.zsh @@ -22,5 +22,4 @@ zstyle ':vcs_info:*' enable git zstyle ':vcs_info:*' formats " ${c34}${c0}${c31}(%b)${c0}" precmd () { vcs_info } -echo "${vcs_info_msg_0_}" export PS1="${c38}[${c35}%3~${c0}${vcs_info_msg_0_}${nix_shell_ps1}${c38}]${c0}# " diff --git a/modules/home/caem/core/zsh/default.nix b/modules/home/caem/core/zsh/default.nix index 5f29439..b922059 100644 --- a/modules/home/caem/core/zsh/default.nix +++ b/modules/home/caem/core/zsh/default.nix @@ -58,12 +58,33 @@ alias -g -- -h='-h 2>&1 | bat --language=help --style=plain' alias -g -- --help='--help 2>&1 | bat --language=help --style=plain' - for dotfile in "$ZDOTDIR/conf.d/"*; do - source "$dotfile" - done + #for dotfile in "$ZDOTDIR/conf.d/"*; do + # source "$dotfile" + #done - export RE_SOURCE=1 - [ -z "$RE_SOURCE" ] && source "$ZDOTDIR/.zshrc" + local c0=$'%{\e[0m%}' + local c31=$'%{\e[31m%}' + local c33=$'%{\e[33m%}' + local c34=$'%{\e[34m%}' + local c35=$'%{\e[35m%}' + local c38=$'%{\e[38m%}' + + local nix_shell_ps1_t=" $c34{$c33󱄅 shell$c34}$c0" + local path_no_ghostty="$(echo "$PATH" | sed -e 's/:\/nix\/store\/.*-ghostty-.*\/bin://g')" + if [ -n "$IN_NIX_SHELL" ]; then + local nix_shell_ps1="$nix_shell_ps1_t" + elif [[ "$path_no_ghostty" == *"/nix/store"* ]]; then + IN_NIX_SHELL=true + local nix_shell_ps1="$nix_shell_ps1_t" + fi + + setopt prompt_subst + autoload -Uz vcs_info + zstyle ':vcs_info:*' enable git + zstyle ':vcs_info:*' formats " $\{c34}$\{c0}$\{c31}(%b)$\{c0}" + precmd () { vcs_info } + + export PS1="$\{c38}[$\{c35}%3~$\{c0}$\{vcs_info_msg_0_}$\{nix_shell_ps1}$\{c38}]$\{c0}# " ''; plugins = [