Created
June 8, 2009 07:20
-
-
Save catalanska/125686 to your computer and use it in GitHub Desktop.
This file contains 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 MANPATH=/opt/local/share/man:$MANPATH | |
export LC_CTYPE=en_US.UTF-8 | |
export PATH=/opt/local/bin/:/Applications/MAMP/Library/bin:$PATH | |
export JAVA_HOME=/Library/Java/Home | |
export PATH=$PATH:$EC2_HOME/bin | |
# Editors | |
export EDITOR='mate -w' | |
export SVN_EDITOR='mate -w' | |
export GIT_EDITOR='mate -w' | |
##### ALIASES ################################################################ | |
alias h=history | |
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 ." # 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|pbcopy" # For sending paths by email... | |
##### SERVER ################################################################# | |
alias console="script/console" | |
alias server="script/server" | |
##### GIT #################################################################### | |
alias pabajo="git pull origin" | |
alias parriba="git push origin" | |
alias status="git status" | |
alias gc="git commit -a -v" | |
alias gif="git diff" | |
alias ga="git add" | |
alias gs="git status -uno" # Display only tracked files | |
alias gb="git checkout" | |
alias g="git" | |
alias nueva="rails $1 -m http://gist.github.com/56786ac763c34bd74ee1.txt" | |
alias slices="curl http://gist.github.com/08e80a20d136ec3dc09e.txt" | |
# 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 | |
# Git | |
##### 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" | |
} | |
# Use Changes.app for git diffs (nice when diffing single files and folders) | |
function giff | |
{ | |
export GIT_EXTERNAL_DIFF="$HOME/bin/gitdiff" | |
git diff "$1" | |
unset GIT_EXTERNAL_DIFF | |
} | |
# 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 \*/._*; | |
} | |
git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /' | |
} | |
export PS1="\u@\h:\w \$(git_branch)$ " | |
##### EXEC ################################################################### | |
# MacPorts bash_completion | |
if [ -f /opt/local/etc/bash_completion ]; then | |
. /opt/local/etc/bash_completion | |
elif [ -f $HOME/bin/git-completion.bash ]; then | |
# Alternatively, load Git completion stuff from git-completion | |
# http://repo.or.cz/w/git.git?a=blob;f=contrib/completion/git-completion.bash | |
source bin/git-completion.bash | |
fi | |
# to stop Finder writing .DS_Store files on network volumes | |
defaults write com.apple.desktopservices DSDontWriteNetworkStores true | |
##### DIRTY GIT STATE ################################################################# | |
function parse_git_dirty { | |
git diff --quiet HEAD &>/dev/null | |
[[ $? == 1 ]] && echo "⚡" | |
} | |
git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/(\1) $(parse_git_dirty)/" | |
} | |
export PS1=" | |
$(git_branch) | |
$ " | |
##### 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_branch) | |
$ " | |
} | |
prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment