Skip to content

Instantly share code, notes, and snippets.

@garrow
Created April 17, 2012 07:09
Show Gist options
  • Save garrow/2404124 to your computer and use it in GitHub Desktop.
Save garrow/2404124 to your computer and use it in GitHub Desktop.
Nice changing prompt character, based on the current repository type.
function prompt_char {
if [[ -d './.svn/' ]]; then echo '§' && return; fi
# it's faster to test for a `./.svn` directory than
# to exec `svn` & check return codes
git branch >/dev/null 2>&1 && echo '±' && return
hg root >/dev/null 2>&1 && echo '☿' && return
# redirect output of commands to /dev/null &
# echo custom char based on successful execution
echo '○'
# Fallback to default
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment