Skip to content

Instantly share code, notes, and snippets.

@erikh
Created June 10, 2012 19:06
Show Gist options
  • Save erikh/31f254a8acb3669b96c6 to your computer and use it in GitHub Desktop.
Save erikh/31f254a8acb3669b96c6 to your computer and use it in GitHub Desktop.
case $TERM in
linux)
;;
*)
export RPROMPT="[%T]"
precmd() {
if [ "x$rvm_env_string" != "x" ]
then
export RPROMPT="[r: $rvm_env_string][%T]"
elif [ "x$rvm_ruby_string" != "x" ]
then
export RPROMPT="[r: $rvm_ruby_string][%T]"
elif [ -x $HOME/bin/rbfu ]
then
export RPROMPT="[r: ${RBFU_ENV}][%T]"
fi
case $TERM in
screen)
print -Pn "\ek$PROMPT\e\\"
;;
vt100)
;;
*)
print -Pn "\e]0;$PROMPT\e\\"
;;
esac
}
preexec() {
case $TERM in
screen)
print -Pn "\ek$1\e\\"
;;
vt100)
;;
*)
print -Pn "\e]0;$1\e\\"
;;
esac
}
;;
esac
# https://github.com/hmans/rbfu
DEFAULT_RUBY=1.9.3-p194
re() {
if [ "x$1" != "x" ]
then
source ${HOME}/bin/rbfu @$1
RBFU_ENV=$1
fi
}
rl() {
for i in ${HOME}/.rbfu/rubies/*
do
echo $(basename $i)
done
}
rb_build() {
ruby-build $1 ${HOME}/.rbfu/rubies/$1
rbfu @$1 gem install bundler
}
rb_remove() {
if [ "x$1" = "x" ]
then
echo "Please supply an argument"
else
rm -r ${HOME}/.rbfu/rubies/$1
fi
}
if [[ -x ${HOME}/bin/rbfu ]]
then
eval "$(rbfu --init)"
if [ -d ${HOME}/.rbfu/rubies/${DEFAULT_RUBY} ]
then
source ${HOME}/bin/rbfu @${DEFAULT_RUBY}
RBFU_ENV=${DEFAULT_RUBY}
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment