]> git.rmz.io Git - dotfiles.git/blobdiff - zsh/lib/99-prompt.zsh
zsh: show tags in git_prompt_status
[dotfiles.git] / zsh / lib / 99-prompt.zsh
index f5ea7ed90483331ccc91a9099d21963cd738948c..e7db942330697e7114c7f5200e3adb330da9be91 100644 (file)
@@ -79,10 +79,20 @@ git_prompt_status() {
     fi
   done < <(${(z)status_cmd} 2> /dev/null)
 
     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
   git_status+="%{$fg_no_bold[yellow]%}(${oid[1,8]})"
 
   # Format upstream