Skip to content

Instantly share code, notes, and snippets.

@mbauhardt
Created November 6, 2013 21:18
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 mbauhardt/7344258 to your computer and use it in GitHub Desktop.
Save mbauhardt/7344258 to your computer and use it in GitHub Desktop.
ohmyzsh theme
new_line() {
echo ''
}
reset_colors() {
echo -n "%{%k%}"
echo -n "%{%f%}"
}
prompt_status() {
local excl_mark=$(echo -e "\xe2\x9d\x8c")
local check_mark=$(echo -e "\xe2\x9c\x85")
local symbols
symbols=()
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}$RETVAL $excl_mark $(reset_colors)"
[[ $RETVAL -eq 0 ]] && symbols+="%{%F{green}%}$RETVAL $check_mark $(reset_colors)"
echo -n "$symbols"
}
## Main prompt
build_prompt() {
RETVAL=$?
new_line
prompt_status
new_line
echo -n '%#'
}
PROMPT='$(build_prompt) '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment