2022-06-06 13:25:34 +03:00
|
|
|
# ivabus zsh prompt theme
|
|
|
|
__zsh_prompt() {
|
|
|
|
local prompt_username
|
2022-09-25 18:39:47 +03:00
|
|
|
prompt_username="%n"
|
2022-09-28 17:16:06 +03:00
|
|
|
local prompt_hostname
|
|
|
|
prompt_hostname="%m"
|
|
|
|
if [[ $UID == 0 || $EUID == 0 ]]; then
|
|
|
|
PROMPT="%{$fg[red]%}${prompt_username}%{$reset_color%}@%{$fg[red]%}${prompt_hostname} %(?:%{$reset_color%}➜ :%{$fg_bold[red]%}➜ )"
|
2022-09-25 18:39:47 +03:00
|
|
|
else
|
2022-09-28 17:16:06 +03:00
|
|
|
PROMPT="%{$fg[green]%}${prompt_username}%{$reset_color%}@%{$fg[cyan]%}${prompt_hostname} %(?:%{$reset_color%}➜ :%{$fg_bold[red]%}➜ )" # User/exit code arrow
|
2022-09-25 18:39:47 +03:00
|
|
|
fi
|
2022-06-06 13:25:34 +03:00
|
|
|
PROMPT+='%{$fg_bold[blue]%}%(5~|%-1~/…/%3~|%4~)%{$reset_color%} ' # cwd
|
|
|
|
PROMPT+='$(git_prompt_info)' # Git status
|
2022-09-28 17:16:06 +03:00
|
|
|
if [[ $UID == 0 || $EUID == 0 ]]; then
|
2022-09-25 18:39:47 +03:00
|
|
|
PROMPT+='%{$fg[red]%}# %{$reset_color%}'
|
|
|
|
else
|
|
|
|
PROMPT+='%{$fg[white]%}$ %{$reset_color%}'
|
|
|
|
fi
|
2022-06-06 13:25:34 +03:00
|
|
|
unset -f __zsh_prompt
|
|
|
|
}
|
|
|
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[cyan]%}(%{$fg_bold[red]%}"
|
|
|
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
|
|
|
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg_bold[yellow]%}✗%{$fg_bold[cyan]%})"
|
|
|
|
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[cyan]%})"
|
|
|
|
__zsh_prompt
|