]> git.rmz.io Git - dotfiles.git/blobdiff - zsh/lib/prompt.zsh
vim: reinstate K -> "git show" map in gitrebase
[dotfiles.git] / zsh / lib / prompt.zsh
index 56d702b67f4e9b278fbd420263e6205baaa25068..fa894be16eaf9dc3f86030567d4c5bb80f02a305 100644 (file)
@@ -51,6 +51,7 @@ git_prompt_status() {
     if [[ "$line" == \#\ * ]]; then
       [[ "$line" =~ '# branch.oid ([0-9a-f]+)' ]]         && oid=$match[1]
       [[ "$line" =~ '# branch.head (.*)' ]]               && head=$match[1]
+      [[ "$line" =~ '# branch.upstream (.*)' ]]           && upstream=$match[1]
       [[ "$line" =~ '# branch.ab \+([0-9]+) -([0-9]+)' ]] && ahead=$match[1] && behind=$match[2]
     else
       # Count added, deleted, modified, renamed, unmerged, untracked, dirty.
@@ -69,6 +70,8 @@ git_prompt_status() {
 
       # merge conflicts
       [[ "$line" == u\ (AA|DD|U?|?U)\ * ]] && (( unmerged++ ))
+
+      #TODO more info for submodules?
     fi
   done < <(${(z)status_cmd} 2> /dev/null)
 
@@ -79,6 +82,7 @@ git_prompt_status() {
 
   # Format upstream
   local upstream_str
+  [[ -z "$upstream" ]] && upstream_str+="%{$fg[blue]%} Ɇ"
   (( ahead  > 0 )) && upstream_str+="%{$fg[blue]%} >$ahead"
   (( behind > 0 )) && upstream_str+="%{$fg[blue]%} <$behind"
   git_status+="$upstream_str"