]> git.rmz.io Git - dotfiles.git/commitdiff
zsh: fix git prompt
authorSamir Benmendil <me@rmz.io>
Sat, 11 Jul 2015 17:59:46 +0000 (18:59 +0100)
committerSamir Benmendil <me@rmz.io>
Sat, 11 Jul 2015 18:02:18 +0000 (19:02 +0100)
zsh/lib/prompt.zsh
zshrc

index 61f5db8f64a3b387df4d0a1a11ee1104927c0903..3fc1c242758929cad8afc61f46eec3877ec8f751 100644 (file)
@@ -41,9 +41,9 @@ git_prompt_status() {
   # Get current status.
   while IFS=$'\n' read line; do
     if [[ "$line" == \#\#\ * ]]; then
-      [[ "$line" =~ '## ([^.]*)\.\.\.(.*)' ]] && branch=$match[1]
-      [[ "$line" =~ 'ahead ([0-9]+)'  ]]      && ahead=$match[1]
-      [[ "$line" =~ 'behind ([0-9]+)'  ]]     && behind=$match[1]
+      [[ "$line" =~ '## (.*?)(\.\.\.|$)' ]] && branch=$match[1]
+      [[ "$line" =~ 'ahead ([0-9]+)'  ]]  && ahead=$match[1]
+      [[ "$line" =~ 'behind ([0-9]+)'  ]] && behind=$match[1]
     else
       # Count added, deleted, modified, renamed, unmerged, untracked, dirty.
       # T (type change) is undocumented, see http://git.io/FnpMGw.
diff --git a/zshrc b/zshrc
index e6126f22c2ff7b6c66179bb24a42e624d673ab17..aad02d395f618d849012cdb1b48017377b83903d 100644 (file)
--- a/zshrc
+++ b/zshrc
@@ -30,6 +30,7 @@ setopt noclobber    # don't allow overwriting files with '>', use '>!' instead
 setopt notify
 setopt rcquotes     # echo 'don''t'; prints don't
 setopt dvorak       # correct_all uses dvorak
+setopt rematch_pcre # use perl regexp
 
 # disable flow control
 setopt noflowcontrol