1
0
mirror of https://github.com/danbee/dotfiles-local synced 2025-03-04 08:49:07 +00:00

Add distro to prompt

This commit is contained in:
Daniel Barber 2019-08-28 20:54:29 -04:00
parent 8cadda8bd1
commit 3181b3828c
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8

View File

@ -23,6 +23,23 @@ update_git_prompt() {
GIT_PROMPT+="%{$fg[blue]%}]%{$reset_color%} "
}
os_icon() {
case `uname` in
Darwin)
echo "%{$fg[white]%} macOS%{$reset_color%}"
;;
Linux)
echo "%{$fg[yellow]%} Linux%{$reset_color%}"
;;
FreeBSD)
echo "%{$fg[red]%} FreeBSD%{$reset_color%}"
;;
OpenBSD)
echo "%{$fg[yellow]%}OpenBSD%{$reset_color%}"
;;
esac
}
autoload -Uz add-zsh-hook
add-zsh-hook precmd update_git_prompt
@ -38,7 +55,7 @@ export CLICOLOR=1
setopt promptsubst
# prompt
export PROMPT='${SSH_CONNECTION+"%{$fg[yellow]%}%n@%m%{$reset_color%}:"}%{$fg_bold[green]%}%2c%{$reset_color%} ${GIT_PROMPT}%{$fg_bold[cyan]%}%{$reset_color%} '
export PROMPT='$(os_icon) ${SSH_CONNECTION+"%{$fg[yellow]%}%n@%m%{$reset_color%}:"}%{$fg_bold[green]%}%2c%{$reset_color%} ${GIT_PROMPT}%{$fg_bold[cyan]%}%{$reset_color%} '
export RPROMPT='%D{%K:%M:%S}'
# update the prompt on carriage return