2015-12-18 11:02:56 -05:00
|
|
|
#
|
|
|
|
# Gitster theme
|
|
|
|
# https://github.com/shashankmehta/dotfiles/blob/master/thesetup/zsh/.oh-my-zsh/custom/themes/gitster.zsh-theme
|
|
|
|
#
|
|
|
|
|
2015-12-30 01:23:52 -05:00
|
|
|
autoload -Uz colors && colors
|
|
|
|
prompt_opts=( cr subst percent )
|
|
|
|
|
2015-12-18 11:02:56 -05:00
|
|
|
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
|
|
|
|
|
|
|
|
function get_pwd(){
|
|
|
|
git_root=$PWD
|
|
|
|
while [[ $git_root != / && ! -e $git_root/.git ]]; do
|
|
|
|
git_root=$git_root:h
|
|
|
|
done
|
|
|
|
if [[ $git_root = / ]]; then
|
|
|
|
unset git_root
|
2016-01-06 09:41:40 -05:00
|
|
|
prompt_short_dir="$(short_pwd)"
|
2015-12-18 11:02:56 -05:00
|
|
|
else
|
|
|
|
parent=${git_root%\/*}
|
2016-01-06 09:41:40 -05:00
|
|
|
prompt_short_dir=${"$(short_pwd)"#$parent/}
|
2015-12-18 11:02:56 -05:00
|
|
|
fi
|
|
|
|
print $prompt_short_dir
|
|
|
|
}
|
|
|
|
|
2015-12-30 01:23:52 -05:00
|
|
|
PROMPT='$ret_status %{$fg[white]%}$(get_pwd) $(git_prompt_info)%{$reset_color%}%{$reset_color%} '
|
2015-12-18 11:02:56 -05:00
|
|
|
|
|
|
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}"
|
|
|
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
|
|
|
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[yellow]%}✗%{$reset_color%}"
|
|
|
|
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✓%{$reset_color%}"
|