Skip to content

Instantly share code, notes, and snippets.

@clooth
Created August 9, 2012 18:24
Show Gist options
  • Save clooth/3306789 to your computer and use it in GitHub Desktop.
Save clooth/3306789 to your computer and use it in GitHub Desktop.
My .bash_profile
# Colors
declare -A Colors
Colors[black]="\[\033[0;30m\]"
Colors[red]="\[\033[0;31m\]"
Colors[green]="\[\033[0;32m\]"
Colors[yellow]="\[\033[0;33m\]"
Colors[blue]="\[\033[0;34m\]"
Colors[magenta]="\[\033[0;35m\]"
Colors[cyan]="\[\033[0;36m\]"
Colors[white]="\[\033[0;37m\]"
declare -A BoldColors
BoldColors[black]="\[\033[1;30m\]"
BoldColors[red]="\[\033[1;31m\]"
BoldColors[green]="\[\033[1;32m\]"
BoldColors[yellow]="\[\033[1;33m\]"
BoldColors[blue]="\[\033[1;34m\]"
BoldColors[magenta]="\[\033[1;35m\]"
BoldColors[cyan]="\[\033[1;36m\]"
BoldColors[white]="\[\033[1;37m\]"
# Common
alias ll='ls -laG'
alias be='bundle exec'
# Git
alias gs='git status -s'
alias go='git checkout'
alias gadd='git add -p'
alias gi='git commit'
alias gd='git diff'
alias gb='git branch'
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias gg='git stash && git pull --rebase && git stash pop'
# Django
alias dmin='django-admin.py'
alias dman='python manage.py'
alias dsrv='python manage.py runserver'
alias dtest='python manage.py test'
alias ddb='python manage.py syncdb'
alias venv='. env/bin/activate'
# Languages
export LC_ALL=fi_FI.UTF-8
export LANG=fi_FI.UTF-8
# Paths
export PATH=/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:$PATH
export PATH=$HOME/local/node/bin:$PATH
# bash-completion for git
if [ -f `brew --prefix`/etc/bash_completion.d/git-completion.bash ]; then
. `brew --prefix`/etc/bash_completion.d/git-completion.bash
fi
# RVM Prompt
function __rvm_prompt {
if hash rvm-prompt 2>&- ; then
rvm-prompt i v g s
else
echo "no-rvm"
fi
}
# GIT Prompt
function __git_prompt {
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWUNTRACKEDFILES=1
__git_ps1 " %s" | sed 's/ \([+*]\{1,\}\)$/\1/'
}
# Only show username@server over SSH.
function __name_and_server {
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
echo "`whoami`@`hostname -s` "
fi
}
bash_prompt() {
PS1="${BoldColors[black]}[${BoldColors[yellow]}\$(__name_and_server)${Colors[yellow]}\W/${Colors[green]}\$(__git_prompt)${BoldColors[black]}] ${BoldColors[yellow]}\076${Colors[white]} "
}
bash_prompt
unset bash_prompt
# This loads RVM into a shell session.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment