diff options
author | Hugues Hiegel <hugues@hiegel.fr> | 2012-01-31 10:03:34 +0100 |
---|---|---|
committer | Hugues Hiegel <hugues@hiegel.fr> | 2012-01-31 10:03:55 +0100 |
commit | 990cd5e517ce4f752aadb42f6af3e0edb2333440 (patch) | |
tree | bb8d4ea600687b250523eaa9ba4680edef6b224e /12_Prompts.zsh | |
parent | 55250fa58ede8bb33f39ebb4503e6862f84b9fdf (diff) |
[Prompts] chpwd: corrects 55250fa58e;
displays whole 'your branch..' paragraph, not just first line
Diffstat (limited to '12_Prompts.zsh')
-rw-r--r-- | 12_Prompts.zsh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/12_Prompts.zsh b/12_Prompts.zsh index 052c2dd..50575fa 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -41,7 +41,14 @@ chpwd() if ( __cmd_exists git && test -d .git ) then # Shows tracked branches and modified files - git status | awk '/^# Your branch/ { print $0 }' | sed 's/^# / /' + git status | awk ' + BEGIN { YOURBRANCH=0 } + { + if (NR==2 && $0 ~ "^# Your branch ") { YOURBRANCH=1 } + if ((NR>=2 && YOURBRANCH==0) || $0 ~ "^#$") { exit } + if (YOURBRANCH==1) { print $0 } + } + ' | sed 's/^# / /' fi |