Skip to content

Instantly share code, notes, and snippets.

@eduardojmatos
Last active December 21, 2015 09:19
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 eduardojmatos/6284597 to your computer and use it in GitHub Desktop.
Save eduardojmatos/6284597 to your computer and use it in GitHub Desktop.
My bash_profile
# append to the history file, don't overwrite it
shopt -s histappend
#enbles color in the terminal bash shell export
CLICOLOR=1
#sets up the color scheme for list export
LSCOLORS=cxfxcxdxbxegedabagacad
c_cyan=`tput setaf 6`
c_red=`tput setaf 1`
c_green=`tput setaf 2`
c_sgr0=`tput sgr0`
export HISTIGNORE="ls:ll:cd:pwd"
export HISTFILESIZE=100000
export HISTSIZE=100000
export HISTCONTROL=ignoredups:erasedups
export HISTTIMEFORMAT="[$(tput setaf 6)%F %T$(tput sgr0)]: " # colorful date
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
parse_git_branch () {
if git rev-parse --git-dir >/dev/null 2>&1
then
gitver=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')
else
return 0
fi
echo -e "($gitver) "
}
branch_color ()
{
if git rev-parse --git-dir >/dev/null 2>&1
then
color=""
if git diff --quiet 2>/dev/null >&2
then
color="${c_green}"
else
color=${c_red}
fi
else
return 0
fi
echo -ne $color
}
RUBY_VERSION=''
RUBY_PROMPT=''
ruby_version ()
{
if [ -f Gemfile.lock ]; then
RUBY_VERSION=`ruby -e "puts RUBY_VERSION"`
RUBY_PROMPT='@ '['Ruby '${RUBY_VERSION}]
echo -ne $RUBY_PROMPT' '
fi
echo -ne ''
}
PS1='\[\033[1;34m\]$(ruby_version)\[\033[0;33m\]@\u\[\033[00m\] \[\033[1;36m\]\w\[\033[00m\] \[\[$(branch_color)\]$(parse_git_branch)\[${c_sgr0}\]\$ \n'
#sets up the prompt color (currently a green similar to linux terminal)
#export PS1='@ \h\[\033[00m\] \[\033[01;36m\]\w\[\033[00m\] `git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`\[\033[00m\]\$ \n'
#export PS1='@ \h\[\033[00m\] (\[\033[01;32m\]\u) \[\033[01;36m\]\w\[\033[00m\] \$ \n'
#enables color for iTerm
export TERM=xterm-color
#Grep colors
export GREP_OPTIONS="--color=always"
export GREP_COLORS="ms=01;31:mc=01;31:sl=:cx=:fn=32:ln=36:bn=32:se=39"
#jasmine browser definition
export JASMINE_BROWSER=chrome
# bundle editor
export BUNDLER_EDITOR="vim"
#case sensitive on file/folder names off
bind 'set completion-ignore-case On'
#sets up proper alias commands when called
# unix
alias ls='ls -laG'
alias ll='ls -la'
alias tree="find . ! -name ".DS_Store" -print | sed -e 's;[^/]*/;|__;g;s;__|; |;g'"
alias ..='cd ..'
alias lsd="ls -lF ${colorflag} | grep --color=never '^d'"
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias localip="ipconfig getifaddr en0"
alias localipw="ipconfig getifaddr en1"
alias reload="exec $SHELL -l"
# git
alias gk='gitk'
alias push="git push origin master"
alias pull="git pull origin master"
alias rebase="git rebase origin/master"
alias gs="git status"
alias gd="git diff"
# ruby / rails
alias bi="bundle install"
alias rs="rails server"
alias rbi="rake bower:install"
alias rbre="rake bower:resolve"
# vagrant
alias vssh="vagrant ssh"
alias vup="vagrant up"
alias vhalt="vagrant halt"
alias vs="vagrant status"
alias restart_vbox="sudo /Library/Application\ Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh restart"
#shortcuts
alias prj='cd $HOME/projects'
set PATH /usr/local/bin:$PATH
set MANPATH /usr/local/man
# for tunnels
export rvmsudo_secure_path=1
[ -s $HOME/.nvm/nvm.sh ] && . $HOME/.nvm/nvm.sh # This loads NVM
export PATH="$HOME/.azk/bin:$PATH"
eval "$(azk sh-init -)"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# Add tab completion for many Bash commands
if which brew > /dev/null && [ -f "$(brew --prefix)/etc/bash_completion" ]; then
source "$(brew --prefix)/etc/bash_completioncompletion";
elif [ -f /etc/bash_completion ]; then
source /etc/bash_completionompletion;
fi;
source ~/.profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment