Skip to content

Instantly share code, notes, and snippets.

@BitOfUniverse
Forked from randsina/.bashrc
Created April 22, 2016 14:34
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 BitOfUniverse/e21884a9e62b2384f500a11020f2b9a1 to your computer and use it in GitHub Desktop.
Save BitOfUniverse/e21884a9e62b2384f500a11020f2b9a1 to your computer and use it in GitHub Desktop.
Prompt for bash
ESC="\033" # This is the escape sequence
NO_COLOR="$ESC[0m"
IRED="$ESC[1;31m" # ANSI color code for intense/bold red
IGRN="$ESC[1;32m" # ANSI color code for intense/bold green
# From http://railstips.org/blog/archives/2009/02/02/bedazzle-your-bash-prompt-with-git-info/
# I had to change 'git-symbolic-ref' to 'git symbolic-ref'
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo " ["${ref#refs/heads/}"]" # I wanted my branch wrapped in [], use () or <> or whatever
}
# from http://ariejan.net/2010/04/25/ruby-version-and-gemset-in-your-bash-prompt-yes-sir
function rvm_version {
local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}')
[ "$gemset" != "" ] && gemset="@$gemset"
local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}')
[ "$version" != "" ] && version="$version"
local full="$version$gemset"
[ "$full" != "" ] && echo "${full}:" # the colon at the end is a delimiter, you could use a space instead
}
#PS1="\h:\W \u\$" # For reference, here's the default OS X prompt
#export PS1="\$(rvm_version)\W \$(parse_git_branch)\$ " # Without the colors
# I had to put the \[ and \] down here, as opposed to $IRED, to avoid wrapping funkiness.
export PS1="\[$IRED\]\$(rvm_version)\[$NO_COLOR\]\W\[$IGRN\]\$(parse_git_branch)\[$NO_COLOR\] \$ "
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
export PS1="\[\033[00;31m\][\@] \[\033[01;32m\]\u\[\e[1;37m\] \W\[\033[01;34m\]\$(__git_ps1) \[$IRED\]\$(rvm_version)\[$NO_COLOR\]\[$IGRN\]\[\033[00m\] $ "
export EDITOR=atom
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment