From: Samir Benmendil Date: Thu, 13 Mar 2025 22:02:27 +0000 (+0000) Subject: zsh: show tags in git_prompt_status X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/99f0134124fbae8c036a79ba0d6c3dd63d69422f zsh: show tags in git_prompt_status --- diff --git a/zsh/lib/99-prompt.zsh b/zsh/lib/99-prompt.zsh index f5ea7ed..e7db942 100644 --- a/zsh/lib/99-prompt.zsh +++ b/zsh/lib/99-prompt.zsh @@ -79,10 +79,20 @@ git_prompt_status() { fi done < <(${(z)status_cmd} 2> /dev/null) - local git_status=" " + local git_status=" " + # Format tags + local tags=( $(git tag --points-at) ) + if (( ${#tags} > 0 )); then + local icon=󰓹 + (( ${#tags} > 1)) && icon=󰓻 + git_status+="$icon%{$fg_bold[yellow]%}${(j:,:)tags}" + elif [[ "$head" == '(detached)' ]]; then + git_status+="%{$fg_bold[white]%}󰌸" + fi - # Format branch and commit - git_status+="%{$fg_bold[green]%}$head" + if [[ "$head" != '(detached)' ]]; then + git_status+="%{$fg_bold[green]%}$head" + fi git_status+="%{$fg_no_bold[yellow]%}(${oid[1,8]})" # Format upstream