Created
August 2, 2010 21:43
-
-
Save careo/505372 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
############################################################################### | |
## Set PATH type things | |
############################################################################### | |
# Platform specific path settings | |
case $OSTYPE in | |
darwin*) | |
# export JAVA_HOME=/Library/Java/Home | |
;; | |
esac | |
export PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin # standard system locations | |
export PATH=:/usr/local/bin:$PATH # misc other local stuff | |
export PATH=:/usr/local/sbin:$PATH # misc other local stuff | |
export PATH=~/bin:$PATH # pull in my own bin before a lot of those others | |
export MANPATH=~/share/man:$MANPATH | |
export MANPATH=$MANPATH:/usr/local/man | |
# Catch any desired overrides | |
export PATH=$PATHOVERRIDES:$PATH | |
############################################################################### | |
## Set Aliases and Functions | |
############################################################################### | |
function ls { command ls -AFGh "$@"; } | |
# 'command ls' to prevent loop; -A for .file, -F for dir/ link@, | |
# -G is for color | |
function l { ls -l "$@"; } # -l to list in long format... | |
function ll { l "$@" | less ; } # pipe into 'less' | |
# Get pretty tree output by default | |
function tree { command tree -A "$@"; } | |
# less sucks for me for some reason | |
function less { command less -X "$@"; } | |
# in case the current dir was removed out from under me | |
function hop { cd ; cd -} | |
alias ..='cd ..;l' | |
alias cd..='cd ..' | |
alias rehash='. ~/.zshrc;' # source ~/.zshrc after I edit it | |
alias mv='nocorrect mv' # no spelling correction on mv | |
alias cp='nocorrect cp' # no spelling correction on cp | |
alias mkdir='nocorrect mkdir' # no spelling correction on mkdir | |
# List only directories and symbolic | |
# links that point to directories | |
alias lsd='ls -ld *(-/DN)' | |
## Git Specific | |
alias gst='git status' | |
alias gl='git log' | |
alias gd='git diff | mate' | |
alias gc='git commit -v' | |
alias gca='git commit -v -a' | |
alias gb='git branch' | |
alias gba='git branch -a' | |
alias gm='git checkout master' | |
alias gsr='git svn rebase' | |
alias gr='git rebase' | |
alias grm='git rebase master' | |
alias gco='git checkout' | |
alias gp='git pull' | |
alias gf='git fetch' | |
alias gsu='git submodule update' | |
############################################################################### | |
## Misc | |
############################################################################### | |
# Needed to keep TextMate bundle svn updating happy | |
export LC_CTYPE=en_US.UTF-8 | |
# Set color codes for ls -G | |
export LSCOLORS=fxfxcxdxbxegedabagacad | |
# default except for the first character (f) - magenta for directories | |
# the standard blue blended into the black of my terminal too much | |
# I am TextMate's bitch, after that... nano | |
if which mate > /dev/null; then | |
export EDITOR="/usr/bin/mate -w" | |
else | |
export EDITOR="nano" | |
fi | |
# less is more. depending on my mood. | |
# note: The -X keeps the output on screen when less quits. handy. | |
# but be sure to set that -X in the LESS env var, lest we confuse | |
# some poor souls (ie, rvm) | |
export PAGER="less" | |
export MANPAGER="less" | |
export LESS="-X" | |
# automatically remove duplicates from these arrays | |
typeset -U path cdpath fpath manpath | |
# Set term type | |
export TERM=xterm-color | |
############################################################################### | |
## History settings. See http://zsh.sunsite.dk/Guide/zshguide02.html | |
############################################################################### | |
HISTSIZE=10000000 | |
SAVEHIST=10000000 | |
HISTFILE=~/.history | |
setopt append_history | |
setopt inc_append_history | |
#setopt extended_history | |
setopt hist_ignore_dups | |
setopt hist_ignore_all_dups | |
setopt hist_expire_dups_first | |
# Disabled because it's just fucking annoying | |
#setopt share_history | |
############################################################################### | |
### `Go faster' options for power users. | |
### See http://zsh.sunsite.dk/Guide/zshguide02.html | |
############################################################################### | |
setopt no_beep | |
setopt auto_cd | |
# Make cd push the old directory onto the directory stack. | |
setopt auto_pushd | |
setopt pushd_ignore_dups | |
# Disabled because it's just fucking annoying | |
#setopt correct | |
############################################################################### | |
## ZLE settings. See zshle(1) | |
############################################################################### | |
# use emacs-style | |
bindkey -e | |
############################################################################### | |
## Completion | |
############################################################################### | |
# Setup new style completion system. To see examples of the old style (compctl | |
# based) programmable completion, check Misc/compctl-examples in the zsh | |
# distribution. | |
autoload -U compinit | |
compinit | |
############################################################################### | |
# Search for .rvm | |
############################################################################### | |
findrvm () { | |
if [[ -f "$1/.rvm" ]]; then | |
if [[ -z "$rvm_gem_set_name" ]] ; then | |
current_rvm_ruby="$rvm_ruby_string" | |
else | |
current_rvm_ruby="${rvm_ruby_string}%${rvm_gem_set_name}" | |
fi | |
dot_rvm=`cat $1/.rvm` | |
if [[ dot_rvm != current_rvm_ruby ]]; then #cat $1/.rvm | |
rvm `cat $1/.rvm` | |
fi | |
return | |
elif [[ $1 = / ]]; then | |
return | |
fi | |
current=`dirname $1` | |
findrvm $current | |
} | |
############################################################################### | |
## Set the prompt | |
## (stolen from: http://www.aperiodic.net/phil/prompt/) | |
############################################################################### | |
function precmd { | |
if which rvm > /dev/null; then | |
findrvm $PWD | |
fi | |
local TERMWIDTH | |
(( TERMWIDTH = ${COLUMNS} - 1 )) | |
### | |
# Truncate the path if it's too long. | |
PR_FILLBAR="" | |
PR_PWDLEN="" | |
local promptsize=${#${(%):---(%n@%m:%l)---()--}} | |
local pwdsize=${#${(%):-%~}} | |
if [[ "$promptsize + $pwdsize" -gt $TERMWIDTH ]]; then | |
((PR_PWDLEN=$TERMWIDTH - $promptsize)) | |
else | |
PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $pwdsize)))..${PR_HBAR}.)}" | |
fi | |
### | |
# Get Git info. | |
PR_GIT_BRANCH=$( git symbolic-ref HEAD 2>/dev/null| cut -d/ -f3,4,5,6 ) | |
## | |
# Current ruby from rvm | |
#PR_RVM_RUBY=$(~/.rvm/bin/rvm-prompt) | |
} | |
setopt extended_glob | |
preexec () { | |
} | |
setprompt () { | |
### | |
# Need this so the prompt will work. | |
setopt prompt_subst | |
### | |
# See if we can use colors. | |
autoload colors zsh/terminfo | |
if [[ "$terminfo[colors]" -ge 8 ]]; then | |
colors | |
fi | |
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do | |
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' | |
eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' | |
(( count = $count + 1 )) | |
done | |
PR_NO_COLOUR="%{$terminfo[sgr0]%}" | |
### | |
# See if we can use extended characters to look nicer. | |
typeset -A altchar | |
set -A altchar ${(s..)terminfo[acsc]} | |
PR_SET_CHARSET="%{$terminfo[enacs]%}" | |
PR_SHIFT_IN="%{$terminfo[smacs]%}" | |
PR_SHIFT_OUT="%{$terminfo[rmacs]%}" | |
PR_HBAR=${altchar[q]:--} | |
PR_ULCORNER=${altchar[l]:--} | |
PR_LLCORNER=${altchar[m]:--} | |
PR_LRCORNER=${altchar[j]:--} | |
PR_URCORNER=${altchar[k]:--} | |
### | |
# Decide if we need to set titlebar text. | |
case $TERM in | |
xterm*) | |
PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}' | |
;; | |
*) | |
PR_TITLEBAR='' | |
;; | |
esac | |
### | |
# set the git branch | |
PR_GIT='$PR_RED${PR_GIT_BRANCH[(w)5,(w)6]/\% /%%}$PR_LIGHT_BLUE:' | |
### | |
# set the rvm ruby | |
#PR_RVM='$PR_RED${PR_RVM_RUBY[(w)5,(w)6]/\% /%%}$PR_LIGHT_BLUE:' | |
### | |
# Finally, the prompt. | |
PROMPT='$PR_SET_CHARSET${(e)PR_TITLEBAR}\ | |
$PR_CYAN$PR_SHIFT_IN$PR_ULCORNER$PR_BLUE$PR_HBAR$PR_SHIFT_OUT(\ | |
$PR_GREEN%(!.%SROOT%s.%n)$PR_GREEN@%m:%l\ | |
$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_CYAN$PR_HBAR${(e)PR_FILLBAR}$PR_BLUE$PR_HBAR$PR_SHIFT_OUT(\ | |
$PR_MAGENTA%$PR_PWDLEN<...<%~%<<\ | |
$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_CYAN$PR_URCORNER$PR_SHIFT_OUT\ | |
$PR_CYAN$PR_SHIFT_IN$PR_LLCORNER$PR_BLUE$PR_HBAR$PR_SHIFT_OUT(\ | |
%(?..$PR_LIGHT_RED%?$PR_BLUE:)\ | |
${(e)PR_GIT}$PR_YELLOW%D{%H:%M}\ | |
$PR_LIGHT_BLUE:%(!.$PR_RED.$PR_WHITE)%#$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\ | |
$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\ | |
$PR_NO_COLOUR ' | |
RPROMPT=' $PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_BLUE$PR_HBAR$PR_SHIFT_OUT\ | |
($PR_YELLOW%D{%a,%b%d}$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_CYAN$PR_LRCORNER$PR_SHIFT_OUT$PR_NO_COLOUR' | |
PS2='$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\ | |
$PR_BLUE$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT(\ | |
$PR_LIGHT_GREEN%_$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\ | |
$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR ' | |
} | |
setprompt | |
if [[ -s ~/.rvm/scripts/rvm ]] ; then source ~/.rvm/scripts/rvm ; fi | |
# rvm-install added line: | |
if [[ -s /Users/djensen/.rvm/scripts/rvm ]] && [[ $rvm_loaded_flag != 1 ]] ; then source /Users/djensen/.rvm/scripts/rvm ; fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment