git.zsh 508 B

12345678910111213141516171819
  1. # get the name of the branch we are on
  2. function git_prompt_info() {
  3. ref=$(git symbolic-ref HEAD 2> /dev/null) || return
  4. branch=${ref#refs/heads/}
  5. if [[ -d .git ]]; then
  6. CURRENT_BRANCH="%{$fg[red]%}git:(%{$fg[green]${branch}%{$fg[red])"
  7. else
  8. CURRENT_BRANCH=''
  9. fi
  10. #echo "%{$fg[red]%}git:(%{$fg[green]$CURRENT_BRANCH%{$fg[red])"
  11. echo $CURRENT_BRANCH
  12. }
  13. parse_git_dirty () {
  14. [[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "%{$fg[white] ♻ "
  15. }