Skip to content

Instantly share code, notes, and snippets.

@asmallteapot
Created November 5, 2010 17:47
Show Gist options
  • Save asmallteapot/664516 to your computer and use it in GitHub Desktop.
Save asmallteapot/664516 to your computer and use it in GitHub Desktop.
Bash config with: Colours. Homebrew. RVM + Subversion status in prompt. user@host.tld:/dir title.
# system paths & enviroment variables
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
## subversion status
svn_status() {
local DIRTY REV=$(svn info 2>/dev/null | grep Revision | sed -e 's/Revision: //')
[ "$REV" ] || return
[ "$(svn st)" ] && DIRTY=' *'
echo "[r$REV$DIRTY]"
}
## ruby version manager
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
function rvm_status {
local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}')
[ "$gemset" != "" ] && gemset="@$gemset"
local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}')
[ "$version" == "1.8.7" ] && version=""
local full="$version$gemset"
[ "$full" != "" ] && echo "[$full]"
}
# prompt
export PS1='$(rvm_status)$(svn_status)[\[\033[01;32m\]\u\[\033[0m\]:\[\033[01;34m\]\w\[\033[0m\]]\$ '
# title
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\H:\w\a\]$PS1"
;;
*)
;;
esac
# enable colour support for ls and grep
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment