Skip to content

Instantly share code, notes, and snippets.

@catvec
Created January 18, 2015 18:08
Show Gist options
  • Save catvec/dcec26620529b0bd46e4 to your computer and use it in GitHub Desktop.
Save catvec/dcec26620529b0bd46e4 to your computer and use it in GitHub Desktop.
Extends the default Babun ZSH theme. Removes the location on the right prompt and replaces it with most recent return code. On the left prompt it will shorten the location if the user is in a "home". If the user is in a Cygwin home the shortended text will be red to signifiy a Cygwin home
local return_code="%(?..%{$fg[red]%}%? %{$reset_color%})"
function collapse_pwd {
BABUN_ZSH_CUSTOM_THEME_REAL_HOME="/cygdrive/c/Users/noahh_000"
BABUN_ZSH_CUSTOM_THEME_CYGWIN_HOME="/home/Noah Huppert"
echo $(pwd | sed -e "s,^$BABUN_ZSH_CUSTOM_THEME_REAL_HOME,~," | sed -e "s,^$BABUN_ZSH_CUSTOM_THEME_CYGWIN_HOME,%{$fg[red]%}~%{$fg[blue]%}," )
}
PROMPT='%{$fg[blue]%}{ $(collapse_pwd) } \
%{$fg[green]%}$( git rev-parse --abbrev-ref HEAD 2> /dev/null || echo "" )%{$reset_color%} \
%{$fg[red]%}%(!.#.»)%{$reset_color%} '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
RPS1='${return_code} '
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}:: %{$fg[yellow]%}("
ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$fg[yellow]%}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment