2015-12-18 17:02:56 +01:00
|
|
|
#
|
|
|
|
# Gitster theme
|
|
|
|
# https://github.com/shashankmehta/dotfiles/blob/master/thesetup/zsh/.oh-my-zsh/custom/themes/gitster.zsh-theme
|
|
|
|
#
|
|
|
|
|
2016-01-07 14:06:52 +01:00
|
|
|
gst_get_status() {
|
2016-01-06 20:06:06 +01:00
|
|
|
print "%(?:%F{10}➜ :%F{9}➜ %s)"
|
|
|
|
}
|
2015-12-18 17:02:56 +01:00
|
|
|
|
2016-01-07 14:06:52 +01:00
|
|
|
gst_get_pwd() {
|
2016-03-25 22:37:00 +01:00
|
|
|
prompt_short_dir="$(short_pwd)"
|
|
|
|
git_root="$(command git rev-parse --show-toplevel 2> /dev/null)" && \
|
|
|
|
prompt_short_dir="${prompt_short_dir#${$(short_pwd $git_root):h}/}"
|
2016-01-07 14:06:52 +01:00
|
|
|
print ${prompt_short_dir}
|
2015-12-18 17:02:56 +01:00
|
|
|
}
|
|
|
|
|
2016-01-07 14:06:52 +01:00
|
|
|
prompt_gitster_precmd() {
|
2016-01-06 20:06:06 +01:00
|
|
|
PROMPT='$(gst_get_status) %F{white}$(gst_get_pwd) $(git_prompt_info)%f '
|
|
|
|
}
|
|
|
|
|
2016-01-07 14:06:52 +01:00
|
|
|
prompt_gitster_setup() {
|
2016-01-06 20:06:06 +01:00
|
|
|
ZSH_THEME_GIT_PROMPT_PREFIX="%F{cyan}"
|
|
|
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%f"
|
|
|
|
ZSH_THEME_GIT_PROMPT_DIRTY=" %F{yellow}✗%f"
|
|
|
|
ZSH_THEME_GIT_PROMPT_CLEAN=" %F{green}✓%f"
|
|
|
|
|
|
|
|
autoload -Uz add-zsh-hook
|
|
|
|
|
|
|
|
add-zsh-hook precmd prompt_gitster_precmd
|
|
|
|
prompt_opts=(cr subst percent)
|
|
|
|
}
|
2015-12-18 17:02:56 +01:00
|
|
|
|
2016-01-06 20:06:06 +01:00
|
|
|
prompt_gitster_setup "$@"
|