6b86636413c3b9b98d723ea77058db6c283325e4

Author
Andrew Hodges <betawaffle@gmail.com>
Committer
Andrew Hodges <betawaffle@gmail.com>
Date

Message

Merge branch 'plugins'

Diff

  1diff --git a/plugins/brew/_brew b/plugins/brew/_brew
  2index cee1e25f0bdbaae3808392f6bc678e22f653ec80..1dcf0a4bff26c50eec9a8023695cfe409db6053d 100644
  3--- a/plugins/brew/_brew
  4+++ b/plugins/brew/_brew
  5@@ -25,10 +25,12 @@ _1st_arguments=(
  6   'link:link a formula'
  7   'list:list files in a formula or not-installed formulae'
  8   'log:git commit log for a formula'
  9+  'missing:check all installed formuale for missing dependencies.'
 10   'outdated:list formulas for which a newer version is available'
 11   'prune:remove dead links'
 12   'remove:remove a formula'
 13   'search:search for a formula (/regex/ or string)'
 14+  'server:start a local web app that lets you browse formulae (requires Sinatra)'
 15   'unlink:unlink a formula'
 16   'update:freshen up links'
 17   'upgrade:upgrade outdated formulae'
 18@@ -36,10 +38,14 @@ _1st_arguments=(
 19 )
 20 
 21 local expl
 22-local -a formula installed_formulae
 23+local -a formulae installed_formulae
 24 
 25 _arguments \
 26-  '(-v --verbose)'{-v,--verbose}'[verbose]' \
 27+  '(-v)-v[verbose]' \
 28+  '(--cellar)--cellar[brew cellar]' \
 29+  '(--config)--config[brew configuration]' \
 30+  '(--env)--env[brew environment]' \
 31+  '(--repository)--repository[brew repository]' \
 32   '(--version)--version[version information]' \
 33   '(--prefix)--prefix[where brew lives on this system]' \
 34   '(--cache)--cache[brew cache]' \
 35@@ -51,20 +57,24 @@ if (( CURRENT == 1 )); then
 36 fi
 37 
 38 case "$words[1]" in
 39-  list)
 40+  search|-S)
 41+    _arguments \
 42+      '(--macports)--macports[search the macports repository]' \
 43+      '(--fink)--fink[search the fink repository]' ;;
 44+  list|ls)
 45     _arguments \
 46       '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
 47+      '(--versions)--versions[list all installed versions of a formula]' \
 48       '1: :->forms' &&  return 0
 49 
 50       if [[ "$state" == forms ]]; then
 51         _brew_installed_formulae
 52-        _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae
 53+        _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
 54       fi ;;
 55-  install|home|log|info|uses|cat|deps)
 56+  install|home|homepage|log|info|abv|uses|cat|deps|edit|options)
 57     _brew_all_formulae
 58     _wanted formulae expl 'all formulae' compadd -a formulae ;;
 59-  remove|edit|xo)
 60+  remove|rm|uninstall|unlink|cleanup|link|ln)
 61     _brew_installed_formulae
 62     _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
 63 esac
 64-
 65diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh
 66new file mode 100644
 67index 0000000000000000000000000000000000000000..f584a4684fe347c9be9070e1862afd3809138670
 68--- /dev/null
 69+++ b/plugins/brew/brew.plugin.zsh
 70@@ -0,0 +1,13 @@
 71+# Move /usr/local/bin (path where brews are linked) to the front of the path
 72+# This will allow us to override system binaries like ruby with our brews
 73+# TODO: Do this in a more compatible way.
 74+#       What if someone doesn't have /usr/bin in their path?
 75+export PATH=`echo $PATH | sed -e 's|/usr/local/bin||' -e 's|::|:|g'` # Remove /usr/local/bin
 76+export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/bin:&|'`     # Add it in front of /usr/bin
 77+export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/sbin:&|'`    # Add /usr/local/sbin
 78+
 79+alias brews='brew list -1'
 80+
 81+function brew-link-completion {
 82+	ln -s "$(brew --prefix)/Library/Contributions/brew_zsh_completion.zsh" "$ZSH/plugins/brew/_brew.official"
 83+}
 84diff --git a/plugins/cap/cap.plugin.zsh b/plugins/cap/cap.plugin.zsh
 85index a0fa21d005e628888cf73c9f3e4abc56d1a090b1..8336182d5d8692f609b04d0c9c9c385fc6de5367 100644
 86--- a/plugins/cap/cap.plugin.zsh
 87+++ b/plugins/cap/cap.plugin.zsh
 88@@ -18,4 +18,4 @@ function _cap () {
 89   fi
 90 }
 91 
 92-compctl -K _cap cap
 93+compctl -K _cap cap
 94diff --git a/plugins/compleat/compleat.plugin.zsh b/plugins/compleat/compleat.plugin.zsh
 95index 8d16a5687eff49f83cc64d695f9c70a1cff125b5..38f1b396aabf16926d6f0aff06e6f20b2840ab40 100644
 96--- a/plugins/compleat/compleat.plugin.zsh
 97+++ b/plugins/compleat/compleat.plugin.zsh
 98@@ -5,7 +5,6 @@
 99 #       VERSION:  1.0.0
100 # ------------------------------------------------------------------------------
101 
102-
103 if (( ${+commands[compleat]} )); then
104   local prefix="${commands[compleat]:h:h}"
105   local setup="${prefix}/share/compleat-1.0/compleat_setup" 
106@@ -19,4 +18,3 @@ if (( ${+commands[compleat]} )); then
107     source "$setup" 
108   fi
109 fi
110-
111diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh
112index df7053ba7c897eff67982911cc754a62eb3970e3..1eb3381136818b82b1915cb5113d1877fc0907a5 100644
113--- a/plugins/github/github.plugin.zsh
114+++ b/plugins/github/github.plugin.zsh
115@@ -4,4 +4,3 @@ if [ "$commands[(I)hub]" ]; then
116     # eval `hub alias -s zsh`
117     function git(){hub "$@"}
118 fi
119-
120diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh
121new file mode 100644
122index 0000000000000000000000000000000000000000..18f35333ccd510dfbb8d62058a5b28b2fc3c01f2
123--- /dev/null
124+++ b/plugins/node/node.plugin.zsh
125@@ -0,0 +1,8 @@
126+# This works if you installed node via homebrew.
127+export NODE_PATH="/usr/local/lib/node"
128+
129+# Open the node api for your current version to the optional section.
130+# TODO: Make the section part easier to use.
131+function node-api {
132+	open "http://nodejs.org/docs/$(node --version)/api/all.html#$1"
133+}
134diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh
135new file mode 100644
136index 0000000000000000000000000000000000000000..0b0a30e114072931782379c14eca74f527c96ea6
137--- /dev/null
138+++ b/plugins/npm/npm.plugin.zsh
139@@ -0,0 +1,2 @@
140+# TODO: Don't do this in such a weird way.
141+export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/share/npm/bin:&|'`
142diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
143index 81eed5e92af372466fc02bb682a9d5a8b26091e8..a65ca642a2cc31d89507274fe8714933d17b7281 100644
144--- a/plugins/osx/osx.plugin.zsh
145+++ b/plugins/osx/osx.plugin.zsh
146@@ -1,3 +1,9 @@
147+alias showfiles='defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder'
148+alias hidefiles='defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder'
149+
150+# Recursively delete .DS_Store files
151+alias rm-dsstore="find . -name '*.DS_Store' -type f -delete"
152+
153 function savepath() {
154   pwd > ~/.current_path~
155 }
156diff --git a/plugins/pow/pow.plugin.zsh b/plugins/pow/pow.plugin.zsh
157new file mode 100644
158index 0000000000000000000000000000000000000000..6b2a6f2be0f3636c9026eb82a0405eebc79669b4
159--- /dev/null
160+++ b/plugins/pow/pow.plugin.zsh
161@@ -0,0 +1,10 @@
162+# Thanks to Christopher Sexton
163+# https://gist.github.com/965032
164+function kapow {
165+	touch ~/.pow/$1/tmp/restart.txt
166+	if [ $? -eq 0 ]; then
167+		echo "$fg[yellow]Pow restarting $1...$reset_color"
168+	fi
169+}
170+
171+compctl -W ~/.pow -/ kapow
172diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh
173index 82bf5d49d4420c398520709236a38291b4459cb9..08ca9c60178faf69bb92b4bcd1a5fd66b31f49eb 100644
174--- a/plugins/ruby/ruby.plugin.zsh
175+++ b/plugins/ruby/ruby.plugin.zsh
176@@ -1,4 +1,6 @@
177+# TODO: Make this compatible with rvm.
178+#       Run sudo gem on the system ruby, not the active ruby.
179 alias sgem='sudo gem'
180 
181 # Find ruby file
182-alias rfind='find . -name *.rb | xargs grep -n'
183+alias rfind='find . -name *.rb | xargs grep -n'
184diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh
185index ef934d547a903728e2f91e255601b11db267f70d..8a3ec788a4ad1363e833808cf7c410c9c3afc9e9 100644
186--- a/plugins/rvm/rvm.plugin.zsh
187+++ b/plugins/rvm/rvm.plugin.zsh
188@@ -1,3 +1,52 @@
189 fpath=($ZSH/plugins/rvm $fpath)
190 autoload -U compinit
191 compinit -i
192+
193+alias rubies='rvm list rubies'
194+alias gemsets='rvm gemset list'
195+
196+local ruby18='ruby-1.8.7-p334'
197+local ruby19='ruby-1.9.2-p180'
198+
199+function rb18 {
200+	if [ -z "$1" ]; then
201+		rvm use "$ruby18"
202+	else
203+		rvm use "$ruby18@$1"
204+	fi
205+}
206+
207+_rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`}
208+compdef _rb18 rb18
209+
210+function rb19 {
211+	if [ -z "$1" ]; then
212+		rvm use "$ruby19"
213+	else
214+		rvm use "$ruby19@$1"
215+	fi
216+}
217+
218+_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`}
219+compdef _rb19 rb19
220+
221+function rvm-update {
222+	rvm get head
223+	rvm reload # TODO: Reload rvm completion?
224+}
225+
226+function rvm-link-completion {
227+	ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official"
228+}
229+
230+# TODO: Make this usable w/o rvm.
231+function gems {
232+	local current_ruby=`rvm-prompt i v p`
233+	local current_gemset=`rvm-prompt g`
234+
235+	gem list $@ | sed \
236+		-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
237+		-Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
238+		-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
239+		-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
240+}
241diff --git a/plugins/textmate/textmate.plugin.zsh b/plugins/textmate/textmate.plugin.zsh
242index 7c4c14a5fa8b8d0344badb35f7445518caef7b4c..aa2f75f4f7328b03765562b1e82b7408955f1e69 100644
243--- a/plugins/textmate/textmate.plugin.zsh
244+++ b/plugins/textmate/textmate.plugin.zsh
245@@ -1,11 +1,9 @@
246-
247-# TextMate
248 alias et='mate .'
249 alias ett='mate app config lib db public spec test Rakefile Capfile Todo'
250 alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
251 alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
252 
253-# Editor Ruby file in TextMate
254+# Edit Ruby app in TextMate
255 alias mr='mate CHANGELOG app config db lib public script spec test'
256 
257 function tm() {
258diff --git a/plugins/thor/_thor b/plugins/thor/_thor
259new file mode 100644
260index 0000000000000000000000000000000000000000..9f7ed5aefd35f6fa8d6133cde408f50e56d773f6
261--- /dev/null
262+++ b/plugins/thor/_thor
263@@ -0,0 +1,4 @@
264+#compdef thor
265+#autoload
266+
267+compadd `thor list | grep thor | cut -d " " -f 2`