Created
August 28, 2008 09:34
-
-
Save bomberstudios/7691 to your computer and use it in GitHub Desktop.
My .bash_profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### EXPORTS ################################################################ | |
export PATH=/opt/local/bin:/opt/local/sbin:$HOME/bin:$PATH | |
export LC_CTYPE=en_US.UTF-8 | |
# Editors | |
export EDITOR='mate -w' | |
export SVN_EDITOR='mate -w' | |
export GIT_EDITOR='mate -w' | |
# for Editor Kicker: http://editorkicker.rubyforge.org/ | |
export EDITOR_KICKER="mate -l %s '%s'" | |
##### ALIASES ################################################################ | |
alias ..="cd .." # Because I am *lazy* | |
alias la="ls -Glap" # Nice listings | |
alias pa="ps ax -r -m -c" # Show running processes, sorted by CPU and Memory usage | |
alias m="mate ." # Open current folder in TextMate | |
alias o="open . -a Finder.app" # Open current folder in Finder | |
alias dsrm="find . -type f -name .DS_Store -print0 | xargs -0 rm" # Removes all .DS_Store file from the current dir and below | |
alias pathcopy="pwd | __CF_USER_TEXT_ENCODING=$UID:0x8000100:0x8000100 pbcopy" # For sending paths by email... | |
alias fw="open -a 'Adobe Fireworks CS3'" # Just because | |
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" | |
alias mb='mate ~/.bash_profile ~/.inputrc ~/.irbrc ~/.gitignore' | |
# Misc Subversion aliases | |
alias st="svn st" | |
alias 7up="svn up" | |
alias svnclean="find . -name .svn -exec rm -rf {} \;" | |
# from Allan Odgaard | |
export HISTCONTROL=erasedups | |
export HISTSIZE=10000 | |
declare -x HISTIGNORE='??:h:git' | |
shopt -s histappend | |
alias h=history | |
# Git | |
alias gc="git commit -a -v" | |
alias gci="git ci" | |
alias gco="git co" | |
alias ga="git add" | |
alias gs="git status -uno" # Display only tracked files | |
alias gb="git checkout -b" | |
alias g="git" | |
alias gl="git log --pretty=oneline" | |
function gittar { | |
local name=$(pwd) | |
name=${name##*/} | |
if [ ! "$1" ]; then | |
echo "[ERROR] what branch to export?" | |
return 1 | |
fi | |
local date=$(TZ=UTC date '+%Y%m%d.%H%M') | |
local pkg="$name-$date" | |
local dir=".." | |
local tar="$dir/$pkg.tar.gz" | |
git archive --format=tar --prefix="$pkg/" "$@" | gzip --best > "$tar" | |
echo $tar | |
} | |
# Use Changes.app for git diffs (nice when diffing single files and folders) | |
function gitdiff { | |
[ $# -eq 7 ] && /usr/bin/env chdiff --wait "$2" "$5" | |
} | |
function giff { | |
export GIT_EXTERNAL_DIFF="gitdiff" | |
git diff "$1" | |
export -n GIT_EXTERNAL_DIFF | |
} | |
# Flash debug | |
alias flashlog="tail -f $HOME/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt" | |
# disable and re-enable Dashboard Widgets | |
alias disableDashboard='defaults write com.apple.dashboard mcx-disabled -bool YES; killall Dock' | |
alias enableDashboard='defaults delete com.apple.dashboard mcx-disabled; killAll Dock' | |
# to stop Finder writing .DS_Store files on network volumes | |
defaults write com.apple.desktopservices DSDontWriteNetworkStores true | |
##### FUNCTIONS ############################################################## | |
# cd to the Finder's frontmost window's path | |
function cdf { | |
currFolderPath=$(osascript <<"EOT" | |
tell application "Finder" | |
try | |
set currFolder to (folder of the front window as alias) | |
on error | |
set currFolder to (path to desktop folder as alias) | |
end try | |
POSIX path of currFolder | |
end tell | |
EOT | |
) | |
cd "$currFolderPath" | |
} | |
# zipf: to create a ZIP archive of a folder without OSX cruft and Subversion folders | |
function zipf { | |
zip -r "$1".zip "$1" -x \*/*.svn/* -x \*/.DS_Store -x \*/._*; | |
} | |
##### EXEC ################################################################### | |
# MacPorts bash_completion | |
# Load Git completion stuff from git-completion | |
# http://repo.or.cz/w/git.git?a=blob_plain;f=contrib/completion/git-completion.bash | |
source bin/git-completion.bash | |
export GIT_PS1_SHOWDIRTYSTATE='true' | |
# completion support for the github gem | |
complete -o default -o nospace -F _git gh | |
##### COLORS ################################################################# | |
# CLI & Prompt colors | |
export CLICOLOR=true | |
# a black | |
# b red | |
# c green | |
# d brown | |
# e blue | |
# f magenta | |
# g cyan | |
# h light grey | |
# A bold black, usually shows up as dark grey | |
# B bold red | |
# C bold green | |
# D bold brown, usually shows up as yellow | |
# E bold blue | |
# F bold magenta | |
# G bold cyan | |
# H bold light grey; looks like bright white | |
# x default foreground or background | |
# Order: dir - symlink - socket - pipe - exec - block special - char special - exec setuid - exec setgid - public dir sticky bit - public dir no sticky bit | |
export LSCOLORS='Dxfxcxdxbxegedabagacad' | |
# 30m - Black | |
# 31m - Red | |
# 32m - Green | |
# 33m - Yellow | |
# 34m - Blue | |
# 35m - Purple | |
# 36m - Cyan | |
# 37m - White | |
# Everything else is green... | |
# 0 - Normal | |
# 1 - Bold | |
# 2 - | |
function prompt { | |
local BLACK="\[\033[0;30m\]" | |
local RED="\[\033[0;31m\]" | |
local GREEN="\[\033[0;32m\]" | |
local YELLOW="\[\033[0;33m\]" | |
local BLUE="\[\033[0;34m\]" | |
local PURPLE="\[\033[0;35m\]" | |
local CYAN="\[\033[0;36m\]" | |
local WHITE="\[\033[0;37m\]" | |
local WHITEBOLD="\[\033[1;37m\]" | |
export PS1=" | |
${WHITE}\u${RED}@${PURPLE}\h ${CYAN}\w${YELLOW} \$(__git_ps1 ' (%s)') | |
$ " | |
} | |
prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment