summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues.hiegel@qosmos.com>2014-07-11 12:46:50 +0200
committerHugues Hiegel <hugues.hiegel@qosmos.com>2014-10-21 16:56:08 +0200
commit13b0e369f99f0d28a6feeedde56e33f786d4731e (patch)
tree259711c889e872a8d4ef7ece63beb3f464e879d8
parentc2460624c2614c3502fb00125d0064562d729dfe (diff)
[Prompts] highlights current git folder
-rw-r--r--12_Prompts.zsh14
1 files changed, 13 insertions, 1 deletions
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index d49b947..48423a8 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -84,7 +84,19 @@ __update_prompt_elements()
__set_prompt_date
__hbar
- CURDIR=$C_$_prompt_colors[path]$_C"%(!.%d.%~)"$C_$color[none]$_C
+ CURDIR="%(!.%d.%~)"
+ __gitdir="$(readlink -m $( git rev-parse --git-dir 2>&- ) 2>&- | sed 's\'$HOME'\~\;s\/.git$\\')"
+ #print "#1# "$__gitdir
+ #print "#2# "$CURDIR
+ #print "#2# "$(print -Pn $CURDIR)
+ if [ -n "$__gitdir" ]
+ then
+ ___gitdir=$(dirname $__gitdir)"/"
+ [ $___gitdir == "./" ] && unset ___gitdir
+ CURDIR="$(print -Pn "$CURDIR" | sed "s*$__gitdir*$___gitdir${C_}$_prompt_colors[soft_generic];3$_C${__gitdir:t}$C_$_prompt_colors[path]$_C*")"
+ fi
+ #print "#3# "$CURDIR
+ CURDIR=$C_$_prompt_colors[path]$_C$CURDIR$C_$color[none]$_C
}