2b55ee07534ec34a699805dc35ca83ad8e22fc7a
- Author
- Roman Kamyk <roman.kamyk@gmail.com>
- Committer
- Roman Kamyk <roman.kamyk@gmail.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/.gitignore b/.gitignore
2index 4b555067e1fc5501b0ffccd0c21de1604845f3ae..2e8db7341894fdf0940c0c37995e93e1b3b0d9fa 100644
3--- a/.gitignore
4+++ b/.gitignore
5@@ -2,5 +2,7 @@ locals.zsh
6 log/.zsh_history
7 projects.zsh
8 custom/*
9+!custom/example
10 !custom/example.zsh
11 cache
12+*.swp
13diff --git a/README.textile b/README.textile
14index d01c3310a425d4a31017c2d22006575e6176c408..2dbfbe5a658d8bba2d387bbab272e189ab9e8fca 100644
15--- a/README.textile
16+++ b/README.textile
17@@ -48,7 +48,9 @@ the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty fo
18 h3. Customization
19
20 If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory.
21-If you have many functions which go good together you can put them as a *.plugin.zsh file in the @plugin/@ directory and then enable this plugin.
22+If you have many functions which go good together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin.
23+If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@.
24+
25
26 h3. Uninstalling
27
28@@ -68,4 +70,4 @@ This project wouldn't exist without all of our awesome users and contributors.
29
30 * "View our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors
31
32-Thank you so much!
33+Thank you so much!
34diff --git a/custom/example/example.plugin.zsh b/custom/example/example.plugin.zsh
35new file mode 100644
36index 0000000000000000000000000000000000000000..406f27445b76feced2ff33e2d09b079f6739eca3
37--- /dev/null
38+++ b/custom/example/example.plugin.zsh
39@@ -0,0 +1,2 @@
40+# Add your own custom plugins in the custom/plugins directory. Plugins placed
41+# here will override ones with the same name in the main plugins directory.
42diff --git a/lib/aliases.zsh b/lib/aliases.zsh
43index b47de5bde5a573e4c9465048111c133b3213edc3..0555be2642fcd73e6d4ced8bc44e7eee75e13607 100644
44--- a/lib/aliases.zsh
45+++ b/lib/aliases.zsh
46@@ -22,4 +22,3 @@ alias sl=ls # often screw this up
47
48 alias afind='ack-grep -il'
49
50-alias x=extract
51diff --git a/lib/completion.zsh b/lib/completion.zsh
52index fdd0a8536cd4825235d0f4fddd217f0f398ea86b..b3cc918229ce3cdf60f6434cda1ecf1e7a385a77 100644
53--- a/lib/completion.zsh
54+++ b/lib/completion.zsh
55@@ -59,3 +59,12 @@ zstyle ':completion:*:*:*:users' ignored-patterns \
56 # ... unless we really want to.
57 zstyle '*' single-ignored show
58
59+if [ "x$COMPLETION_WAITING_DOTS" = "xtrue" ]; then
60+ expand-or-complete-with-dots() {
61+ echo -n "\e[31m......\e[0m"
62+ zle expand-or-complete
63+ zle redisplay
64+ }
65+ zle -N expand-or-complete-with-dots
66+ bindkey "^I" expand-or-complete-with-dots
67+fi
68diff --git a/lib/edit-command-line.zsh b/lib/edit-command-line.zsh
69new file mode 100644
70index 0000000000000000000000000000000000000000..db2000325c82691b5eef2b664c27b00caab1ec58
71--- /dev/null
72+++ b/lib/edit-command-line.zsh
73@@ -0,0 +1,3 @@
74+autoload -U edit-command-line
75+zle -N edit-command-line
76+bindkey '\C-x\C-e' edit-command-line
77diff --git a/lib/functions.zsh b/lib/functions.zsh
78index 6f5d015f7a598739ddc3de8e5fbf451817a8e125..ef7cc6383038b7e6f9a02c857f13ea498ba5a8fe 100644
79--- a/lib/functions.zsh
80+++ b/lib/functions.zsh
81@@ -15,38 +15,3 @@ function take() {
82 cd $1
83 }
84
85-function extract() {
86- unset REMOVE_ARCHIVE
87-
88- if test "$1" = "-r"; then
89- REMOVE=1
90- shift
91- fi
92- if [[ -f $1 ]]; then
93- case $1 in
94- *.tar.bz2) tar xvjf $1;;
95- *.tar.gz) tar xvzf $1;;
96- *.tar.xz) tar xvJf $1;;
97- *.tar.lzma) tar --lzma -xvf $1;;
98- *.bz2) bunzip $1;;
99- *.rar) unrar $1;;
100- *.gz) gunzip $1;;
101- *.tar) tar xvf $1;;
102- *.tbz2) tar xvjf $1;;
103- *.tgz) tar xvzf $1;;
104- *.zip) unzip $1;;
105- *.Z) uncompress $1;;
106- *.7z) 7z x $1;;
107- *) echo "'$1' cannot be extracted via >extract<";;
108- esac
109-
110- if [[ $REMOVE_ARCHIVE -eq 1 ]]; then
111- echo removing "$1";
112- /bin/rm "$1";
113- fi
114-
115- else
116- echo "'$1' is not a valid file"
117- fi
118-}
119-
120diff --git a/lib/git.zsh b/lib/git.zsh
121index e96f075beeb7efcfc23c6b7520bf7bc46e1e9430..f04343650f65ddaaa6f9eba34b718d5f5d1bfd9c 100644
122--- a/lib/git.zsh
123+++ b/lib/git.zsh
124@@ -15,7 +15,7 @@ parse_git_dirty() {
125
126 # Checks if there are commits ahead from remote
127 function git_prompt_ahead() {
128- if $(echo "$(git log origin/master..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
129+ if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
130 echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
131 fi
132 }
133@@ -54,9 +54,11 @@ git_prompt_status() {
134 fi
135 if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
136 STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
137+ elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then
138+ STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
139 fi
140 if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
141 STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
142 fi
143 echo $STATUS
144-}
145+}
146diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh
147index c7ad907d782d61c51f6e62bd03dbf960712285df..5c1b90bfa94d4a3e9497383e0c6eac9f7a4ed07f 100644
148--- a/lib/key-bindings.zsh
149+++ b/lib/key-bindings.zsh
150@@ -14,12 +14,23 @@ bindkey '^[[B' down-line-or-search
151
152 bindkey "^[[H" beginning-of-line
153 bindkey "^[[1~" beginning-of-line
154+bindkey "^[OH" beginning-of-line
155 bindkey "^[[F" end-of-line
156 bindkey "^[[4~" end-of-line
157+bindkey "^[OF" end-of-line
158 bindkey ' ' magic-space # also do history expansion on space
159
160+bindkey "^[[1;5C" forward-word
161+bindkey "^[[1;5D" backward-word
162+
163 bindkey '^[[Z' reverse-menu-complete
164
165+# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~
166+bindkey '^?' backward-delete-char
167+bindkey "^[[3~" delete-char
168+bindkey "^[3;5~" delete-char
169+bindkey "\e[3~" delete-char
170+
171 # consider emacs keybindings:
172
173 #bindkey -e ## emacs key bindings
174diff --git a/lib/misc.zsh b/lib/misc.zsh
175index 4c1743657fc1f70a3de0b2ca37fa7c0df7b05843..88732e664e1fc4ec3c5cb8e8e04ccc2ba9761dba 100644
176--- a/lib/misc.zsh
177+++ b/lib/misc.zsh
178@@ -10,4 +10,4 @@ setopt long_list_jobs
179
180 ## pager
181 export PAGER=less
182-export LC_CTYPE=en_US.UTF-8
183+export LC_CTYPE=$LANG
184diff --git a/lib/spectrum.zsh b/lib/spectrum.zsh
185index 4006a7fe105dd0b7fddadf8b265186b57f596cc6..2fdf537ef5e2ea10e1494f4668c01231ba58e1e2 100644
186--- a/lib/spectrum.zsh
187+++ b/lib/spectrum.zsh
188@@ -18,3 +18,11 @@ for color in {000..255}; do
189 FG[$color]="%{[38;5;${color}m%}"
190 BG[$color]="%{[48;5;${color}m%}"
191 done
192+
193+# Show all 256 colors with color number
194+function spectrum_ls() {
195+ for code in {000..255}; do
196+ print -P -- "$code: %F{$code}Test%f"
197+ done
198+}
199+
200diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
201index 3ea88e9248f70f58fed084b2c274548acb902b7d..c4522491bc083f1cade6207432a4f4e62c6d009c 100644
202--- a/oh-my-zsh.sh
203+++ b/oh-my-zsh.sh
204@@ -1,7 +1,13 @@
205+# Check for updates on initial load...
206+if [ "$DISABLE_AUTO_UPDATE" != "true" ]
207+then
208+ /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh
209+fi
210+
211 # Initializes Oh My Zsh
212
213 # add a function path
214-fpath=($ZSH/functions $fpath)
215+fpath=($ZSH/functions $ZSH/completions $fpath)
216
217 # Load all of the config files in ~/oh-my-zsh that end in .zsh
218 # TIP: Add files you don't want in git to .gitignore
219@@ -17,7 +23,9 @@ compinit -i
220
221 # Load all of the plugins that were defined in ~/.zshrc
222 for plugin ($plugins); do
223- if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
224+ if [ -f $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh ]; then
225+ source $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh
226+ elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
227 source $ZSH/plugins/$plugin/$plugin.plugin.zsh
228 fi
229 done
230@@ -26,24 +34,18 @@ done
231 for config_file ($ZSH/custom/*.zsh) source $config_file
232
233 # Load the theme
234-# Check for updates on initial load...
235 if [ "$ZSH_THEME" = "random" ]
236 then
237 themes=($ZSH/themes/*zsh-theme)
238 N=${#themes[@]}
239- ((N=RANDOM%N))
240+ ((N=(RANDOM%N)+1))
241 RANDOM_THEME=${themes[$N]}
242 source "$RANDOM_THEME"
243 echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
244 else
245- source "$ZSH/themes/$ZSH_THEME.zsh-theme"
246+ if [ ! "$ZSH_THEME" = "" ]
247+ then
248+ source "$ZSH/themes/$ZSH_THEME.zsh-theme"
249+ fi
250 fi
251
252-
253-# Check for updates on initial load...
254-if [ "$DISABLE_AUTO_UPDATE" = "true" ]
255-then
256- return
257-else
258- /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh
259-fi
260diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh
261new file mode 100644
262index 0000000000000000000000000000000000000000..691d4d2db51a09b5ce69c83d621f8e2cce008e28
263--- /dev/null
264+++ b/plugins/ant/ant.plugin.zsh
265@@ -0,0 +1,26 @@
266+stat -f%m . > /dev/null 2>&1
267+if [ "$?" = 0 ]; then
268+ stat_cmd=(stat -f%m)
269+else
270+ stat_cmd=(stat -L --format=%Y)
271+fi
272+
273+_ant_does_target_list_need_generating () {
274+ if [ ! -f .ant_targets ]; then return 0;
275+ else
276+ accurate=$($stat_cmd .ant_targets)
277+ changed=$($stat_cmd build.xml)
278+ return $(expr $accurate '>=' $changed)
279+ fi
280+}
281+
282+_ant () {
283+ if [ -f build.xml ]; then
284+ if _ant_does_target_list_need_generating; then
285+ sed -n '/<target/s/<target.*name="\([^"]*\).*$/\1/p' build.xml > .ant_targets
286+ fi
287+ compadd `cat .ant_targets`
288+ fi
289+}
290+
291+compdef _ant ant
292diff --git a/plugins/apache2-macports/apache2-macports.plugin.zsh b/plugins/apache2-macports/apache2-macports.plugin.zsh
293new file mode 100644
294index 0000000000000000000000000000000000000000..1caa4cf9d11b318a59a7c5473c975c5c5833d103
295--- /dev/null
296+++ b/plugins/apache2-macports/apache2-macports.plugin.zsh
297@@ -0,0 +1,6 @@
298+# commands to control local apache2 server installation
299+# paths are for osx installation via macports
300+
301+alias apache2start='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start'
302+alias apache2stop='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop'
303+alias apache2restart='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart'
304diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh
305new file mode 100644
306index 0000000000000000000000000000000000000000..b5e519036229b856c7a92854130d7fccaf848957
307--- /dev/null
308+++ b/plugins/archlinux/archlinux.plugin.zsh
309@@ -0,0 +1,76 @@
310+# Archlinux zsh aliases and functions
311+# Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins
312+
313+# Look for yaourt, and add some useful functions if we have it.
314+if [[ -x `which yaourt` ]]; then
315+ upgrade () {
316+ yaourt -Syu
317+ }
318+ alias yaconf='yaourt -C' # Fix all configuration files with vimdiff
319+ # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
320+ alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
321+ alias yain='yaourt -S' # Install specific package(s) from the repositories
322+ alias yains='yaourt -U' # Install specific package not from the repositories but from a file
323+ alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
324+ alias yarem='yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
325+ alias yarep='yaourt -Si' # Display information about a given package in the repositories
326+ alias yareps='yaourt -Ss' # Search for package(s) in the repositories
327+ alias yaloc='yaourt -Qi' # Display information about a given package in the local database
328+ alias yalocs='yaourt -Qs' # Search for package(s) in the local database
329+ # Additional yaourt alias examples
330+ if [[ -x `which abs` ]]; then
331+ alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
332+ else
333+ alias yaupd='yaourt -Sy' # Update and refresh the local package and ABS databases against repositories
334+ fi
335+ alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package
336+ alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
337+else
338+ upgrade() {
339+ sudo pacman -Syu
340+ }
341+fi
342+
343+# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
344+alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
345+alias pacin='sudo pacman -S' # Install specific package(s) from the repositories
346+alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file
347+alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
348+alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
349+alias pacrep='pacman -Si' # Display information about a given package in the repositories
350+alias pacreps='pacman -Ss' # Search for package(s) in the repositories
351+alias pacloc='pacman -Qi' # Display information about a given package in the local database
352+alias paclocs='pacman -Qs' # Search for package(s) in the local database
353+# Additional pacman alias examples
354+if [[ -x `which abs` ]]; then
355+ alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
356+else
357+ alias pacupd='sudo pacman -Sy' # Update and refresh the local package and ABS databases against repositories
358+fi
359+alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package
360+alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
361+
362+# https://bbs.archlinux.org/viewtopic.php?id=93683
363+paclist() {
364+ sudo pacman -Qei $(pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}'
365+}
366+
367+alias paclsorphans='sudo pacman -Qdt'
368+alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
369+
370+pacdisowned() {
371+ tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
372+ db=$tmp/db
373+ fs=$tmp/fs
374+
375+ mkdir "$tmp"
376+ trap 'rm -rf "$tmp"' EXIT
377+
378+ pacman -Qlq | sort -u > "$db"
379+
380+ find /bin /etc /lib /sbin /usr \
381+ ! -name lost+found \
382+ \( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
383+
384+ comm -23 "$fs" "$db"
385+}
386diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh
387new file mode 100644
388index 0000000000000000000000000000000000000000..da0a1276572dc655cc82eedc762e2996dac8b0b6
389--- /dev/null
390+++ b/plugins/autojump/autojump.plugin.zsh
391@@ -0,0 +1,3 @@
392+if [ -f `brew --prefix`/etc/autojump ]; then
393+ . `brew --prefix`/etc/autojump
394+fi
395diff --git a/plugins/brew/_brew b/plugins/brew/_brew
396index cee1e25f0bdbaae3808392f6bc678e22f653ec80..1dcf0a4bff26c50eec9a8023695cfe409db6053d 100644
397--- a/plugins/brew/_brew
398+++ b/plugins/brew/_brew
399@@ -25,10 +25,12 @@ _1st_arguments=(
400 'link:link a formula'
401 'list:list files in a formula or not-installed formulae'
402 'log:git commit log for a formula'
403+ 'missing:check all installed formuale for missing dependencies.'
404 'outdated:list formulas for which a newer version is available'
405 'prune:remove dead links'
406 'remove:remove a formula'
407 'search:search for a formula (/regex/ or string)'
408+ 'server:start a local web app that lets you browse formulae (requires Sinatra)'
409 'unlink:unlink a formula'
410 'update:freshen up links'
411 'upgrade:upgrade outdated formulae'
412@@ -36,10 +38,14 @@ _1st_arguments=(
413 )
414
415 local expl
416-local -a formula installed_formulae
417+local -a formulae installed_formulae
418
419 _arguments \
420- '(-v --verbose)'{-v,--verbose}'[verbose]' \
421+ '(-v)-v[verbose]' \
422+ '(--cellar)--cellar[brew cellar]' \
423+ '(--config)--config[brew configuration]' \
424+ '(--env)--env[brew environment]' \
425+ '(--repository)--repository[brew repository]' \
426 '(--version)--version[version information]' \
427 '(--prefix)--prefix[where brew lives on this system]' \
428 '(--cache)--cache[brew cache]' \
429@@ -51,20 +57,24 @@ if (( CURRENT == 1 )); then
430 fi
431
432 case "$words[1]" in
433- list)
434+ search|-S)
435+ _arguments \
436+ '(--macports)--macports[search the macports repository]' \
437+ '(--fink)--fink[search the fink repository]' ;;
438+ list|ls)
439 _arguments \
440 '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
441+ '(--versions)--versions[list all installed versions of a formula]' \
442 '1: :->forms' && return 0
443
444 if [[ "$state" == forms ]]; then
445 _brew_installed_formulae
446- _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae
447+ _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
448 fi ;;
449- install|home|log|info|uses|cat|deps)
450+ install|home|homepage|log|info|abv|uses|cat|deps|edit|options)
451 _brew_all_formulae
452 _wanted formulae expl 'all formulae' compadd -a formulae ;;
453- remove|edit|xo)
454+ remove|rm|uninstall|unlink|cleanup|link|ln)
455 _brew_installed_formulae
456 _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
457 esac
458-
459diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh
460new file mode 100644
461index 0000000000000000000000000000000000000000..c2e95884e96fd6bb5faba415ebdbe6e9b11153f0
462--- /dev/null
463+++ b/plugins/brew/brew.plugin.zsh
464@@ -0,0 +1 @@
465+alias brews='brew list -1'
466diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
467index fb40e2cec10dc79da5875c660d18d70d4ee9ac10..a6c116407038cbf6b9e81e1a82d25c41e2a9b7ad 100644
468--- a/plugins/bundler/bundler.plugin.zsh
469+++ b/plugins/bundler/bundler.plugin.zsh
470@@ -1,3 +1,37 @@
471 alias be="bundle exec"
472 alias bi="bundle install"
473+alias bl="bundle list"
474 alias bu="bundle update"
475+alias bp="bundle package"
476+
477+# The following is based on https://github.com/gma/bundler-exec
478+
479+bundled_commands=(cap capify cucumber guard heroku rackup rails rake rspec ruby shotgun spec spork thin unicorn unicorn_rails)
480+
481+## Functions
482+
483+_bundler-installed() {
484+ which bundle > /dev/null 2>&1
485+}
486+
487+_within-bundled-project() {
488+ local check_dir=$PWD
489+ while [ "$(dirname $check_dir)" != "/" ]; do
490+ [ -f "$check_dir/Gemfile" ] && return
491+ check_dir="$(dirname $check_dir)"
492+ done
493+ false
494+}
495+
496+_run-with-bundler() {
497+ if _bundler-installed && _within-bundled-project; then
498+ bundle exec $@
499+ else
500+ $@
501+ fi
502+}
503+
504+## Main program
505+for cmd in $bundled_commands; do
506+ alias $cmd="_run-with-bundler $cmd"
507+done
508diff --git a/plugins/cake/cake.plugin.zsh b/plugins/cake/cake.plugin.zsh
509new file mode 100644
510index 0000000000000000000000000000000000000000..f968c71d582a35a9e175f0fc3a55d220f71d85fe
511--- /dev/null
512+++ b/plugins/cake/cake.plugin.zsh
513@@ -0,0 +1,32 @@
514+# Set this to 1 if you want to cache the tasks
515+cache_task_list=1
516+
517+# Cache filename
518+cache_file='.cake_task_cache'
519+
520+_cake_does_target_list_need_generating () {
521+
522+ if [ $cache_task_list -eq 0 ]; then
523+ return 1;
524+ fi
525+
526+ if [ ! -f $cache_file ]; then return 0;
527+ else
528+ accurate=$(stat -f%m $cache_file)
529+ changed=$(stat -f%m Cakefile)
530+ return $(expr $accurate '>=' $changed)
531+ fi
532+}
533+
534+_cake () {
535+ if [ -f Cakefile ]; then
536+ if _cake_does_target_list_need_generating; then
537+ cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$' > $cache_file
538+ compadd `cat $cache_file`
539+ else
540+ compadd `cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$'`
541+ fi
542+ fi
543+}
544+
545+compdef _cake cake
546diff --git a/plugins/cap/cap.plugin.zsh b/plugins/cap/cap.plugin.zsh
547index a0fa21d005e628888cf73c9f3e4abc56d1a090b1..8336182d5d8692f609b04d0c9c9c385fc6de5367 100644
548--- a/plugins/cap/cap.plugin.zsh
549+++ b/plugins/cap/cap.plugin.zsh
550@@ -18,4 +18,4 @@ function _cap () {
551 fi
552 }
553
554-compctl -K _cap cap
555+compctl -K _cap cap
556diff --git a/plugins/cloudapp/cloudapp.plugin.zsh b/plugins/cloudapp/cloudapp.plugin.zsh
557new file mode 100644
558index 0000000000000000000000000000000000000000..99252f690b13c0d247024187858c759898d9474f
559--- /dev/null
560+++ b/plugins/cloudapp/cloudapp.plugin.zsh
561@@ -0,0 +1,2 @@
562+#!/bin/zsh
563+alias cloudapp=$ZSH/plugins/cloudapp/cloudapp.rb
564diff --git a/plugins/cloudapp/cloudapp.rb b/plugins/cloudapp/cloudapp.rb
565new file mode 100755
566index 0000000000000000000000000000000000000000..a11cfdb32be06a1fb1ea00933f306e2ff1e95715
567--- /dev/null
568+++ b/plugins/cloudapp/cloudapp.rb
569@@ -0,0 +1,60 @@
570+#!/usr/bin/env ruby
571+#
572+# cloudapp
573+# Zach Holman / @holman
574+#
575+# Uploads a file from the command line to CloudApp, drops it into your
576+# clipboard (on a Mac, at least).
577+#
578+# Example:
579+#
580+# cloudapp drunk-blake.png
581+#
582+# This requires Aaron Russell's cloudapp_api gem:
583+#
584+# gem install cloudapp_api
585+#
586+# Requires you set your CloudApp credentials in ~/.cloudapp as a simple file of:
587+#
588+# email
589+# password
590+
591+require 'rubygems'
592+begin
593+ require 'cloudapp_api'
594+rescue LoadError
595+ puts "You need to install cloudapp_api: gem install cloudapp_api"
596+ exit!(1)
597+end
598+
599+config_file = "#{ENV['HOME']}/.cloudapp"
600+unless File.exist?(config_file)
601+ puts "You need to type your email and password (one per line) into "+
602+ "`~/.cloudapp`"
603+ exit!(1)
604+end
605+
606+email,password = File.read(config_file).split("\n")
607+
608+class HTTParty::Response
609+ # Apparently HTTPOK.ok? IS NOT OKAY WTFFFFFFFFFFUUUUUUUUUUUUUU
610+ # LETS MONKEY PATCH IT I FEEL OKAY ABOUT IT
611+ def ok? ; true end
612+end
613+
614+if ARGV[0].nil?
615+ puts "You need to specify a file to upload."
616+ exit!(1)
617+end
618+
619+CloudApp.authenticate(email,password)
620+url = CloudApp::Item.create(:upload, {:file => ARGV[0]}).url
621+
622+# Say it for good measure.
623+puts "Uploaded to #{url}."
624+
625+# Get the embed link.
626+url = "#{url}/#{ARGV[0].split('/').last}"
627+
628+# Copy it to your (Mac's) clipboard.
629+`echo '#{url}' | tr -d "\n" | pbcopy`
630diff --git a/plugins/compleat/compleat.plugin.zsh b/plugins/compleat/compleat.plugin.zsh
631new file mode 100644
632index 0000000000000000000000000000000000000000..38f1b396aabf16926d6f0aff06e6f20b2840ab40
633--- /dev/null
634+++ b/plugins/compleat/compleat.plugin.zsh
635@@ -0,0 +1,20 @@
636+# ------------------------------------------------------------------------------
637+# FILE: compleat.plugin.zsh
638+# DESCRIPTION: oh-my-zsh plugin file.
639+# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
640+# VERSION: 1.0.0
641+# ------------------------------------------------------------------------------
642+
643+if (( ${+commands[compleat]} )); then
644+ local prefix="${commands[compleat]:h:h}"
645+ local setup="${prefix}/share/compleat-1.0/compleat_setup"
646+
647+ if [[ -f "$setup" ]]; then
648+ if ! bashcompinit >/dev/null 2>&1; then
649+ autoload -U bashcompinit
650+ bashcompinit -i
651+ fi
652+
653+ source "$setup"
654+ fi
655+fi
656diff --git a/plugins/django/django.plugin.zsh b/plugins/django/django.plugin.zsh
657new file mode 100644
658index 0000000000000000000000000000000000000000..1d72a2f2c13f20d33ee63f5ec9918621bdb6827a
659--- /dev/null
660+++ b/plugins/django/django.plugin.zsh
661@@ -0,0 +1,222 @@
662+#compdef manage.py
663+
664+typeset -ga nul_args
665+nul_args=(
666+ '--settings=-[the Python path to a settings module.]:file:_files'
667+ '--pythonpath=-[a directory to add to the Python path.]::directory:_directories'
668+ '--traceback[print traceback on exception.]'
669+ "--version[show program's version number and exit.]"
670+ {-h,--help}'[show this help message and exit.]'
671+)
672+
673+_managepy-adminindex(){
674+ _arguments -s : \
675+ $nul_args \
676+ '*::directory:_directories' && ret=0
677+}
678+
679+_managepy-createcachetable(){
680+ _arguments -s : \
681+ $nul_args && ret=0
682+}
683+
684+_managepy-dbshell(){
685+ _arguments -s : \
686+ $nul_args && ret=0
687+}
688+
689+_managepy-diffsettings(){
690+ _arguments -s : \
691+ $nul_args && ret=0
692+}
693+
694+_managepy-dumpdata(){
695+ _arguments -s : \
696+ '--format=-[specifies the output serialization format for fixtures.]:format:(json yaml xml)' \
697+ '--indent=-[specifies the indent level to use when pretty-printing output.]:' \
698+ $nul_args \
699+ '*::appname:_applist' && ret=0
700+}
701+
702+_managepy-flush(){
703+ _arguments -s : \
704+ '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
705+ '--noinput[tells Django to NOT prompt the user for input of any kind.]' \
706+ $nul_args && ret=0
707+}
708+
709+_managepy-help(){
710+ _arguments -s : \
711+ '*:command:_managepy_cmds' \
712+ $nul_args && ret=0
713+}
714+
715+_managepy_cmds(){
716+ local line
717+ local -a cmd
718+ _call_program help-command ./manage.py help \
719+ |& sed -n '/^ /s/[(), ]/ /gp' \
720+ | while read -A line; do cmd=($line $cmd) done
721+ _describe -t managepy-command 'manage.py command' cmd
722+}
723+
724+_managepy-inspectdb(){
725+ _arguments -s : \
726+ $nul_args && ret=0
727+}
728+
729+_managepy-loaddata(){
730+ _arguments -s : \
731+ '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
732+ '*::file:_files' \
733+ $nul_args && ret=0
734+}
735+
736+_managepy-reset(){
737+ _arguments -s : \
738+ '--noinput[tells Django to NOT prompt the user for input of any kind.]' \
739+ '*::appname:_applist' \
740+ $nul_args && ret=0
741+}
742+
743+_managepy-runfcgi(){
744+ local state
745+
746+ local fcgi_opts
747+ fcgi_opts=(
748+ 'protocol[fcgi, scgi, ajp, ... (default fcgi)]:protocol:(fcgi scgi ajp)'
749+ 'host[hostname to listen on..]:'
750+ 'port[port to listen on.]:'
751+ 'socket[UNIX socket to listen on.]::file:_files'
752+ 'method[prefork or threaded (default prefork)]:method:(prefork threaded)'
753+ 'maxrequests[number of requests a child handles before it is killed and a new child is forked (0 = no limit).]:'
754+ 'maxspare[max number of spare processes / threads.]:'
755+ 'minspare[min number of spare processes / threads.]:'
756+ 'maxchildren[hard limit number of processes / threads.]:'
757+ 'daemonize[whether to detach from terminal.]:boolean:(False True)'
758+ 'pidfile[write the spawned process-id to this file.]:file:_files'
759+ 'workdir[change to this directory when daemonizing.]:directory:_files'
760+ 'outlog[write stdout to this file.]:file:_files'
761diff --git a/plugins/extract/_extract b/plugins/extract/_extract
762new file mode 100644
763index 0000000000000000000000000000000000000000..dca890954aaad3e36543d18b6fc8b04c090cfc7d
764--- /dev/null
765+++ b/plugins/extract/_extract
766@@ -0,0 +1,8 @@
767+#compdef extract
768+#autoload
769+
770+_arguments \
771+ '(-r --remove)'{-r,--remove}'[Remove archive.]' \
772+ "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z|deb)(-.)'" && return 0
773+
774+
775diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh
776new file mode 100644
777index 0000000000000000000000000000000000000000..8cc17f7d4be725da84afaf018cb8343e3048ad5d
778--- /dev/null
779+++ b/plugins/extract/extract.plugin.zsh
780@@ -0,0 +1,85 @@
781+# ------------------------------------------------------------------------------
782+# FILE: extract.plugin.zsh
783+# DESCRIPTION: oh-my-zsh plugin file.
784+# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
785+# VERSION: 1.0.1
786+# ------------------------------------------------------------------------------
787+
788+
789+function extract() {
790+ local remove_archive
791+ local success
792+ local file_name
793+ local extract_dir
794+
795+ if (( $# == 0 )); then
796+ echo "Usage: extract [-option] [file ...]"
797+ echo
798+ echo Options:
799+ echo " -r, --remove Remove archive."
800+ echo
801+ echo "Report bugs to <sorin.ionescu@gmail.com>."
802+ fi
803+
804+ remove_archive=1
805+ if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then
806+ remove_archive=0
807+ shift
808+ fi
809+
810+ while (( $# > 0 )); do
811+ if [[ ! -f "$1" ]]; then
812+ echo "extract: '$1' is not a valid file" 1>&2
813+ shift
814+ continue
815+ fi
816+
817+ success=0
818+ file_name="$( basename "$1" )"
819+ extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )"
820+ case "$1" in
821+ (*.tar.gz|*.tgz) tar xvzf "$1" ;;
822+ (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
823+ (*.tar.xz|*.txz) tar --xz --help &> /dev/null \
824+ && tar --xz -xvf "$1" \
825+ || xzcat "$1" | tar xvf - ;;
826+ (*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \
827+ && tar --lzma -xvf "$1" \
828+ || lzcat "$1" | tar xvf - ;;
829+ (*.tar) tar xvf "$1" ;;
830+ (*.gz) gunzip "$1" ;;
831+ (*.bz2) bunzip2 "$1" ;;
832+ (*.xz) unxz "$1" ;;
833+ (*.lzma) unlzma "$1" ;;
834+ (*.Z) uncompress "$1" ;;
835+ (*.zip) unzip "$1" -d $extract_dir ;;
836+ (*.rar) unrar e -ad "$1" ;;
837+ (*.7z) 7za x "$1" ;;
838+ (*.deb)
839+ mkdir -p "$extract_dir/control"
840+ mkdir -p "$extract_dir/data"
841+ cd "$extract_dir"; ar vx "../${1}" > /dev/null
842+ cd control; tar xzvf ../control.tar.gz
843+ cd ../data; tar xzvf ../data.tar.gz
844+ cd ..; rm *.tar.gz debian-binary
845+ cd ..
846+ ;;
847+ (*)
848+ echo "extract: '$1' cannot be extracted" 1>&2
849+ success=1
850+ ;;
851+ esac
852+
853+ (( success = $success > 0 ? $success : $? ))
854+ (( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
855+ shift
856+ done
857+}
858+
859+alias x=extract
860+
861+# add extract completion function to path
862+fpath=($ZSH/plugins/extract $fpath)
863+autoload -U compinit
864+compinit -i
865+
866diff --git a/plugins/gas/_gas b/plugins/gas/_gas
867new file mode 100644
868index 0000000000000000000000000000000000000000..befdc94598df69bba47201e6933829b4fb39fbce
869--- /dev/null
870+++ b/plugins/gas/_gas
871@@ -0,0 +1,34 @@
872+#compdef gas
873+
874+local curcontext="$curcontext" state line cmds ret=1
875+
876+_arguments -C \
877+ '(- 1 *)'{-v,--version}'[display version information]' \
878+ '(-h|--help)'{-h,--help}'[show help information]' \
879+ '1: :->cmds' \
880+ '*: :->args' && ret=0
881+
882+case $state in
883+ cmds)
884+ cmds=(
885+ "version:Prints Gas's version"
886+ "use:Uses author"
887+ "show:Shows your current user"
888+ "list:Lists your authors"
889+ "import:Imports current user to gasconfig"
890+ "help:Describe available tasks or one specific task"
891+ "delete:Deletes author"
892+ "add:Adds author to gasconfig"
893+ )
894+ _describe -t commands 'gas command' cmds && ret=0
895+ ;;
896+ args)
897+ case $line[1] in
898+ (use|delete)
899+ _values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0
900+ ;;
901+ esac
902+ ;;
903+esac
904+
905+return ret
906diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
907index bc340e86b3b654518649e6c7fc62d822bd96786a..4fcf9425d408a7a40996f8ff8d5e189a155044af 100644
908--- a/plugins/git/git.plugin.zsh
909+++ b/plugins/git/git.plugin.zsh
910@@ -27,11 +27,19 @@ alias gcp='git cherry-pick'
911 compdef _git gcp=git-cherry-pick
912 alias glg='git log --stat --max-count=5'
913 compdef _git glg=git-log
914+alias glgg='git log --graph --max-count=5'
915+compdef _git glgg=git-log
916+alias gss='git status -s'
917+compdef _git gss=git-status
918+alias ga='git add'
919+compdef _git ga=git-add
920
921 # Git and svn mix
922 alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
923 compdef git-svn-dcommit-push=git
924
925+alias gsr='git svn rebase'
926+alias gsd='git svn dcommit'
927 #
928 # Will return the current branch name
929 # Usage example: git pull origin $(current_branch)
930diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh
931index df7053ba7c897eff67982911cc754a62eb3970e3..1eb3381136818b82b1915cb5113d1877fc0907a5 100644
932--- a/plugins/github/github.plugin.zsh
933+++ b/plugins/github/github.plugin.zsh
934@@ -4,4 +4,3 @@ if [ "$commands[(I)hub]" ]; then
935 # eval `hub alias -s zsh`
936 function git(){hub "$@"}
937 fi
938-
939diff --git a/plugins/gpg-agent/gpg-agent.plugin.zsh b/plugins/gpg-agent/gpg-agent.plugin.zsh
940new file mode 100644
941index 0000000000000000000000000000000000000000..8cc71fd57692de243e8a497786d1e1f8eb0b2bba
942--- /dev/null
943+++ b/plugins/gpg-agent/gpg-agent.plugin.zsh
944@@ -0,0 +1,26 @@
945+# Based on ssh-agent code
946+
947+local GPG_ENV=$HOME/.gnupg/gpg-agent.env
948+
949+function start_agent {
950+ /usr/bin/env gpg-agent --daemon --enable-ssh-support --write-env-file ${GPG_ENV} > /dev/null
951+ chmod 600 ${GPG_ENV}
952+ . ${GPG_ENV} > /dev/null
953+}
954+
955+# Source GPG agent settings, if applicable
956+if [ -f "${GPG_ENV}" ]; then
957+ . ${GPG_ENV} > /dev/null
958+ ps -ef | grep ${SSH_AGENT_PID} | grep gpg-agent > /dev/null || {
959+ start_agent;
960+ }
961+else
962+ start_agent;
963+fi
964+
965+export GPG_AGENT_INFO
966+export SSH_AUTH_SOCK
967+export SSH_AGENT_PID
968+
969+GPG_TTY=$(tty)
970+export GPG_TTY
971diff --git a/plugins/heroku/_heroku b/plugins/heroku/_heroku
972new file mode 100644
973index 0000000000000000000000000000000000000000..dc899e2b2a3e07b6d36501b4b1b6f4f6211302db
974--- /dev/null
975+++ b/plugins/heroku/_heroku
976@@ -0,0 +1,158 @@
977+#compdef heroku
978+
979+# Heroku Autocomplete plugin for Oh-My-Zsh
980+# Requires: The Heroku client gem (https://github.com/heroku/heroku)
981+# Author: Ali B. (http://awhitebox.com)
982+
983+local -a _1st_arguments
984+_1st_arguments=(
985+ "account\:confirm_billing":"Confirm that your account can be billed at the end of the month"
986+ "addons":"list installed addons"
987+ "addons\:list":"list all available addons"
988+ "addons\:add":"install an addon"
989+ "addons\:upgrade":"upgrade an existing addon"
990+ "addons\:downgrade":"downgrade an existing addon"
991+ "addons\:remove":"uninstall an addon"
992+ "addons\:open":"open an addon's dashboard in your browser"
993+ "apps":"list your apps"
994+ "apps\:info":"show detailed app information"
995+ "apps\:create":"create a new app"
996+ "apps\:rename":"rename the app"
997+ "apps\:open":"open the app in a web browser"
998+ "apps\:destroy":"permanently destroy an app"
999+ "auth\:login":"log in with your heroku credentials"
1000+ "auth\:logout":"clear local authentication credentials"
1001+ "config":"display the config vars for an app"
1002+ "config\:add":"add one or more config vars"
1003+ "config\:remove":"remove a config var"
1004+ "db\:push":"push local data up to your app"
1005+ "db\:pull":"pull heroku data down into your local database"
1006+ "domains":"list custom domains for an app"
1007+ "domains\:add":"add a custom domain to an app"
1008+ "domains\:remove":"remove a custom domain from an app"
1009+ "domains\:clear":"remove all custom domains from an app"
1010+ "help":"list available commands or display help for a specific command"
1011+ "keys":"display keys for the current user"
1012+ "keys\:add":"add a key for the current user"
1013+ "keys\:remove":"remove a key from the current user"
1014+ "keys\:clear":"remove all authentication keys from the current user"
1015+ "logs":"display recent log output"
1016+ "logs\:cron":"DEPRECATED: display cron logs from legacy logging"
1017+ "logs\:drains":"manage syslog drains"
1018+ "maintenance\:on":"put the app into maintenance mode"
1019+ "maintenance\:off":"take the app out of maintenance mode"
1020+ "pg\:info":"display database information"
1021+ "pg\:ingress":"allow direct connections to the database from this IP for one minute"
1022+ "pg\:promote":"sets DATABASE as your DATABASE_URL"
1023+ "pg\:psql":"open a psql shell to the database"
1024+ "pg\:reset":"delete all data in DATABASE"
1025+ "pg\:unfollow":"stop a replica from following and make it a read/write database"
1026+ "pg\:wait":"monitor database creation, exit when complete"
1027+ "pgbackups":"list captured backups"
1028+ "pgbackups\:url":"get a temporary URL for a backup"
1029+ "pgbackups\:capture":"capture a backup from a database id"
1030+ "pgbackups\:restore":"restore a backup to a database"
1031+ "pgbackups\:destroy":"destroys a backup"
1032+ "plugins":"list installed plugins"
1033+ "plugins\:install":"install a plugin"
1034+ "plugins\:uninstall":"uninstall a plugin"
1035+ "ps\:dynos":"scale to QTY web processes"
1036+ "ps\:workers":"scale to QTY background processes"
1037+ "ps":"list processes for an app"
1038+ "ps\:restart":"restart an app process"
1039+ "ps\:scale":"scale processes by the given amount"
1040+ "releases":"list releases"
1041+ "releases\:info":"view detailed information for a release"
1042+ "rollback":"roll back to an older release"
1043+ "run":"run an attached process"
1044+ "run\:rake":"remotely execute a rake command"
1045+ "run\:console":"open a remote console session"
1046+ "sharing":"list collaborators on an app"
1047+ "sharing\:add":"add a collaborator to an app"
1048+ "sharing\:remove":"remove a collaborator from an app"
1049+ "sharing\:transfer":"transfer an app to a new owner"
1050+ "ssl":"list certificates for an app"
1051+ "ssl\:add":"add an ssl certificate to an app"
1052+ "ssl\:remove":"remove an ssl certificate from an app"
1053+ "ssl\:clear":"remove all ssl certificates from an app"
1054+ "stack":"show the list of available stacks"
1055+ "stack\:migrate":"prepare migration of this app to a new stack"
1056+ "version":"show heroku client version"
1057+)
1058+
1059+_arguments '*:: :->command'
1060+
1061+if (( CURRENT == 1 )); then
1062+ _describe -t commands "heroku command" _1st_arguments
1063+ return
1064+fi
1065+
1066+local -a _command_args
1067+case "$words[1]" in
1068+ apps:info)
1069+ _command_args=(
1070+ '(-r|--raw)'{-r,--raw}'[output info as raw key/value pairs]' \
1071+ )
1072+ ;;
1073+ apps:create)
1074+ _command_args=(
1075+ '(-a|--addons)'{-a,--addons}'[a list of addons to install]' \
1076diff --git a/plugins/history-substring-search/README b/plugins/history-substring-search/README
1077new file mode 100644
1078index 0000000000000000000000000000000000000000..be11adf76b54ce2e7f8dc4ad14c61c1c3a62ad28
1079--- /dev/null
1080+++ b/plugins/history-substring-search/README
1081@@ -0,0 +1,7 @@
1082+To activate this script, load it into an interactive ZSH session:
1083+
1084+ % source history-substring-search.zsh
1085+
1086+See the "history-substring-search.zsh" file for more information:
1087+
1088+ % sed -n '2,/^$/s/^#//p' history-substring-search.zsh | more
1089diff --git a/plugins/history-substring-search/history-substring-search.plugin.zsh b/plugins/history-substring-search/history-substring-search.plugin.zsh
1090new file mode 100644
1091index 0000000000000000000000000000000000000000..99a5922c5faa3d3130578e119e18a4d7ad6eac55
1092--- /dev/null
1093+++ b/plugins/history-substring-search/history-substring-search.plugin.zsh
1094@@ -0,0 +1,12 @@
1095+# This file integrates the history-substring-search script into oh-my-zsh.
1096+
1097+source "$ZSH/plugins/history-substring-search/history-substring-search.zsh"
1098+
1099+if test "$CASE_SENSITIVE" = true; then
1100+ unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS
1101+fi
1102+
1103+if test "$DISABLE_COLOR" = true; then
1104+ unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
1105+ unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
1106+fi
1107diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh
1108new file mode 100644
1109index 0000000000000000000000000000000000000000..53f707c79c11c72931fcae67eeb6931b29cbade0
1110--- /dev/null
1111+++ b/plugins/history-substring-search/history-substring-search.zsh
1112@@ -0,0 +1,642 @@
1113+#!/usr/bin/env zsh
1114+#
1115+# This is a clean-room implementation of the Fish[1] shell's history search
1116+# feature, where you can type in any part of any previously entered command
1117+# and press the UP and DOWN arrow keys to cycle through the matching commands.
1118+#
1119+#-----------------------------------------------------------------------------
1120+# Usage
1121+#-----------------------------------------------------------------------------
1122+#
1123+# 1. Load this script into your interactive ZSH session:
1124+#
1125+# % source history-substring-search.zsh
1126+#
1127+# If you want to use the zsh-syntax-highlighting[6] script along with this
1128+# script, then make sure that you load it *before* you load this script:
1129+#
1130+# % source zsh-syntax-highlighting.zsh
1131+# % source history-substring-search.zsh
1132+#
1133+# 2. Type any part of any previous command and then:
1134+#
1135+# * Press the UP arrow key to select the nearest command that (1) contains
1136+# your query and (2) is older than the current command in the command
1137+# history.
1138+#
1139+# * Press the DOWN arrow key to select the nearest command that (1)
1140+# contains your query and (2) is newer than the current command in the
1141+# command history.
1142+#
1143+# * Press ^U (the Control and U keys simultaneously) to abort the search.
1144+#
1145+# 3. If a matching command spans more than one line of text, press the LEFT
1146+# arrow key to move the cursor away from the end of the command, and then:
1147+#
1148+# * Press the UP arrow key to move the cursor to the line above. When the
1149+# cursor reaches the first line of the command, pressing the UP arrow
1150+# key again will cause this script to perform another search.
1151+#
1152+# * Press the DOWN arrow key to move the cursor to the line below. When
1153+# the cursor reaches the last line of the command, pressing the DOWN
1154+# arrow key again will cause this script to perform another search.
1155+#
1156+#-----------------------------------------------------------------------------
1157+# Configuration
1158+#-----------------------------------------------------------------------------
1159+#
1160+# This script defines the following global variables. You may override their
1161+# default values only after having loaded this script into your ZSH session.
1162+#
1163+# * HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND is a global variable that defines
1164+# how the query should be highlighted inside a matching command. Its default
1165+# value causes this script to highlight using bold, white text on a magenta
1166+# background. See the "Character Highlighting" section in the zshzle(1) man
1167+# page to learn about the kinds of values you may assign to this variable.
1168+#
1169+# * HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND is a global variable that
1170+# defines how the query should be highlighted when no commands in the
1171+# history match it. Its default value causes this script to highlight using
1172+# bold, white text on a red background. See the "Character Highlighting"
1173+# section in the zshzle(1) man page to learn about the kinds of values you
1174+# may assign to this variable.
1175+#
1176+# * HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS is a global variable that defines
1177+# how the command history will be searched for your query. Its default value
1178+# causes this script to perform a case-insensitive search. See the "Globbing
1179+# Flags" section in the zshexpn(1) man page to learn about the kinds of
1180+# values you may assign to this variable.
1181+#
1182+#-----------------------------------------------------------------------------
1183+# History
1184+#-----------------------------------------------------------------------------
1185+#
1186+# This script was originally written by Peter Stephenson[2], who published it
1187+# to the ZSH users mailing list (thereby making it public domain) in September
1188+# 2009. It was later revised by Guido van Steen and released under the BSD
1189+# license (see below) as part of the fizsh[3] project in January 2011.
1190+#
1191+# It was later extracted from fizsh[3] release 1.0.1, refactored heavily, and
1192+# repackaged as both an oh-my-zsh plugin[4] and as an independently loadable
1193+# ZSH script[5] by Suraj N. Kurapati in 2011.
1194+#
1195+# It was further developed[4] by Guido van Steen, Suraj N. Kurapati, Sorin
1196+# Ionescu, and Vincent Guerci in 2011.
1197+#
1198+# [1]: http://fishshell.com
1199+# [2]: http://www.zsh.org/mla/users/2009/msg00818.html
1200+# [3]: http://sourceforge.net/projects/fizsh/
1201+# [4]: https://github.com/robbyrussell/oh-my-zsh/pull/215
1202+# [5]: https://github.com/sunaku/zsh-history-substring-search
1203+# [6]: https://github.com/nicoulaj/zsh-syntax-highlighting
1204+#
1205+##############################################################################
1206+#
1207+# Copyright (c) 2009 Peter Stephenson
1208+# Copyright (c) 2011 Guido van Steen
1209+# Copyright (c) 2011 Suraj N. Kurapati
1210+# Copyright (c) 2011 Sorin Ionescu
1211+# Copyright (c) 2011 Vincent Guerci
1212diff --git a/plugins/kate/kate.plugin.zsh b/plugins/kate/kate.plugin.zsh
1213new file mode 100644
1214index 0000000000000000000000000000000000000000..eb16522acafa12576aa2bcddac5d7b6b5448443c
1215--- /dev/null
1216+++ b/plugins/kate/kate.plugin.zsh
1217@@ -0,0 +1,9 @@
1218+
1219+# Kate
1220+# Start kate always silent
1221+alias kate='kate >/dev/null 2>&1'
1222+
1223+function kt () {
1224+ cd $1
1225+ kate $1
1226+}
1227diff --git a/plugins/knife/_knife b/plugins/knife/_knife
1228new file mode 100644
1229index 0000000000000000000000000000000000000000..7f8c95ee5a470810785cb719828371a5e7463e6c
1230--- /dev/null
1231+++ b/plugins/knife/_knife
1232@@ -0,0 +1,174 @@
1233+#compdef knife
1234+
1235+# These flags should be available everywhere according to man knife
1236+knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes )
1237+
1238+# knife has a very special syntax, some example calls are:
1239+# knife status
1240+# knife cookbook list
1241+# knife role show ROLENAME
1242+# knife data bag show DATABAGNAME
1243+# knife role show ROLENAME --attribute ATTRIBUTENAME
1244+# knife cookbook show COOKBOOKNAME COOKBOOKVERSION recipes
1245+
1246+# The -Q switch in compadd allow for completions of things like "data bag" without having to go through two rounds of completion and avoids zsh inserting a \ for escaping spaces
1247+_knife() {
1248+ local curcontext="$curcontext" state line
1249+ typeset -A opt_args
1250+ cloudproviders=(bluebox ec2 rackspace slicehost terremark)
1251+ _arguments \
1252+ '1: :->knifecmd'\
1253+ '2: :->knifesubcmd'\
1254+ '3: :->knifesubcmd2' \
1255+ '4: :->knifesubcmd3' \
1256+ '5: :->knifesubcmd4' \
1257+ '6: :->knifesubcmd5'
1258+
1259+ case $state in
1260+ knifecmd)
1261+ compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec index node recipe role search ssh status windows $cloudproviders
1262+ ;;
1263+ knifesubcmd)
1264+ case $words[2] in
1265+ (bluebox|ec2|rackspace|slicehost|terremark)
1266+ compadd "$@" server images
1267+ ;;
1268+ client)
1269+ compadd -Q "$@" "bulk delete" list create show delete edit reregister
1270+ ;;
1271+ configure)
1272+ compadd "$@" client
1273+ ;;
1274+ cookbook)
1275+ compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload
1276+ ;;
1277+ node)
1278+ compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete"
1279+ ;;
1280+ recipe)
1281+ compadd "$@" list
1282+ ;;
1283+ role)
1284+ compadd -Q "$@" "bulk delete" create delete edit "from file" list show
1285+ ;;
1286+ windows)
1287+ compadd "$@" bootstrap
1288+ ;;
1289+ *)
1290+ _arguments '2:Subsubcommands:($(_knife_options1))'
1291+ esac
1292+ ;;
1293+ knifesubcmd2)
1294+ case $words[3] in
1295+ server)
1296+ compadd "$@" list create delete
1297+ ;;
1298+ images)
1299+ compadd "$@" list
1300+ ;;
1301+ site)
1302+ compadd "$@" vendor show share search download list unshare
1303+ ;;
1304+ (show|delete|edit)
1305+ _arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))'
1306+ ;;
1307+ (upload|test)
1308+ _arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)'
1309+ ;;
1310+ list)
1311+ compadd -a "$@" knife_general_flags
1312+ ;;
1313+ bag)
1314+ compadd -Q "$@" show edit list "from file" create delete
1315+ ;;
1316+ *)
1317+ _arguments '3:Subsubcommands:($(_knife_options2))'
1318+ esac
1319+ ;;
1320+ knifesubcmd3)
1321+ case $words[3] in
1322+ show)
1323+ case $words[2] in
1324+ cookbook)
1325+ versioncomp=1
1326+ _arguments '4:Cookbookversions:($(_cookbook_versions) latest)'
1327+ ;;
1328+ (node|client|role)
1329+ compadd "$@" --attribute
1330+ esac
1331+ esac
1332diff --git a/plugins/lol/lol.plugin.zsh b/plugins/lol/lol.plugin.zsh
1333index a7153bb570d559fc4cdabb7f88c9aba2db2d94a4..e455527e7617fb356c9e73dc5271f7c75bb71ff6 100644
1334--- a/plugins/lol/lol.plugin.zsh
1335+++ b/plugins/lol/lol.plugin.zsh
1336@@ -8,19 +8,30 @@ alias rtfm='man'
1337 alias visible='echo'
1338 alias invisible='cat'
1339 alias moar='more'
1340+alias tldr='less'
1341+alias alwayz='tail -f'
1342
1343 alias icanhas='mkdir'
1344+alias gimmeh='touch'
1345 alias donotwant='rm'
1346 alias dowant='cp'
1347 alias gtfo='mv'
1348+alias nowai='chmod'
1349
1350 alias hai='cd'
1351+alias iz='ls'
1352 alias plz='pwd'
1353+alias ihasbucket='df -h'
1354
1355 alias inur='locate'
1356+alias iminurbase='finger'
1357+
1358+alias btw='nice'
1359+alias obtw='nohup'
1360
1361 alias nomz='ps -aux'
1362 alias nomnom='killall'
1363
1364+alias byes='exit'
1365 alias cya='reboot'
1366 alias kthxbai='halt'
1367diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh
1368new file mode 100644
1369index 0000000000000000000000000000000000000000..519bc18da425f86f2a5fd433cad5075d79a1075a
1370--- /dev/null
1371+++ b/plugins/node/node.plugin.zsh
1372@@ -0,0 +1,5 @@
1373+# Open the node api for your current version to the optional section.
1374+# TODO: Make the section part easier to use.
1375+function node-docs {
1376+ open "http://nodejs.org/docs/$(node --version)/api/all.html#$1"
1377+}
1378diff --git a/plugins/osx/_man-preview b/plugins/osx/_man-preview
1379new file mode 100644
1380index 0000000000000000000000000000000000000000..6cc344ad4609fe125fd510a60219c7ed82b10faa
1381--- /dev/null
1382+++ b/plugins/osx/_man-preview
1383@@ -0,0 +1,5 @@
1384+#compdef man-preview
1385+#autoload
1386+
1387+_man
1388+
1389diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
1390index 81eed5e92af372466fc02bb682a9d5a8b26091e8..682bb2667bc2cec79c6edd5870d4d42c871844f2 100644
1391--- a/plugins/osx/osx.plugin.zsh
1392+++ b/plugins/osx/osx.plugin.zsh
1393@@ -1,57 +1,99 @@
1394-function savepath() {
1395- pwd > ~/.current_path~
1396-}
1397+# ------------------------------------------------------------------------------
1398+# FILE: osx.plugin.zsh
1399+# DESCRIPTION: oh-my-zsh plugin file.
1400+# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
1401+# VERSION: 1.0.1
1402+# ------------------------------------------------------------------------------
1403+
1404
1405 function tab() {
1406-savepath
1407-osascript >/dev/null <<EOF
1408-on do_submenu(app_name, menu_name, menu_item, submenu_item)
1409- -- bring the target application to the front
1410- tell application app_name
1411- activate
1412- end tell
1413- tell application "System Events"
1414- tell process app_name
1415- tell menu bar 1
1416- tell menu bar item menu_name
1417- tell menu menu_name
1418- tell menu item menu_item
1419- tell menu menu_item
1420- click menu item submenu_item
1421- end tell
1422- end tell
1423- end tell
1424- end tell
1425- end tell
1426+ local command="cd \\\"$PWD\\\""
1427+ (( $# > 0 )) && command="${command}; $*"
1428+
1429+ the_app=$(
1430+ osascript 2>/dev/null <<EOF
1431+ tell application "System Events"
1432+ name of first item of (every process whose frontmost is true)
1433 end tell
1434- end tell
1435-end do_submenu
1436+EOF
1437+ )
1438
1439-do_submenu("Terminal", "Shell", "New Tab", 1)
1440+ [[ "$the_app" == 'Terminal' ]] && {
1441+ osascript 2>/dev/null <<EOF
1442+ tell application "System Events"
1443+ tell process "Terminal" to keystroke "t" using command down
1444+ tell application "Terminal" to do script "${command}" in front window
1445+ end tell
1446 EOF
1447-}
1448+ }
1449
1450-function itab() {
1451-savepath
1452-osascript >/dev/null <<EOF
1453-on do_submenu(app_name, menu_name, menu_item)
1454- -- bring the target application to the front
1455- tell application app_name
1456- activate
1457- end tell
1458- tell application "System Events"
1459- tell process app_name
1460- tell menu bar 1
1461- tell menu bar item menu_name
1462- tell menu menu_name
1463- click menu item menu_item
1464- end tell
1465+ [[ "$the_app" == 'iTerm' ]] && {
1466+ osascript 2>/dev/null <<EOF
1467+ tell application "iTerm"
1468+ set current_terminal to current terminal
1469+ tell current_terminal
1470+ launch session "Default Session"
1471+ set current_session to current session
1472+ tell current_session
1473+ write text "${command}"
1474 end tell
1475 end tell
1476 end tell
1477+EOF
1478+ }
1479+}
1480+
1481+function pfd() {
1482+ osascript 2>/dev/null <<EOF
1483+ tell application "Finder"
1484+ return POSIX path of (target of window 1 as alias)
1485 end tell
1486-end do_submenu
1487+EOF
1488+}
1489
1490-do_submenu("iTerm", "Shell", "New Tab")
1491+function pfs() {
1492+ osascript 2>/dev/null <<EOF
1493diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/phing.plugin.zsh
1494index 80e33462952f42d6533b09583b5dfb00fefda1c0..8f4adca08720ffdffc8ca258637d399dcdef8e37 100644
1495--- a/plugins/phing/phing.plugin.zsh
1496+++ b/plugins/phing/phing.plugin.zsh
1497@@ -10,7 +10,6 @@ _phing_does_target_list_need_generating () {
1498 _phing () {
1499 if [ -f build.xml ]; then
1500 if _phing_does_target_list_need_generating; then
1501- echo "\nGenerating .phing_targets..." > /dev/stderr
1502 phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets
1503 fi
1504 compadd `cat .phing_targets`
1505diff --git a/plugins/pow/pow.plugin.zsh b/plugins/pow/pow.plugin.zsh
1506new file mode 100644
1507index 0000000000000000000000000000000000000000..6b2a6f2be0f3636c9026eb82a0405eebc79669b4
1508--- /dev/null
1509+++ b/plugins/pow/pow.plugin.zsh
1510@@ -0,0 +1,10 @@
1511+# Thanks to Christopher Sexton
1512+# https://gist.github.com/965032
1513+function kapow {
1514+ touch ~/.pow/$1/tmp/restart.txt
1515+ if [ $? -eq 0 ]; then
1516+ echo "$fg[yellow]Pow restarting $1...$reset_color"
1517+ fi
1518+}
1519+
1520+compctl -W ~/.pow -/ kapow
1521diff --git a/plugins/powder/_powder b/plugins/powder/_powder
1522new file mode 100644
1523index 0000000000000000000000000000000000000000..84e260a157153c77f62dda75fd3df88518a56d5d
1524--- /dev/null
1525+++ b/plugins/powder/_powder
1526@@ -0,0 +1,4 @@
1527+#compdef powder
1528+#autoload
1529+
1530+compadd `powder help | grep powder | cut -d " " -f 4`
1531diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh
1532index f669ef047c74e687edd446649f9d74e0c6eed87d..f4ee637e6b45522afdee404804b12edf0f1e992e 100644
1533--- a/plugins/rails3/rails3.plugin.zsh
1534+++ b/plugins/rails3/rails3.plugin.zsh
1535@@ -1,13 +1,5 @@
1536 # Rails 3 aliases, backwards-compatible with Rails 2.
1537
1538-function _bundle_command {
1539- if command -v bundle && [ -e "Gemfile" ]; then
1540- bundle exec $@
1541- else
1542- $@
1543- fi
1544-}
1545-
1546 function _rails_command () {
1547 if [ -e "script/server" ]; then
1548 ruby script/$@
1549@@ -25,6 +17,3 @@ alias rp='_rails_command plugin'
1550 alias rs='_rails_command server'
1551 alias rsd='_rails_command server --debugger'
1552 alias devlog='tail -f log/development.log'
1553-
1554-alias rspec='_bundle_command rspec'
1555-alias cuke='_bundle_command cucumber'
1556diff --git a/plugins/redis-cli/_redis-cli b/plugins/redis-cli/_redis-cli
1557index 3789add182d2dd0283cf54ccece4f59a04513ac1..1569f29166c5fcff8264bba14785549bdb6a4884 100644
1558--- a/plugins/redis-cli/_redis-cli
1559+++ b/plugins/redis-cli/_redis-cli
1560@@ -51,7 +51,7 @@ _1st_arguments=(
1561 'keys:find all keys matching the given pattern'
1562 'lastsave:get the UNIX timestamp of the last successful save to disk'
1563 'lindex:get an element from a list by its index'
1564- 'linset:insert an element before or after another element in a list'
1565+ 'linsert:insert an element before or after another element in a list'
1566 'llen:get the length of a list'
1567 'lpop:remove and get the first element in a list'
1568 'lpush:prepend a value to a list'
1569diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh
1570index 82bf5d49d4420c398520709236a38291b4459cb9..08ca9c60178faf69bb92b4bcd1a5fd66b31f49eb 100644
1571--- a/plugins/ruby/ruby.plugin.zsh
1572+++ b/plugins/ruby/ruby.plugin.zsh
1573@@ -1,4 +1,6 @@
1574+# TODO: Make this compatible with rvm.
1575+# Run sudo gem on the system ruby, not the active ruby.
1576 alias sgem='sudo gem'
1577
1578 # Find ruby file
1579-alias rfind='find . -name *.rb | xargs grep -n'
1580+alias rfind='find . -name *.rb | xargs grep -n'
1581diff --git a/plugins/rvm/_rvm b/plugins/rvm/_rvm
1582new file mode 100644
1583index 0000000000000000000000000000000000000000..bba5304a032647ca5ce34165b2ac71ceff2db5f8
1584--- /dev/null
1585+++ b/plugins/rvm/_rvm
1586@@ -0,0 +1,147 @@
1587+#compdef rvm
1588+
1589+local curcontext="$curcontext" state line cmds ret=1
1590+
1591+_arguments -C \
1592+ '(- 1 *)'{-v,--version}'[display version information]' \
1593+ '(-l|--level)'{-l,--level}'+[patch level to use with rvm use / install]:number' \
1594+ '(--prefix)--prefix[path for all rvm files (~/.rvm/), with trailing slash!]:path:_files' \
1595+ '(--bin)--bin[path for binaries to be placed (~/.rvm/bin/)]:path:_files' \
1596+ '(--source)--source[src directory to use (~/.rvm/src/)]:path:_files' \
1597+ '(--archives)--archives[directory for downladed files (~/.rvm/archives/)]:path:_files' \
1598+ '-S[Specify a script file to attempt to load and run (rubydo)]:file:_files' \
1599+ '-e[Execute code from the command line]:code' \
1600+ '(-G)-G[root gem path to use]:path:_files' \
1601+ '(--gems)--gems[Used to set the gems_flag, use with remove to remove gems]' \
1602+ '(--archive)--archive[Used to set the archive_flag, use with remove to remove archive]' \
1603+ '(--patch)--patch[With MRI Rubies you may specify one or more full paths to patches]' \
1604+ '(-C|--configure)'{-C,--configure}'=[custom configure options]' \
1605+ '(--nice)--nice[process niceness (for slow computers, default 0)]:number' \
1606+ '(--ree)--ree-options[Options passed directly to ree ./installer on the command line]:options' \
1607+ '(--head)--head[with update, updates rvm to git head version]' \
1608+ '(--rubygems)--rubygems[with update, updates rubygems for selected ruby]' \
1609+ '(--default)--default[with ruby select, sets a default ruby for new shells]' \
1610+ '(--debug)--debug[Toggle debug mode on for very verbose output]' \
1611+ '(--trace)--trace[Toggle trace mode on to see EVERYTHING rvm is doing]' \
1612+ '(--force)--force[Force install, removes old install & source before install]' \
1613+ '(--summary)--summary[Used with rubydo to print out a summary of the commands run]' \
1614+ '(--latest)--latest[with gemset --dump skips version strings for latest gem]' \
1615+ '(--gems)--gems[with uninstall/remove removes gems with the interpreter]' \
1616+ '(--docs)--docs[with install, attempt to generate ri after installation]' \
1617+ '(--reconfigure)--reconfigure[Force ./configure on install even if Makefile already exists]' \
1618+ '1: :->cmds' \
1619+ '*: :->args' && ret=0
1620+
1621+case $state in
1622+ cmds)
1623+ cmds=(
1624+ "version:show the rvm version installed in rvm_path"
1625+ "use:setup current shell to use a specific ruby version"
1626+ "reload:reload rvm source itself (useful after changing rvm source)"
1627+ "implode:(seppuku) removes the rvm installation completely. This means everything in $rvm_path (~/.rvm)."
1628+ "update:upgrades rvm to the latest version."
1629+ "reset:remove current and stored default & system settings."
1630+ "info :show the *current* environment information for current ruby"
1631+ "current:print the *current* ruby version and the name of any gemset being used."
1632+ "debug:show info plus additional information for common issues"
1633+ "install:install one or many ruby versions"
1634+ "uninstall:uninstall one or many ruby versions, leaves their sources"
1635+ "remove:uninstall one or many ruby versions and remove their sources"
1636+ "migrate:Lets you migrate all gemsets from one ruby to another."
1637+ "upgrade:Lets you upgrade from one version of a ruby to another, including migrating your gemsets semi-automatically."
1638+ "wrapper:generates a set of wrapper executables for a given ruby with the specified ruby and gemset combination. Used under the hood for passenger support and the like."
1639+ "cleanup:Lets you remove stale source folders / archives and other miscellaneous data associated with rvm."
1640+ "repair:Lets you repair parts of your environment e.g. wrappers, env files and and similar files (e.g. general maintenance)."
1641+ "snapshot:Lets your backup / restore an rvm installation in a lightweight manner."
1642+ "disk-usage:Tells you how much disk space rvm install is using."
1643+ "tools:Provides general information about the ruby environment, primarily useful when scripting rvm."
1644+ "docs:Tools to make installing ri and rdoc documentation easier."
1645+ "rvmrc:Tools related to managing rvmrc trust and loading."
1646+ "exec:runs an arbitrary command as a set operation."
1647+ "ruby:runs a named ruby file against specified and/or all rubies"
1648+ "gem:runs a gem command using selected ruby's 'gem'"
1649+ "rake:runs a rake task against specified and/or all rubies"
1650+ "tests:runs 'rake test' across selected ruby versions"
1651+ "specs:runs 'rake spec' across selected ruby versions"
1652+ "monitor:Monitor cwd for testing, run rake {spec,test} on changes."
1653+ "gemset:gemsets: http://rvm.beginrescueend.com/gemsets/"
1654+ "rubygems:Switches the installed version of rubygems for the current ruby."
1655+ "gemdir:display the path to the current gem directory (GEM_HOME)."
1656+ "srcdir:display the path to rvm source directory (may be yanked)"
1657+ "fetch:Performs an archive / src fetch only of the selected ruby."
1658+ "list:show currently installed rubies, interactive output."
1659+ "package:Install a dependency package {readline,iconv,zlib,openssl}"
1660+ "notes:Display notes, with operating system specifics."
1661+ "export:Temporarily set an environment variable in the current shell."
1662+ "unexport:Undo changes made to the environment by 'rvm export'."
1663+ )
1664+ _describe -t commands 'rvm command' cmds && ret=0
1665+ ;;
1666+ args)
1667+ case $line[1] in
1668+ (use|uninstall|remove|list)
1669+ _values -S , 'rubies' $(rvm list strings | sed -e 's/ruby-\([^) ]*\)-\([^) ]*\)/ruby-\1-\2 \1-\2 \1/g') default system && ret=0
1670+ ;;
1671+ (install|fetch)
1672+ _values -S , 'rubies' $(rvm list known_strings) && ret=0
1673+ ;;
1674+ gemset)
1675+ if (( CURRENT == 3 )); then
1676+ _values 'gemset_commands' \
1677+ 'import' \
1678+ 'export' \
1679+ 'create' \
1680+ 'copy' \
1681+ 'rename' \
1682+ 'empty' \
1683+ 'delete' \
1684+ 'name' \
1685+ 'dir' \
1686diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh
1687new file mode 100644
1688index 0000000000000000000000000000000000000000..24621fe0b57e02b76d3179241ee2c78fc53934eb
1689--- /dev/null
1690+++ b/plugins/rvm/rvm.plugin.zsh
1691@@ -0,0 +1,44 @@
1692+alias rubies='rvm list rubies'
1693+alias gemsets='rvm gemset list'
1694+
1695+local ruby18='ruby-1.8.7-p334'
1696+local ruby19='ruby-1.9.2-p180'
1697+
1698+function rb18 {
1699+ if [ -z "$1" ]; then
1700+ rvm use "$ruby18"
1701+ else
1702+ rvm use "$ruby18@$1"
1703+ fi
1704+}
1705+
1706+_rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`}
1707+compdef _rb18 rb18
1708+
1709+function rb19 {
1710+ if [ -z "$1" ]; then
1711+ rvm use "$ruby19"
1712+ else
1713+ rvm use "$ruby19@$1"
1714+ fi
1715+}
1716+
1717+_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`}
1718+compdef _rb19 rb19
1719+
1720+function rvm-update {
1721+ rvm get head
1722+ rvm reload # TODO: Reload rvm completion?
1723+}
1724+
1725+# TODO: Make this usable w/o rvm.
1726+function gems {
1727+ local current_ruby=`rvm-prompt i v p`
1728+ local current_gemset=`rvm-prompt g`
1729+
1730+ gem list $@ | sed \
1731+ -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
1732+ -Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
1733+ -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
1734+ -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
1735+}
1736diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh
1737index 0efc4546f98767de768bef86e9e34169935c4c13..c4e92a1fe00403782e7eacbb0fb5009b5f65629a 100644
1738--- a/plugins/ssh-agent/ssh-agent.plugin.zsh
1739+++ b/plugins/ssh-agent/ssh-agent.plugin.zsh
1740@@ -1,23 +1,62 @@
1741-# Based on code from Joseph M. Reagle
1742-# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
1743+#
1744+# INSTRUCTIONS
1745+#
1746+# To enabled agent forwarding support add the following to
1747+# your .zshrc file:
1748+#
1749+# zstyle :omz:plugins:ssh-agent agent-forwarding on
1750+#
1751+# To load multiple identies use the identities style, For
1752+# example:
1753+#
1754+# zstyle :omz:plugins:ssh-agent id_rsa id_rsa2 id_github
1755+#
1756+#
1757+# CREDITS
1758+#
1759+# Based on code from Joseph M. Reagle
1760+# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
1761+#
1762+# Agent forwarding support based on ideas from
1763+# Florent Thoumie and Jonas Pfenniger
1764+#
1765
1766-local SSH_ENV=$HOME/.ssh/environment-$HOST
1767+local _plugin__ssh_env=$HOME/.ssh/environment-$HOST
1768+local _plugin__forwarding
1769
1770-function start_agent {
1771- /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
1772- chmod 600 ${SSH_ENV}
1773- . ${SSH_ENV} > /dev/null
1774- /usr/bin/ssh-add;
1775+function _plugin__start_agent()
1776+{
1777+ local -a identities
1778+
1779+ # start ssh-agent and setup environment
1780+ /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${_plugin__ssh_env}
1781+ chmod 600 ${_plugin__ssh_env}
1782+ . ${_plugin__ssh_env} > /dev/null
1783+
1784+ # load identies
1785+ zstyle -a :omz:plugins:ssh-agent identities identities
1786+ echo starting...
1787+ /usr/bin/ssh-add $HOME/.ssh/${^identities}
1788 }
1789
1790-# Source SSH settings, if applicable
1791+# test if agent-forwarding is enabled
1792+zstyle -b :omz:plugins:ssh-agent agent-forwarding _plugin__forwarding
1793+if [[ ${_plugin__forwarding} == "yes" && -n "$SSH_AUTH_SOCK" ]]; then
1794+ # Add a nifty symlink for screen/tmux if agent forwarding
1795+ [[ -L $SSH_AUTH_SOCK ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen
1796
1797-if [ -f "${SSH_ENV}" ]; then
1798- . ${SSH_ENV} > /dev/null
1799+elif [ -f "${_plugin__ssh_env}" ]; then
1800+ # Source SSH settings, if applicable
1801+ . ${_plugin__ssh_env} > /dev/null
1802 ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
1803- start_agent;
1804+ _plugin__start_agent;
1805 }
1806 else
1807- start_agent;
1808+ _plugin__start_agent;
1809 fi
1810
1811+# tidy up after ourselves
1812+unfunction _plugin__start_agent
1813+unset _plugin__forwarding
1814+unset _plugin__ssh_env
1815+