diff --git a/lib/git.zsh b/lib/git.zsh index be9fa7e67..c0b712845 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -22,6 +22,10 @@ function git_prompt_info() { || ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) \ || return 0 + local tag + tag=$(__git_prompt_git describe --tags --exact-match 2> /dev/null) \ + && tag="(${tag})" + # Use global ZSH_THEME_GIT_SHOW_UPSTREAM=1 for including upstream remote info local upstream if (( ${+ZSH_THEME_GIT_SHOW_UPSTREAM} )); then @@ -29,7 +33,7 @@ function git_prompt_info() { && upstream=" -> ${upstream}" fi - echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}" + echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${tag}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}" } # Checks if working tree is dirty