2022-06-06 13:25:34 +03:00
|
|
|
# ivabus zsh prompt theme
|
|
|
|
__zsh_prompt() {
|
2022-09-29 18:54:50 +03:00
|
|
|
# set basic prompt with "USERNAME@HOSTNAME "
|
|
|
|
if [[ $UID == 0 || $EUID == 0 ]]; then
|
2023-02-05 12:33:40 +03:00
|
|
|
PROMPT="%F{red}%n%f@%F{red}%m "
|
2022-09-29 18:54:50 +03:00
|
|
|
else
|
2023-02-05 12:33:40 +03:00
|
|
|
PROMPT="%F{green}%n%f@%F{cyan}%m "
|
2022-09-29 18:54:50 +03:00
|
|
|
fi
|
|
|
|
# add to current prompt arrow or [exitcode] if non 0
|
2023-02-05 12:33:40 +03:00
|
|
|
PROMPT+='%(?:%f➜ :%B%F{red}%(?..[%?]) )%b'
|
2022-09-29 18:54:50 +03:00
|
|
|
# add current working directory
|
2023-02-05 12:33:40 +03:00
|
|
|
PROMPT+='%B%F{blue}%(5~|%-1~/…/%3~|%4~)%f%b '
|
2022-09-29 18:54:50 +03:00
|
|
|
# add $ or #
|
|
|
|
if [[ $UID == 0 || $EUID == 0 ]]; then
|
2023-02-05 12:33:40 +03:00
|
|
|
PROMPT+='%F{red}# %f'
|
2022-09-29 18:54:50 +03:00
|
|
|
else
|
2023-02-05 12:33:40 +03:00
|
|
|
PROMPT+='%F{white}$ %f'
|
2022-09-29 18:54:50 +03:00
|
|
|
fi
|
|
|
|
unset -f __zsh_prompt
|
2022-06-06 13:25:34 +03:00
|
|
|
}
|
2023-02-05 12:33:40 +03:00
|
|
|
__zsh_prompt
|