Repo aware prompt

This commit is contained in:
Andrea Mistrali 2014-11-27 16:36:19 +00:00
parent 02063b266b
commit a1e61b9720
3 changed files with 14 additions and 4 deletions

View File

@ -19,5 +19,8 @@ autoload -U bak
# fancyTerm - returns true if we are on xterm/rxvt/screen, elsewhere false # fancyTerm - returns true if we are on xterm/rxvt/screen, elsewhere false
autoload -U fancyTerm autoload -U fancyTerm
# repo_char - returns a character based on the type of repo we are in
autoload -U repo_char
# vim: set ts=4 sw=4 tw=0 ft=zsh : # vim: set ts=4 sw=4 tw=0 ft=zsh :

View File

@ -4,14 +4,14 @@ if `fancyTerm`; then
I="%m::%." I="%m::%."
# L="$FX[bold]$FX[italic]$BG[111]$FG[239]@%m::%2~ $BG[000] # L="$FX[bold]$FX[italic]$BG[111]$FG[239]@%m::%2~ $BG[000]
# $FG[228]%#$FX[reset] " # $FG[228]%#$FX[reset] "
L="$FX[bold]$FX[italic]$BG[062]@%m::%2~ $BG[000] L='$FX[bold]$FX[italic]$BG[062]@%m::%2~$(repo_char)$BG[000]
$FG[220]%#$FX[reset] " $FG[220]%#$FX[reset] '
PS1="%{]2;$W%}%{]1;$I%}$L" PS1="%{]2;$W%}%{]1;$I%}$L"
unset W I L unset W I L
else else
# We are not on xterminal # We are not on xterminal
PS1="%B%K{blue}%F{white}[%l] %n@%m:%~ %f%k%F{yellow}%#%f%b " PS1="%B%K{blue}%F{white}[%l] %n@%m:%~ %f%k%F{yellow}%# $(repo_char)%f%b "
fi fi
} }

View File

@ -0,0 +1,7 @@
function repo_char {
# git branch > /dev/null 2> /dev/null && echo '±' && return
# svn info > /dev/null 2> /dev/null && echo '\u03a3' && return
# echo '\u25cb'
git branch > /dev/null 2> /dev/null && echo ' «git' && return
svn info > /dev/null 2> /dev/null && echo ' «svn' && return
}