From 99f0134124fbae8c036a79ba0d6c3dd63d69422f Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Thu, 13 Mar 2025 22:02:27 +0000 Subject: [PATCH] zsh: show tags in git_prompt_status --- zsh/lib/99-prompt.zsh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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 -- 2.48.1