diff --git a/themes/essembeh.zsh-theme b/themes/essembeh.zsh-theme index 939bb7a4c..77f15f36a 100644 --- a/themes/essembeh.zsh-theme +++ b/themes/essembeh.zsh-theme @@ -1,24 +1,15 @@ # Theme with full path names and hostname # Handy if you work on different servers all the time; -local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})" -function my_git_prompt_info() { +## Git plugin +function my_git_prompt_info { ref=$(git symbolic-ref HEAD 2> /dev/null) || return GIT_STATUS=$(git_prompt_status) [[ -n $GIT_STATUS ]] && GIT_STATUS=" $GIT_STATUS" echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$GIT_STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX" } -# Colored prompt -ZSH_THEME_COLOR_USER="green" -ZSH_THEME_COLOR_HOST="green" -ZSH_THEME_COLOR_PWD="yellow" -test -n "$SSH_CONNECTION" && ZSH_THEME_COLOR_USER="red" && ZSH_THEME_COLOR_HOST="red" -test `id -u` = 0 && ZSH_THEME_COLOR_USER="magenta" && ZSH_THEME_COLOR_HOST="magenta" -PROMPT='%{$fg_bold[$ZSH_THEME_COLOR_USER]%}%n@%{$fg_bold[$ZSH_THEME_COLOR_HOST]%}%M%{$reset_color%}:%{$fg_bold[$ZSH_THEME_COLOR_PWD]%}%~%{$reset_color%} $(my_git_prompt_info)%(!.#.$) ' -RPS1="${return_code}" - ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}(" ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}" ZSH_THEME_GIT_PROMPT_UNTRACKED="%%" @@ -28,3 +19,17 @@ ZSH_THEME_GIT_PROMPT_RENAMED="~" ZSH_THEME_GIT_PROMPT_DELETED="!" ZSH_THEME_GIT_PROMPT_UNMERGED="?" +# My prompt with colors +local ESSEMBEH_PROMPT_EXTRA="" +local ESSEMBEH_PROMPT_HOST_COLOR="green" +test -r /etc/debian_chroot && ESSEMBEH_PROMPT_EXTRA="%{$fg[yellow]%}[chroot:$(cat /etc/debian_chroot)]%{$reset_color%} " +test -r /.dockerenv && ESSEMBEH_PROMPT_EXTRA="%{$fg[yellow]%}[docker]%{$reset_color%} " +test -n "$SSH_CONNECTION" && ESSEMBEH_PROMPT_EXTRA="%{$fg[yellow]%}[$(echo $SSH_CONNECTION | awk '{print $1}')]%{$reset_color%} " +test -n "$SSH_CONNECTION" && ESSEMBEH_PROMPT_HOST_COLOR="red" +test "$UID" = "0" && ESSEMBEH_PROMPT_HOST_COLOR="magenta" +local ESSEMBEH_PROMPT_HOST="%{$fg[$ESSEMBEH_PROMPT_HOST_COLOR]%}%n@%M%{$reset_color%}" +local ESSEMBEH_PROMPT_PWD="%{%B$fg[yellow]%}%~%{$reset_color%b%}" + +PROMPT='${ESSEMBEH_PROMPT_EXTRA}${ESSEMBEH_PROMPT_HOST}:${ESSEMBEH_PROMPT_PWD} $(my_git_prompt_info)%(!.#.$) ' +RPS1="%(?..%{$fg[red]%}%?%{$reset_color%})" +