Skip to content

Instantly share code, notes, and snippets.

@bpizzi
Last active December 22, 2015 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bpizzi/6474286 to your computer and use it in GitHub Desktop.
Save bpizzi/6474286 to your computer and use it in GitHub Desktop.
~/.oh-my-zsh/themes/agnoster.zsh-theme
# Original theme https://github.com/agnoster zsh theme
ZSH_THEME_GIT_PROMPT_DIRTY='±'
function _git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)"
echo "${ref/refs\/heads\//⭠ }$(parse_git_dirty)"
}
function _git_info() {
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
local BG_COLOR=green
if [[ -n $(parse_git_dirty) ]]; then
BG_COLOR=yellow
FG_COLOR=black
fi
if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
BG_COLOR=red
FG_COLOR=white
fi
echo "%{%K{$BG_COLOR}%}⮀%{%F{$FG_COLOR}%} $(_git_prompt_info) %{%F{$BG_COLOR}%K{blue}%}⮀"
else
echo "%{%K{blue}%}⮀"
fi
}
function virtualenv_info {
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
}
PROMPT_HOST='%{%b%F{gray}%K{black}%} %(?.%{%F{green}%}✔.%{%F{red}%}✘)%{%F{yellow}%} %n@%m %{%F{black}%}'
PROMPT_DIR='%{%F{white}%} %~% '
PROMPT_SU='%(!.%{%k%F{blue}%K{black}%}⮀%{%F{yellow}%} # %{%k%F{black}%}.%{%k%F{blue}%})⮀%{%f%k%b%}'
local ret_status="%(?:%{$fg_bold[green]%}:%{$fg_bold[red]%})%?%{$reset_color%}"
PROMPT='%{%f%b%k%}$PROMPT_HOST$(_git_info)$PROMPT_DIR$PROMPT_SU
$(virtualenv_info)[${ret_status}] '
RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}'
prompt_smileart_setup "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment