Skip to content

Instantly share code, notes, and snippets.

@hschlichter
Last active December 15, 2016 09:26
Show Gist options
  • Save hschlichter/a8f28345357943ed33c621f1a6165226 to your computer and use it in GitHub Desktop.
Save hschlichter/a8f28345357943ed33c621f1a6165226 to your computer and use it in GitHub Desktop.
bash_profile that, for the current directory, shows the branch of the used git or mercurial repository.
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagacedj
export PATH="/usr/local/sbin:$PATH"
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh
hg_in_repo() {
hg branch 2> /dev/null | awk '{print "on "}'
}
hg_branch() {
hg branch 2> /dev/null | awk '{print "hg (" $1 ")"}'
}
git_in_repo() {
git branch 2> /dev/null | head -n 1 | awk '{print " git"}'
}
PS1="\n[\[\033[32m\]\w]\[\033[0m\]\$(git_in_repo)\$(__git_ps1) \$(hg_branch)\n\[\033[1;36m\]\u\[\033[32m\]$ \[\033[0m\]"
export EDITOR=vim
export NVM_DIR="/Users/henriksc/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
export GREP_OPTIONS='--color=always'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment