Skip to content

Commit

Permalink
fix(essembeh): fix git info in prompt
Browse files Browse the repository at this point in the history
- with latest nixos zsh/ohmyzsh update, git informations in prompt were
  not displayed
  • Loading branch information
essembeh committed Jun 17, 2024
1 parent 677f501 commit e013b3f
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions themes/essembeh.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,7 @@
# git plugin
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}("
ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%%"
ZSH_THEME_GIT_PROMPT_ADDED="+"
ZSH_THEME_GIT_PROMPT_MODIFIED="*"
ZSH_THEME_GIT_PROMPT_RENAMED="~"
ZSH_THEME_GIT_PROMPT_DELETED="!"
ZSH_THEME_GIT_PROMPT_UNMERGED="?"

function zsh_essembeh_gitstatus {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
GIT_STATUS=$(git_prompt_status)
if [[ -n $GIT_STATUS ]]; then
GIT_STATUS=" $GIT_STATUS"
fi
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$GIT_STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX"
}

# by default, use green for user@host and no prefix
local ZSH_ESSEMBEH_COLOR="green"
Expand All @@ -46,5 +32,5 @@ if [[ $UID = 0 ]]; then
# always use magenta for root sessions, even in ssh
ZSH_ESSEMBEH_COLOR="magenta"
fi
PROMPT='${ZSH_ESSEMBEH_PREFIX}%{$fg[$ZSH_ESSEMBEH_COLOR]%}%n@%M%{$reset_color%}:%{%B$fg[yellow]%}%~%{$reset_color%b%} $(zsh_essembeh_gitstatus)%(!.#.$) '
PROMPT='${ZSH_ESSEMBEH_PREFIX}%{$fg[$ZSH_ESSEMBEH_COLOR]%}%n@%M%{$reset_color%}:%{%B$fg[yellow]%}%~%{$reset_color%b%} $(git_prompt_info)%(!.#.$) '
RPROMPT="%(?..%{$fg[red]%}%?%{$reset_color%})"

0 comments on commit e013b3f

Please sign in to comment.