Skip to content

Instantly share code, notes, and snippets.

@lajlev
Created November 15, 2012 10:00
Show Gist options
  • Save lajlev/4077777 to your computer and use it in GitHub Desktop.
Save lajlev/4077777 to your computer and use it in GitHub Desktop.
My .bash_profile pimped with coloring, intelligent path, alias for git etc
PATH="/usr:bin:/usr/local/bin:/usr/local/sbin:$PATH" # if not already present
export PATH=/usr/local/bin/psql:$PATH
PROMPT_COMMAND='DIR=`pwd|sed -e "s!$HOME!~!"`; if [ ${#DIR} -gt 20 ]; then CurDir=${DIR:0:5}...${DIR:${#DIR}-15}; else CurDir=$DIR; fi'
#PS1="[\$CurDir] \$ "
function color_my_prompt {
local __user_and_host="\[\033[01;32m\]\u@\h"
local __cur_location="\[\033[01;34m\]\w"
local __git_branch_color="\[\033[31m\]"
#local __git_branch="\`ruby -e \"print (%x{git branch 2> /dev/null}.grep(/^\*/).first || '').gsub(/^\* (.+)$/, '(\1) ')\"\`"
local __git_branch='`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`'
local __prompt_tail="\[\033[35m\]$"
local __last_color="\[\033[00m\]"
export PS1="[\$CurDir] $__git_branch_color$__git_branch$__prompt_tail$__last_color "
}
color_my_prompt
# open a new tab on Terminal with the current working dir
function newtab {
osascript -e "
tell application \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down
tell application \"Terminal\" to do script \"cd \\\"$(PWD)\\\"\" in selected tab of the front window
" > /dev/null 2>&1
}
alias chrome="open /Applications/Google\ Chrome.app/"
alias proto="cd /Users/lajlev/Sites/trustpilot/prototype"
alias hide="chflags hidden"
alias show="chflags nohidden"
# List all files
alias l="ls -la -G"
alias ls="ls -G"
alias path='pwd'
alias rm='rm -rf'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias gs='git status'
alias ga='git add .'
alias gc='git commit'
alias gco='git checkout'
alias gpl='git pull'
alias gph='git push'
alias gl='git log'
alias glp='git log --pretty=format:"%h - %an, %ar : %s"'
alias glg='git log --pretty=format:"%h %s" --graph'
#Colors
export CLICOLOR=1
export LSCOLORS='Bxgxfxfxcxdxdxhbadbxbx'
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
@switchflip
Copy link

I really enjoy what you've done here : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment