summaryrefslogtreecommitdiff
path: root/12_Prompts.zsh
diff options
context:
space:
mode:
authorHugues Hiegel <hugues.hiegel@qosmos.com>2012-03-02 11:49:03 +0100
committerHugues Hiegel <hugues.hiegel@qosmos.com>2012-03-02 11:49:03 +0100
commit2c24aa69ffbecae6c4eb8f541c6f3da345241462 (patch)
tree00dc835b68807263833d354f995ca59ec7001325 /12_Prompts.zsh
parente1f4769a05e07a42c6e9c245421407d86cf973c5 (diff)
[Prompts] Hurrah !! Git-rebases are managed better than ever, with squishable git-hash :)
Diffstat (limited to '12_Prompts.zsh')
-rw-r--r--12_Prompts.zsh51
1 files changed, 28 insertions, 23 deletions
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index 3664b2b..4157d03 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -295,29 +295,34 @@ __update_prompt_elements()
then
if [ $spaceleft -lt $(( $PATHSIZE + $GITBRANCHSIZE )) ]
then
- local unbreakablegittail
- if [ "$(echo $GITBRANCH | grep "^\[rebase ")" = "" ]
- then
- # reduce the git-branch until it is shrinked to $minimalgitsize characters max.
-
- if [ $GITBRANCH[-1] = ")" ]
- then
- unbreakablegittail=${${(M)GITBRANCH%\~*}}
- [ "$unbreakablegittail" = "" -a $GITBRANCHSIZE -gt $minimalgitsize ] && unbreakablegittail=")"
- fi
- if [ $GITBRANCHSIZE -gt $minimalgitsize ]
- then
- GITBRANCHSIZE=$(( $spaceleft - $PATHSIZE ))
- [ $GITBRANCHSIZE -lt $minimalgitsize ] && GITBRANCHSIZE=$minimalgitsize
- fi
- GITBRANCH=`print -Pn "%"$(($GITBRANCHSIZE - ${#unbreakablegittail}))">..>"${GITBRANCH%\~*}${unbreakablegittail:+"%"${#unbreakablegittail}"<<"$GITBRANCH}`
- else
-
- #
- # TODO : réduire la taille du hash, s'il y en a un.
- #
-
- fi
+ local unbreakablegittail rebasing
+
+ if [ "$(echo $GITBRANCH | grep "^ \[")" != "" ]
+ then
+ #
+ # TODO : réduire la taille du hash, s'il y en a un.
+ #
+ rebasing=$GITBRANCH
+ GITBRANCH=${${GITBRANCH/*../}/] */}
+ fi
+
+ # reduce the git-branch until it is shrinked to $minimalgitsize characters max.
+ if [ $GITBRANCH[-1] = ")" ]
+ then
+ unbreakablegittail=${${(M)GITBRANCH%\~*}}
+ [ "$unbreakablegittail" = "" -a $GITBRANCHSIZE -gt $minimalgitsize ] && unbreakablegittail=$GITBRANCH[-1]
+ fi
+ if [ $GITBRANCHSIZE -gt $minimalgitsize ]
+ then
+ GITBRANCHCHUNK=$(( $GITBRANCHSIZE - ($spaceleft - $PATHSIZE) ))
+ [ $((${#GITBRANCH} - $GITBRANCHCHUNK)) -lt $minimalgitsize ] && GITBRANCHCHUNK=$((${#GITBRANCH} - $minimalgitsize))
+ fi
+ GITBRANCH=`print -Pn "%"$(( (${#GITBRANCH} - $GITBRANCHCHUNK) - ${#unbreakablegittail}))">¬>"${GITBRANCH%\~*}${unbreakablegittail:+"%"${#unbreakablegittail}"<<"$GITBRANCH}`
+
+ if [ -n "$rebasing" ]
+ then
+ GITBRANCH=${rebasing/..*]/..$GITBRANCH]}
+ fi
fi
fi
# then we reduce the path until it reaches the last path element,