2024-05-24 21:33:00 +02:00
|
|
|
#!/usr/bin/env zsh
|
|
|
|
|
|
|
|
distro=$(cat /etc/os-release | grep -w 'ID=.*' | sed -e 's/ID=//g' | awk '{print $1}')
|
|
|
|
case "$distro" in
|
|
|
|
"debian") dicon="%F{red}%f" ;;
|
|
|
|
"gentoo") dicon="%F{magenta}%f" ;;
|
|
|
|
"\"opensuse-tumbleweed\"") dicon="%F{green} %f" ;;
|
|
|
|
"nixos") dicon="%F{cyan}%f" ;;
|
|
|
|
*) dicon="%F{yellow}[]%f" ;;
|
|
|
|
esac
|
|
|
|
|
2024-07-15 01:25:14 +02:00
|
|
|
if [ -n "$IN_NIX_SHELL" ]; then
|
|
|
|
if [ -z "$NIX_SHELL_PACKAGES" ]; then
|
2024-07-15 13:48:57 +02:00
|
|
|
nix_shell_ps1=" %F{red}nix-shell%f"
|
2024-07-15 01:25:14 +02:00
|
|
|
else
|
2024-07-15 13:48:57 +02:00
|
|
|
nix_shell_ps1=" %F{red}{ $NIX_SHELL_PACKAGES }%f"
|
2024-07-15 01:25:14 +02:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
nix_shell_ps1=""
|
|
|
|
fi
|
|
|
|
|
2024-05-24 21:33:00 +02:00
|
|
|
setopt prompt_subst
|
|
|
|
autoload -Uz vcs_info
|
|
|
|
precmd () { vcs_info }
|
2024-07-15 14:38:23 +02:00
|
|
|
zstyle ':vcs_info:*' formats ' %F{yellow}(%b)%f'
|
2024-05-24 21:33:00 +02:00
|
|
|
|
2024-07-15 01:25:14 +02:00
|
|
|
NL=$'\n'
|
|
|
|
export PS1='%F{green}%~%f$vcs_info_msg_0_$nix_shell_ps1$NL$dicon > '
|
2024-05-24 21:33:00 +02:00
|
|
|
|