1
Fork 0
nixos-system-config/dotfiles/zsh/conf.d/ps1.zsh

34 lines
847 B
Bash
Raw Permalink Normal View History

#!/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
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
2024-07-31 16:39:15 +02:00
if [ -n "$CONTAINER_ID" ]; then
dicon="%F{bg-yellow}[󰏗 $CONTAINER_ID]%f"
fi
setopt prompt_subst
autoload -Uz vcs_info
precmd () { vcs_info }
zstyle ':vcs_info:*' formats ' %F{yellow}(%b)%f'
NL=$'\n'
2024-08-27 13:06:24 +02:00
export PS1='[$dicon %F{green}%3~%f$vcs_info_msg_0_$nix_shell_ps1]# '