zsh: Make nix-shell pretty and update ps1

This commit is contained in:
caem 2024-07-15 01:25:14 +02:00
parent 947368779d
commit 032fd38053
Signed by: caem
GPG key ID: 69A830D03203405F
7 changed files with 39 additions and 14 deletions

View file

@ -9,10 +9,21 @@ case "$distro" in
*) dicon="%F{yellow}[󰘧]%f" ;;
esac
if [ -n "$IN_NIX_SHELL" ]; then
if [ -z "$NIX_SHELL_PACKAGES" ]; then
nix_shell_ps1="%F{red}nix-shell%f"
else
nix_shell_ps1="%F{red}{ $NIX_SHELL_PACKAGES }%f"
fi
else
nix_shell_ps1=""
fi
setopt prompt_subst
autoload -Uz vcs_info
precmd () { vcs_info }
zstyle ':vcs_info:*' formats ' %F{yellow}(%b)%f'
zstyle ':vcs_info:*' formats ' %F{yellow}(%b)%f '
export PS1='$dicon %n@%m %F{green}%~%f$vcs_info_msg_0_> '
NL=$'\n'
export PS1='%F{green}%~%f$vcs_info_msg_0_$nix_shell_ps1$NL$dicon > '