From 09dcfa003095734084c5c68f00274e50cd72498f Mon Sep 17 00:00:00 2001 From: Ivan Bushchik Date: Wed, 28 Sep 2022 17:16:06 +0300 Subject: [PATCH] Add hostname --- ivabus.zsh-theme | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ivabus.zsh-theme b/ivabus.zsh-theme index 35e6088..397459f 100644 --- a/ivabus.zsh-theme +++ b/ivabus.zsh-theme @@ -2,14 +2,16 @@ __zsh_prompt() { local prompt_username prompt_username="%n" - if [[ $UID == 0 || $EUID == 0 ]]; then # check if root for red colors for username - PROMPT="%{$fg[red]%}${prompt_username} %(?:%{$reset_color%}➜ :%{$fg_bold[red]%}➜ )" + 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]%}➜ )" else - PROMPT="%{$fg[green]%}${prompt_username} %(?:%{$reset_color%}➜ :%{$fg_bold[red]%}➜ )" + PROMPT="%{$fg[green]%}${prompt_username}%{$reset_color%}@%{$fg[cyan]%}${prompt_hostname} %(?:%{$reset_color%}➜ :%{$fg_bold[red]%}➜ )" # User/exit code arrow fi PROMPT+='%{$fg_bold[blue]%}%(5~|%-1~/…/%3~|%4~)%{$reset_color%} ' # cwd PROMPT+='$(git_prompt_info)' # Git status - if [[ $UID == 0 || $EUID == 0 ]]; then # again root and red colors but now for indicator + if [[ $UID == 0 || $EUID == 0 ]]; then PROMPT+='%{$fg[red]%}# %{$reset_color%}' else PROMPT+='%{$fg[white]%}$ %{$reset_color%}'