Skip to content

Instantly share code, notes, and snippets.

@alfredxing
Last active August 29, 2015 14:04
Show Gist options
  • Save alfredxing/0637c9dbc70bca785d8e to your computer and use it in GitHub Desktop.
Save alfredxing/0637c9dbc70bca785d8e to your computer and use it in GitHub Desktop.
Wonderful: A ZSH theme
git_prompt_info () {
if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]
then
ref=$(command git symbolic-ref HEAD 2> /dev/null) || ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
echo "$ZSH_THEME_GIT_PROMPT_PREFIX$(parse_git_dirty)${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX"
fi
}
PROMPT='%{$fg[blue]%}%* %{$fg_bold[cyan]%}%~%{$reset_color%}%{$fg[blue]%}$(git_prompt_info) %{$fg[red]%}➜%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX=" ["
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[blue]%}]%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}"
ZSH_PROMPT_BASE_COLOR="%{$fg[blue]%}"
ZSH_THEME_REPO_NAME_COLOR="%{$fg[green]%}"
# Terminal title
case $TERM in
xterm*)
precmd () {print -Pn "\e]0;%n@%m: %~\a"}
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment