Diff
1diff --git a/README.textile b/README.textile
2new file mode 100644
3index 0000000000000000000000000000000000000000..740070d8cf53d14d5ae35f5a1041a12507e7e757
4--- /dev/null
5+++ b/README.textile
6@@ -0,0 +1,8 @@
7+h2. Setup
8+
9+# Clone the repository to ~/zsh
10+# Symlink the zsh config with: @ln -s ~/zsh/zshrc .zshrc@
11+# Reload zsh (open a new terminal)
12+
13+
14+
15diff --git a/aliases.zsh b/aliases.zsh
16new file mode 100644
17index 0000000000000000000000000000000000000000..2319823f14495925b1b457061f37a318189f46e3
18--- /dev/null
19+++ b/aliases.zsh
20@@ -0,0 +1,44 @@
21+alias c='cd'
22+alias pu='pushd'
23+alias po='popd'
24+alias sc='ruby script/console'
25+alias ss='ruby script/server'
26+
27+alias mr='mate CHANGELOG app config db lib public script spec test'
28+alias .='pwd'
29+alias ...='cd ../..'
30+alias ....='cd ../../..'
31+alias .....='cd ../../../..'
32+alias ......='cd ../../../../..'
33+alias .......='cd ../../../../../..'
34+
35+alias _='sudo'
36+alias ss='setsid'
37+
38+alias g='grep -in'
39+
40+alias s='svn'
41+alias e='mate'
42+
43+alias history='fc -l 1'
44+
45+# Git aliases
46+
47+alias utb='tar jxvf'
48+alias utz='tar zxvf'
49+
50+alias ls='ls -GF'
51+alias ll='ls -al'
52+
53+alias sgem='sudo gem'
54+
55+alias rfind='find . -name *.rb | xargs grep -n'
56+
57+alias xenon='ssh rrussell@xenon.planetargon.com'
58+
59+alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
60+
61+bindkey '\ew' kill-region
62+
63+bindkey -s '\el' "ls\n"
64+bindkey -s '\e.' "..\n"
65diff --git a/colors.zsh b/colors.zsh
66new file mode 100644
67index 0000000000000000000000000000000000000000..b2b08f929e0a42f9784e35533389a432e333e425
68--- /dev/null
69+++ b/colors.zsh
70@@ -0,0 +1,4 @@
71+autoload colors; colors;
72+
73+unset LSCOLORS
74+export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
75diff --git a/completion.zsh b/completion.zsh
76new file mode 100644
77index 0000000000000000000000000000000000000000..e0edc763f32971ec4d4a68de7d9f97c4429a32ab
78--- /dev/null
79+++ b/completion.zsh
80@@ -0,0 +1,27 @@
81+setopt noautomenu
82+setopt COMPLETE_IN_WORD
83+setopt ALWAYS_TO_END
84+
85+unsetopt flowcontrol
86+
87+WORDCHARS=''
88+
89+autoload -U compinit
90+compinit
91+
92+zmodload -i zsh/complist
93+
94+zstyle ':completion:*' list-colors ''
95+zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts )
96+
97+unsetopt MENU_COMPLETE
98+setopt AUTO_MENU
99+
100+bindkey -M menuselect '^o' accept-and-infer-next-history
101+
102+zstyle ':completion:*:*:*:*:*' menu yes select
103+# zstyle ':completion:*:*:*:*:processes' force-list always
104+
105+zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
106+zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
107+zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts`
108diff --git a/functions.zsh b/functions.zsh
109new file mode 100644
110index 0000000000000000000000000000000000000000..5c349e80ccc9ac1485db38aa5f4e5c4bf222587f
111--- /dev/null
112+++ b/functions.zsh
113@@ -0,0 +1,26 @@
114+function title {
115+ if [[ $TERM == "screen" ]]; then
116+ # Use these two for GNU Screen:
117+ print -nR $'\033k'$1$'\033'\\\
118+
119+ print -nR $'\033]0;'$2$'\a'
120+ elif [[ $TERM == "xterm" || $TERM == "rxvt" ]]; then
121+ # Use this one instead for XTerms:
122+ print -nR $'\033]0;'$*$'\a'
123+ fi
124+}
125+
126+function precmd {
127+ title zsh "$PWD"
128+}
129+
130+function preexec {
131+ emulate -L zsh
132+ local -a cmd; cmd=(${(z)1})
133+ title $cmd[1]:t "$cmd[2,-1]"
134+}
135+
136+
137+function remote_console() {
138+ /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )"
139+}
140diff --git a/git.zsh b/git.zsh
141new file mode 100644
142index 0000000000000000000000000000000000000000..94409633234ad4457e00e4526a8afd0e59b11199
143--- /dev/null
144+++ b/git.zsh
145@@ -0,0 +1,19 @@
146+# get the name of the branch we are on
147+function git_prompt_info() {
148+ ref=$(git symbolic-ref HEAD 2> /dev/null) || return
149+ branch=${ref#refs/heads/}
150+
151+ if [[ -d .git ]]; then
152+ CURRENT_BRANCH="%{$fg[red]%}git:(%{$fg[green]${branch}%{$fg[red])"
153+ else
154+ CURRENT_BRANCH=''
155+ fi
156+
157+
158+ #echo "%{$fg[red]%}git:(%{$fg[green]$CURRENT_BRANCH%{$fg[red])"
159+ echo $CURRENT_BRANCH
160+}
161+
162+parse_git_dirty () {
163+ [[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "%{$fg[white] ♻ "
164+}
165diff --git a/grep.zsh b/grep.zsh
166new file mode 100644
167index 0000000000000000000000000000000000000000..93c4270b60c808e2f59ad925b1ea657bb2cdf50c
168--- /dev/null
169+++ b/grep.zsh
170@@ -0,0 +1,6 @@
171+#
172+# Color grep results
173+# Examples: http://rubyurl.com/ZXv
174+#
175+export GREP_OPTIONS='--color=auto'
176+export GREP_COLOR='1;32'
177diff --git a/history.zsh b/history.zsh
178new file mode 100644
179index 0000000000000000000000000000000000000000..a093aa27ca585997623da94fead144a90236da7a
180--- /dev/null
181+++ b/history.zsh
182@@ -0,0 +1,15 @@
183+# History stuff.
184+setopt HIST_VERIFY
185+setopt INC_APPEND_HISTORY
186+setopt SHARE_HISTORY
187+setopt EXTENDED_HISTORY
188+setopt HIST_IGNORE_DUPS
189+
190+## Command history configuration
191+#
192+HISTFILE=$ZSH/log/.zsh_history
193+HISTSIZE=2500
194+SAVEHIST=2500
195+setopt hist_ignore_dups # ignore duplication command history list
196+setopt share_history # share command history data
197+
198diff --git a/projects.zsh-example b/projects.zsh-example
199new file mode 100644
200index 0000000000000000000000000000000000000000..28ffcae2507428e8b5067e7b02fe4a94d5afd84d
201--- /dev/null
202+++ b/projects.zsh-example
203@@ -0,0 +1,5 @@
204+# Add yourself some shortcuts to projects you often work on
205+# Example:
206+#
207+# brainstormr=/Users/robbyrussell/Projects/development/planetargon/brainstormr
208+#
209diff --git a/prompt.zsh b/prompt.zsh
210new file mode 100644
211index 0000000000000000000000000000000000000000..a36e97f8e495180fb713db148b720b1ee531183b
212--- /dev/null
213+++ b/prompt.zsh
214@@ -0,0 +1,29 @@
215+bindkey -e
216+
217+# Directory stuff.
218+setopt AUTO_NAME_DIRS
219+
220+# Speed stuff.
221+
222+#setopt NO_BEEP
223+setopt AUTO_CD
224+setopt MULTIOS
225+setopt CDABLEVARS
226+
227+bindkey -e
228+
229+if [[ x$WINDOW != x ]]
230+then
231+ SCREEN_NO="%B$WINDOW%b "
232+else
233+ SCREEN_NO=""
234+fi
235+
236+PS1="%n@%m:%~%# "
237+
238+# Setup the prompt with pretty colors
239+setopt prompt_subst
240+
241+export LSCOLORS="Gxfxcxdxbxegedabagacad"
242+
243+PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
244diff --git a/rake_completion.zsh b/rake_completion.zsh
245new file mode 100644
246index 0000000000000000000000000000000000000000..a94b488960a3623fc1a34c564efa674eb697958b
247--- /dev/null
248+++ b/rake_completion.zsh
249@@ -0,0 +1,42 @@
250+_rake_does_task_list_need_generating () {
251+ if [ ! -f .rake_tasks ]; then return 0;
252+ else
253+ accurate=$(stat -f%m .rake_tasks)
254+ changed=$(stat -f%m Rakefile)
255+ return $(expr $accurate '>=' $changed)
256+ fi
257+}
258+
259+_rake () {
260+ if [ -f Rakefile ]; then
261+ if _rake_does_task_list_need_generating; then
262+ echo "\nGenerating .rake_tasks..." > /dev/stderr
263+ rake --silent --tasks | cut -d " " -f 2 > .rake_tasks
264+ fi
265+ compadd `cat .rake_tasks`
266+ fi
267+}
268+
269+compdef _rake rake
270+
271+function _cap_does_task_list_need_generating () {
272+ if [ ! -f .cap_tasks ]; then return 0;
273+ else
274+ accurate=$(stat -f%m .cap_tasks)
275+ changed=$(stat -f%m config/deploy.rb)
276+ return $(expr $accurate '>=' $changed)
277+ fi
278+}
279+
280+function _cap () {
281+ if [ -f config/deploy.rb ]; then
282+ if _cap_does_task_list_need_generating; then
283+ echo "\nGenerating .cap_tasks..." > /dev/stderr
284+ cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D'
285+> .cap_tasks
286+ fi
287+ compadd `cat .cap_tasks`
288+ fi
289+}
290+
291+compdef _cap cap
292diff --git a/zshrc b/zshrc
293new file mode 100644
294index 0000000000000000000000000000000000000000..e2fd0fc5af5b87634e02a75d4b125a8ec179c291
295--- /dev/null
296+++ b/zshrc
297@@ -0,0 +1,34 @@
298+export EDITOR=/opt/local/bin/joe
299+export PAGER=less
300+export ZSH=$HOME/zsh
301+export LC_CTYPE=en_US.UTF-8
302+
303+# TODO: Refactor this sometimes soon...
304+source $ZSH/colors.zsh
305+source $ZSH/aliases.zsh
306+source $ZSH/completion.zsh
307+source $ZSH/rake_completion.zsh
308+source $ZSH/functions.zsh
309+source $ZSH/git.zsh
310+source $ZSH/history.zsh
311+source $ZSH/grep.zsh
312+source $ZSH/prompt.zsh
313+
314+# Uncomment if you have a projects.zsh file
315+# source $ZSH/projects.zsh
316+
317+# Directory stuff.
318+
319+setopt AUTO_NAME_DIRS
320+
321+# Speed stuff.
322+
323+#setopt NO_BEEP
324+setopt AUTO_CD
325+setopt MULTIOS
326+setopt CDABLEVARS
327+
328+# Customize to your needs...
329+export PATH=~/bin:/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/sbin:/opt/local/lib/postgresql83/bin
330+
331+