dotfiles/.config/zsh/lib/30-prompt.zsh

22 lines
687 B
Bash
Raw Normal View History

2016-04-16 16:31:54 +02:00
setopt prompt_subst
autoload -U promptinit
promptinit
2020-11-08 10:26:58 +01:00
## Print bold red username when UID = 0, else unsername in green
2020-11-01 16:52:24 +01:00
p_user='%(!.%F{red}%B%n%b%f.%F{green}%n%f)'
2020-11-08 10:26:58 +01:00
## Print red # when UID = 0, else @ in blue
2020-11-01 12:29:23 +01:00
p_at='%(!.%F{red}%B#%b%f.%F{blue}@%f)'
2020-11-08 10:26:58 +01:00
## Print hostname in blue
2020-11-01 12:29:23 +01:00
p_host='%F{blue}%m%f'
2020-11-08 10:26:58 +01:00
## Print path in yellow
2020-11-01 12:29:23 +01:00
p_path='%F{yellow}%~%f'
2020-11-08 10:26:58 +01:00
## Print prompt sign in red if the previous command retunend and error, otherwise print it in white
p_pr='%(?.%F{white}.%F{red}) %B〉%b%f'
# Add green arrows (⇣⇡) if connection is via ssh
if [[ "${SSH_CONNECTION}" ]]; then
p_ssh=" %F{green}⇣⇡%f";
fi;
2020-11-01 12:29:23 +01:00
PS1="$p_user$p_at$p_host$p_ssh $p_path$p_pr"
2020-11-01 16:57:26 +01:00
unset p_at p_user p_host p_path p_pr