Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
My Bash Profile
export USER="tomas-stefano"
# Colours
export BLUE="\[\033[0;34m\]"
export NO_COLOR="\[\e[0m\]"
export GRAY="\[\033[1;30m\]"
export GREEN="\[\033[0;32m\]"
export LIGHT_GRAY="\[\033[0;37m\]"
export LIGHT_GREEN="\[\033[1;32m\]"
export LIGHT_RED="\[\033[1;31m\]"
export RED="\[\033[0;31m\]"
export WHITE="\[\033[1;37m\]"
export YELLOW="\[\033[0;33m\]"
# ls and grep colorize
export GREP_OPTIONS="--color=auto"
export GREP_COLOR="4;33"
export CLICOLOR="auto"
export GEM_EDITOR="mate"
alias ls='ls -G'
alias textmate_rails="mate app config db features lib public spec Tasks"
alias cd_gems="cd ~/Codigos/Ruby/gems/"
alias cd_libs="cd ~/Codigos/C/"
alias mysqlraw="mysql -u tdestefi -p -h 69.46.19.48 raw"
alias server_infoplex="ssh -v tdestefi@69.46.19.62"
alias jsonget="curl -X GET -H 'Accept: application/json'"
alias databases_mate="mate ~/Codigos/C/mongo ~/Codigos/C/couchdb ~/Codigos/C/DruidDB ~/Codigos/C/redis-2.0.3"
alias start_redis="redis-server /usr/local/etc/redis.conf"
alias read_ruby_source_code="mate ~/.rvm/src/ruby-1.9.2-p0/"
alias gem_uninstall_all="gem list | cut -d\" \" -f1 | fgrep -v bundler | fgrep -v rake | fgrep -v rdoc | xargs gem uninstall -aIx"
# Projetos
alias infoplex_prepare='cd ~/Projetos/Infoplex && clear'
alias rubycasts="cd ~/Projetos/rubycasts && ls"
alias reblog="cd ~/Projetos/reblog && ls"
# Set window title
title() {
echo -ne "\033]0;$@\007";
}
# list directory after cd; also save the last directory
# and open it when a new tab is created.
cd() {
builtin cd "${@:-$HOME}" && ls && pwd > $CDHISTORY;
if [ -f .rvmrc ]; then
__rvm_project_rvmrc
fi
}
github() {
if [ $# = 1 ]; then
git clone git@github.com:$USER/$1.git;
builtin cd $1 && ls;
elif [ $# = 2 ]; then
git clone git://github.com/$1/$2.git;
builtin cd $2 && ls;
else
echo "Usage:";
echo " github <repo> ~> will clone $USER's <repo>";
echo " github <user> <repo> ~> will clone <user>'s <repo>";
fi
}
custom_prompt () {
local BRANCH=`git branch 2> /dev/null | grep \* | sed 's/* //'`
if [[ "$BRANCH" = "" ]]; then
BRANCH=`git status 2> /dev/null | grep "On branch" | sed 's/# On branch //'`
fi
local RUBY_VERSION=`ruby -e "puts RUBY_VERSION"`
local GEMSET_NAME=`rvm gemset name`
local RUBY_PROMPT=""
local STATUS=`git status 2>/dev/null`
local PROMPT_COLOR=$GREEN
local STATE=" "
local NOTHING_TO_COMMIT="# Initial commit"
local BEHIND="# Your branch is behind"
local AHEAD="# Your branch is ahead"
local UNTRACKED="# Untracked files"
local DIVERGED="have diverged"
local CHANGED="# Changed but not updated"
local TO_BE_COMMITED="# Changes to be committed"
local LOG=`git log -1 2> /dev/null`
if [[ "$GEMSET_NAME" != "" ]]; then
RUBY_PROMPT="${RED}(ruby-${RUBY_VERSION}@${GEMSET_NAME})${NO_COLOR} "
else
RUBY_PROMPT="${RED}(ruby-${RUBY_VERSION})${NO_COLOR} "
fi
if [ "$STATUS" != "" ]; then
if [[ "$STATUS" =~ "$NOTHING_TO_COMMIT" ]]; then
PROMPT_COLOR=$RED
STATE=""
elif [[ "$STATUS" =~ "$DIVERGED" ]]; then
PROMPT_COLOR=$RED
STATE="${STATE}${RED}${NO_COLOR}"
elif [[ "$STATUS" =~ "$BEHIND" ]]; then
PROMPT_COLOR=$RED
STATE="${STATE}${RED}${NO_COLOR}"
elif [[ "$STATUS" =~ "$AHEAD" ]]; then
PROMPT_COLOR=$RED
STATE="${STATE}${RED}${NO_COLOR}"
elif [[ "$STATUS" =~ "$CHANGED" ]]; then
PROMPT_COLOR=$RED
STATE=""
elif [[ "$STATUS" =~ "$TO_BE_COMMITED" ]]; then
PROMPT_COLOR=$RED
STATE=""
else
PROMPT_COLOR=$GREEN
STATE=""
fi
if [[ "$STATUS" =~ "$UNTRACKED" ]]; then
STATE="${STATE}${YELLOW}*${NO_COLOR}"
fi
PS1="${RUBY_PROMPT}${YELLOW}\w\a${NO_COLOR} (${PROMPT_COLOR}${BRANCH}${NO_COLOR}${STATE}${NO_COLOR})\n⤷ "
else
PS1="${RUBY_PROMPT}${YELLOW}\w\a${NO_COLOR}\n⤷ "
fi
}
source ~/.git_completion.sh
#PS1='\n[\u] \[\033[1;33m\]\w\a\[\033[0m\]$(__git_ps1 "
# \[\033[1;32m\](%s)\[\033[0m\]")\n\$ '
#export PS1='\[\033[38m\]\u\[\033[32m\] \w \[\033[1;33m\]`~/.rvm/bin/rvm-prompt i v
#`\[\033[0;31m\] `git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\
#\(.+\)$/\(\\\\\1\)\ /
#`\[\033[37m\]$\[\033[00m\] '
PROMPT_COMMAND=custom_prompt
# export PS1="\033[32m\]\w \[\033[1;33m\]\$(rvm_version)\[\033[0;31m\]\$(parse_git_branch)
# \033[0m "
#PS1='\n[\u] \[\033[1;34m\]\w\a\[\033[0m\]$(__git_ps1 "
# \[\033[1;32m\](%s)\[\033[0m\]")\n\$ '
# rvm-install added:
if [[ -s /Users/tomas/.rvm/scripts/rvm ]] ; then source /Users/tomas/.rvm/scripts/rvm ; fi
source ~/.profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.