2017-11-15 23:06:29 +00:00
|
|
|
# ZSH Theme emulating the Fish shell's default prompt.
|
|
|
|
|
|
|
|
_fishy_collapsed_wd() {
|
2018-07-30 08:29:00 +00:00
|
|
|
pwd | sed -E 's|^'$HOME'|~|;s|(.*)/|\1%|;s|((^\|/)\.?[^/%]{1})[^/%]*|\1|g;s|(.*)%|\1/|'
|
2017-11-15 23:06:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Required for dynamic prompt
|
|
|
|
setopt prompt_subst
|
|
|
|
|
|
|
|
local user_color='green'; [ $UID -eq 0 ] && user_color='red'
|
|
|
|
PROMPT="%n@%m %F{$user_color}\$(_fishy_collapsed_wd)%f%(!.#.>) "
|
|
|
|
PROMPT2='%F{red}\ %f'
|
|
|
|
|
|
|
|
local return_status="%F{red}%(?..%?)%f"
|
2018-10-20 12:42:18 +00:00
|
|
|
RPROMPT='${return_status}%{$reset_color%}'
|