Skip to content

Instantly share code, notes, and snippets.

@rharriso
Created June 29, 2013 19:42
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 rharriso/5892384 to your computer and use it in GitHub Desktop.
Save rharriso/5892384 to your computer and use it in GitHub Desktop.
Custom prompt display for Zsh. Shows current user, time, machine name, current directory, and current git branch (if applicable)
#
# prompt
#
alias ls='ls -G'
# Stuff for git
parse_git_branch () {
git branch 2> /dev/null | grep "*" | sed -e 's/* \(.*\)/ (\1)/g'
}
# sunburst.vim like colors for prompt
BLACK=$'\033[0m'
RED=$'\033[38;5;167m'
GREEN=$'\033[38;5;71m'
BLUE=$'\033[38;5;111m'
YELLOW=$'\033[38;5;228m'
ORANGE=$'\033[38;5;173m'
function precmd() {
export PROMPT="%{$BLACK%}[%{$RED%}%~%{$YELLOW%}$(parse_git_branch)%{$BLACK%}]
> "
export RPROMPT="%{$YELLOW%}%n@%m%{$BLUE%}[%T]%{$BLACK%}%{$BLACK%}"
}
# System dependent setup stuff goes in here
foreach f (~/.zshrc.d/*); do
. "$f"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment