67b2781f6200a0dff35055eb67937a0df2be2c51
- Author
- yleo77 <ylep77@gmail.com>
- Committer
- yleo77 <ylep77@gmail.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/README.textile b/README.textile
2index 5f80674992f1bdecce282f749081a015249510c8..1916d9f4e07f65a631f7c7306b20c9ae1f739369 100644
3--- a/README.textile
4+++ b/README.textile
5@@ -72,6 +72,8 @@ To disable updates entirely, put this in your ~/.zshrc
6
7 @DISABLE_AUTO_UPDATE=true@
8
9+To upgrade directly from the command line, just run @upgrade_oh_my_zsh@
10+
11 h3. Uninstalling
12
13 If you want to uninstall it, just run @uninstall_oh_my_zsh@ from the command line and it'll remove itself and revert you to bash (or your previous zsh config).
14diff --git a/lib/aliases.zsh b/lib/aliases.zsh
15index 2b58c4faa857c6b352ec2adf8d79badb659f1821..9b3709172806220d7a012ae59292fc7e15dcd70b 100644
16--- a/lib/aliases.zsh
17+++ b/lib/aliases.zsh
18@@ -17,7 +17,7 @@ alias history='fc -l 1'
19
20 # List direcory contents
21 alias lsa='ls -lah'
22-#alias l='ls -la'
23+alias l='ls -la'
24 alias ll='ls -l'
25 alias la='ls -lA'
26 alias sl=ls # often screw this up
27diff --git a/lib/git.zsh b/lib/git.zsh
28index 96598cf5f9c6bd4e6a1c301eaee823cc87f51582..df0fcedbb939bc52c98906fb303a824c1ad00f1b 100644
29--- a/lib/git.zsh
30+++ b/lib/git.zsh
31@@ -1,7 +1,7 @@
32 # get the name of the branch we are on
33 function git_prompt_info() {
34- ref=$(git symbolic-ref HEAD 2> /dev/null) || \
35- ref=$(git rev-parse --short HEAD 2> /dev/null) || return
36+ ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
37+ ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
38 echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
39 }
40
41@@ -11,16 +11,16 @@ parse_git_dirty() {
42 local SUBMODULE_SYNTAX=''
43 local GIT_STATUS=''
44 local CLEAN_MESSAGE='nothing to commit (working directory clean)'
45- if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
46+ if [[ "$(command git config --get oh-my-zsh.hide-status)" != "1" ]]; then
47 if [[ $POST_1_7_2_GIT -gt 0 ]]; then
48 SUBMODULE_SYNTAX="--ignore-submodules=dirty"
49 fi
50- if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" != "true" ]]; then
51- GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
52+ if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
53+ GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null | tail -n1)
54 else
55- GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null | tail -n1)
56+ GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
57 fi
58- if [[ -n $(git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null) ]]; then
59+ if [[ -n $GIT_STATUS ]]; then
60 echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
61 else
62 echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
63@@ -32,10 +32,10 @@ parse_git_dirty() {
64
65 # get the difference between the local and remote branches
66 git_remote_status() {
67- remote=${$(git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
68+ remote=${$(command git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
69 if [[ -n ${remote} ]] ; then
70- ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
71- behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
72+ ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
73+ behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
74
75 if [ $ahead -eq 0 ] && [ $behind -gt 0 ]
76 then
77@@ -52,24 +52,24 @@ git_remote_status() {
78
79 # Checks if there are commits ahead from remote
80 function git_prompt_ahead() {
81- if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
82+ if $(echo "$(command git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
83 echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
84 fi
85 }
86
87 # Formats prompt string for current git commit short SHA
88 function git_prompt_short_sha() {
89- SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
90+ SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
91 }
92
93 # Formats prompt string for current git commit long SHA
94 function git_prompt_long_sha() {
95- SHA=$(git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
96+ SHA=$(command git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
97 }
98
99 # Get the status of the working tree
100 git_prompt_status() {
101- INDEX=$(git status --porcelain -b 2> /dev/null)
102+ INDEX=$(command git status --porcelain -b 2> /dev/null)
103 STATUS=""
104 if $(echo "$INDEX" | grep -E '^\?\? ' &> /dev/null); then
105 STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
106@@ -96,7 +96,7 @@ git_prompt_status() {
107 elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then
108 STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
109 fi
110- if $(git rev-parse --verify refs/stash >/dev/null 2>&1); then
111+ if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then
112 STATUS="$ZSH_THEME_GIT_PROMPT_STASHED$STATUS"
113 fi
114 if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
115@@ -121,7 +121,7 @@ function git_compare_version() {
116 local INPUT_GIT_VERSION=$1;
117 local INSTALLED_GIT_VERSION
118 INPUT_GIT_VERSION=(${(s/./)INPUT_GIT_VERSION});
119- INSTALLED_GIT_VERSION=($(git --version 2>/dev/null));
120+ INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null));
121 INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
122
123 for i in {1..3}; do
124diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
125index e3828da1435b053f6f51b5f9e80e938b83f5348a..80319e1a86966b4a763c9b6a4209607a99b7a4b1 100644
126--- a/lib/termsupport.zsh
127+++ b/lib/termsupport.zsh
128@@ -27,7 +27,9 @@ function omz_termsupport_preexec {
129 emulate -L zsh
130 setopt extended_glob
131 local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
132- title "$CMD" "%100>...>${2:gs/%/%%}%<<"
133+ local LINE="${2:gs/$/\\$}"
134+ LINE="${LINE:gs/%/%%}"
135+ title "$CMD" "%100>...>$LINE%<<"
136 }
137
138 autoload -U add-zsh-hook
139diff --git a/plugins/bower/bower.plugin.zsh b/plugins/bower/bower.plugin.zsh
140index ed9c048400bdc77b90354d69e6de433b6c3032c0..68a67a3cc625d6c4afde142b14f5d60abfb6d1d3 100644
141--- a/plugins/bower/bower.plugin.zsh
142+++ b/plugins/bower/bower.plugin.zsh
143@@ -2,37 +2,80 @@ alias bi="bower install"
144 alias bl="bower list"
145 alias bs="bower search"
146
147-bower_package_list=''
148-
149+_bower_installed_packages () {
150+ bower_package_list=$(bower ls --no-color 2>/dev/null| awk 'NR>3{print p}{p=$0}'| cut -d ' ' -f 2|sed 's/#.*//')
151+}
152 _bower ()
153 {
154- local curcontext="$curcontext" state line
155- typeset -A opt_args
156-
157- _arguments -C \
158- ':command:->command' \
159- '*::options:->options'
160-
161- case $state in
162- (command)
163-
164- local -a subcommands
165- subcommands=(${=$(bower help | grep help | sed -e 's/,//g')})
166- _describe -t commands 'bower' subcommands
167- ;;
168-
169- (options)
170- case $line[1] in
171-
172- (install)
173- if [ -z "$bower_package_list" ];then
174- bower_package_list=$(bower search | awk 'NR > 2' | cut -d '-' -f 2 | cut -d ' ' -f 2 | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g")
175- fi
176- compadd "$@" $(echo $bower_package_list)
177- ;;
178- esac
179- ;;
180- esac
181+ local -a _1st_arguments _no_color _dopts _save_dev _force_lastest _production
182+ local expl
183+ typeset -A opt_args
184+
185+ _no_color=('--no-color[Do not print colors (available in all commands)]')
186+
187+ _dopts=(
188+ '(--save)--save[Save installed packages into the project"s bower.json dependencies]'
189+ '(--force)--force[Force fetching remote resources even if a local copy exists on disk]'
190+ )
191+
192+ _save_dev=('(--save-dev)--save-dev[Save installed packages into the project"s bower.json devDependencies]')
193+
194+ _force_lastest=('(--force-latest)--force-latest[Force latest version on conflict]')
195+
196+ _production=('(--production)--production[Do not install project devDependencies]')
197+
198+ _1st_arguments=(
199+ 'cache-clean:Clean the Bower cache, or the specified package caches' \
200+ 'help:Display help information about Bower' \
201+ 'info:Version info and description of a particular package' \
202+ 'init:Interactively create a bower.json file' \
203+ 'install:Install a package locally' \
204+ 'link:Symlink a package folder' \
205+ 'lookup:Look up a package URL by name' \
206+ 'register:Register a package' \
207+ 'search:Search for a package by name' \
208+ 'uninstall:Remove a package' \
209+ 'update:Update a package' \
210+ {ls,list}:'[List all installed packages]'
211+ )
212+ _arguments \
213+ $_no_color \
214+ '*:: :->subcmds' && return 0
215+
216+ if (( CURRENT == 1 )); then
217+ _describe -t commands "bower subcommand" _1st_arguments
218+ return
219+ fi
220+
221+ case "$words[1]" in
222+ install)
223+ _arguments \
224+ $_dopts \
225+ $_save_dev \
226+ $_force_lastest \
227+ $_no_color \
228+ $_production
229+ ;;
230+ update)
231+ _arguments \
232+ $_dopts \
233+ $_no_color \
234+ $_force_lastest
235+ _bower_installed_packages
236+ compadd "$@" $(echo $bower_package_list)
237+ ;;
238+ uninstall)
239+ _arguments \
240+ $_no_color \
241+ $_dopts
242+ _bower_installed_packages
243diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
244index 9446aafabab839d60ae5472c76e9445f9a857558..c01241409dca69f25a5aad53fd624ac731c33cbb 100644
245--- a/plugins/bundler/bundler.plugin.zsh
246+++ b/plugins/bundler/bundler.plugin.zsh
247@@ -7,7 +7,7 @@ alias bu="bundle update"
248
249 # The following is based on https://github.com/gma/bundler-exec
250
251-bundled_commands=(annotate cap capify cucumber foreman guard jekyll middleman nanoc rackup rainbows rake rspec ruby shotgun spec spin spork thin thor unicorn unicorn_rails puma)
252+bundled_commands=(annotate berks cap capify cucumber foodcritic foreman guard jekyll kitchen knife middleman nanoc rackup rainbows rake rspec ruby shotgun spec spin spork strainer tailor thin thor unicorn unicorn_rails puma)
253
254 ## Functions
255
256diff --git a/plugins/cabal/cabal.plugin.zsh b/plugins/cabal/cabal.plugin.zsh
257new file mode 100644
258index 0000000000000000000000000000000000000000..8d3c64587155a75a48055fa28d649159d328a874
259--- /dev/null
260+++ b/plugins/cabal/cabal.plugin.zsh
261@@ -0,0 +1,36 @@
262+function _cabal_commands() {
263+ local ret=1 state
264+ _arguments ':subcommand:->subcommand' && ret=0
265+
266+ case $state in
267+ subcommand)
268+ subcommands=(
269+ "bench:Run the benchmark, if any (configure with UserHooks)"
270+ "build:Make this package ready for installation"
271+ "check:Check the package for common mistakes"
272+ "clean:Clean up after a build"
273+ "copy:Copy teh files into the install locations"
274+ "configure:Prepare to build the package"
275+ "fetch:Downloads packages for later installation"
276+ "haddock:Generate HAddock HTML documentation"
277+ "help:Help about commands"
278+ "hscolour:Generate HsColour colourised code, in HTML format"
279+ "info:Display detailed information about a particular package"
280+ "init:Interactively create a .cabal file"
281+ "install:Installs a list of packages"
282+ "list:List packages matching a search string"
283+ "register:Register this package with the compiler"
284+ "report:Upload build reports to a remote server"
285+ "sdist:Generate a source distribution file (.tar.gz)"
286+ "test:Run the test suite, if any (configure with UserHooks)"
287+ "unpack:Unpacks packages for user inspection"
288+ "update:Updates list of known packages"
289+ "upload:Uploads source packages to Hackage"
290+ )
291+ _describe -t subcommands 'cabal subcommands' subcommands && ret=0
292+ esac
293+
294+ return ret
295+}
296+
297+compdef _cabal_commands cabal
298diff --git a/plugins/celery/_celery b/plugins/celery/_celery
299new file mode 100644
300index 0000000000000000000000000000000000000000..63af9fad58ce471950a5a64fee088356512b38c2
301--- /dev/null
302+++ b/plugins/celery/_celery
303@@ -0,0 +1,129 @@
304+#compdef celery
305+#autoload
306+
307+#celery zsh completion
308+
309+_celery () {
310+local -a _1st_arguments ifargs dopts controlargs
311+
312+typeset -A opt_args
313+
314+_1st_arguments=('worker' 'events' 'beat' 'shell' 'multi' 'amqp' 'status' 'inspect' \
315+ 'control' 'purge' 'list' 'migrate' 'call' 'result' 'report')
316+ifargs=('--app=' '--broker=' '--loader=' '--config=' '--version')
317+dopts=('--detach' '--umask=' '--gid=' '--uid=' '--pidfile=' '--logfile=' '--loglevel=')
318+controlargs=('--timeout' '--destination')
319+_arguments \
320+ '(-A --app=)'{-A,--app}'[app instance to use (e.g. module.attr_name):APP]' \
321+ '(-b --broker=)'{-b,--broker}'[url to broker. default is "amqp://guest@localhost//":BROKER]' \
322+ '(--loader)--loader[name of custom loader class to use.:LOADER]' \
323+ '(--config)--config[Name of the configuration module:CONFIG]' \
324+ '(--workdir)--workdir[Optional directory to change to after detaching.:WORKING_DIRECTORY]' \
325+ '(-q --quiet)'{-q,--quiet}'[Don"t show as much output.]' \
326+ '(-C --no-color)'{-C,--no-color}'[Don"t display colors.]' \
327+ '(--version)--version[show program"s version number and exit]' \
328+ '(- : *)'{-h,--help}'[show this help message and exit]' \
329+ '*:: :->subcmds' && return 0
330+
331+if (( CURRENT == 1 )); then
332+ _describe -t commands "celery subcommand" _1st_arguments
333+ return
334+fi
335+
336+case "$words[1]" in
337+ worker)
338+ _arguments \
339+ '(-C --concurrency=)'{-C,--concurrency=}'[Number of child processes processing the queue. The default is the number of CPUs.]' \
340+ '(--pool)--pool=:::(processes eventlet gevent threads solo)' \
341+ '(--purge --discard)'{--discard,--purge}'[Purges all waiting tasks before the daemon is started.]' \
342+ '(-f --logfile=)'{-f,--logfile=}'[Path to log file. If no logfile is specified, stderr is used.]' \
343+ '(--loglevel=)--loglevel=:::(critical error warning info debug)' \
344+ '(-N --hostname=)'{-N,--hostname=}'[Set custom hostname, e.g. "foo.example.com".]' \
345+ '(-B --beat)'{-B,--beat}'[Also run the celerybeat periodic task scheduler.]' \
346+ '(-s --schedule=)'{-s,--schedule=}'[Path to the schedule database if running with the -B option. Defaults to celerybeat-schedule.]' \
347+ '(-S --statedb=)'{-S,--statedb=}'[Path to the state database.Default: None]' \
348+ '(-E --events)'{-E,--events}'[Send events that can be captured by monitors like celeryev, celerymon, and others.]' \
349+ '(--time-limit=)--time-limit=[nables a hard time limit (in seconds int/float) for tasks]' \
350+ '(--soft-time-limit=)--soft-time-limit=[Enables a soft time limit (in seconds int/float) for tasks]' \
351+ '(--maxtasksperchild=)--maxtasksperchild=[Maximum number of tasks a pool worker can execute before it"s terminated and replaced by a new worker.]' \
352+ '(-Q --queues=)'{-Q,--queues=}'[List of queues to enable for this worker, separated by comma. By default all configured queues are enabled.]' \
353+ '(-I --include=)'{-I,--include=}'[Comma separated list of additional modules to import.]' \
354+ '(--pidfile=)--pidfile=[Optional file used to store the process pid.]' \
355+ '(--autoscale=)--autoscale=[Enable autoscaling by providing max_concurrency, min_concurrency.]' \
356+ '(--autoreload)--autoreload[Enable autoreloading.]' \
357+ '(--no-execv)--no-execv[Don"t do execv after multiprocessing child fork.]'
358+ compadd -a ifargs
359+ ;;
360+ inspect)
361+ _values -s \
362+ 'active[dump active tasks (being processed)]' \
363+ 'active_queues[dump queues being consumed from]' \
364+ 'ping[ping worker(s)]' \
365+ 'registered[dump of registered tasks]' \
366+ 'report[get bugreport info]' \
367+ 'reserved[dump reserved tasks (waiting to be processed)]' \
368+ 'revoked[dump of revoked task ids]' \
369+ 'scheduled[dump scheduled tasks (eta/countdown/retry)]' \
370+ 'stats[dump worker statistics]'
371+ compadd -a controlargs ifargs
372+ ;;
373+ control)
374+ _values -s \
375+ 'add_consumer[tell worker(s) to start consuming a queue]' \
376+ 'autoscale[change autoscale settings]' \
377+ 'cancel_consumer[tell worker(s) to stop consuming a queue]' \
378+ 'disable_events[tell worker(s) to disable events]' \
379+ 'enable_events[tell worker(s) to enable events]' \
380+ 'pool_grow[start more pool processes]' \
381+ 'pool_shrink[use less pool processes]' \
382+ 'rate_limit[tell worker(s) to modify the rate limit for a task type]' \
383+ 'time_limit[tell worker(s) to modify the time limit for a task type.]'
384+ compadd -a controlargs ifargs
385+ ;;
386+ multi)
387+ _values -s \
388+ '--nosplash[Don"t display program info.]' \
389+ '--verbose[Show more output.]' \
390+ '--no-color[Don"t display colors.]' \
391+ '--quiet[Don"t show as much output.]' \
392+ 'start' 'restart' 'stopwait' 'stop' 'show' \
393+ 'names' 'expand' 'get' 'kill'
394+ compadd -a ifargs
395+ ;;
396+ amqp)
397+ _values -s \
398+ 'queue.declare' 'queue.purge' 'exchange.delete' 'basic.publish' \
399+ 'exchange.declare' 'queue.delete' 'queue.bind' 'basic.get'
400+ ;;
401+ list)
402+ _values -s, 'bindings'
403diff --git a/plugins/coffee/_coffee b/plugins/coffee/_coffee
404index 5c8eb9a084050bf740c12992af8b609cb99a104c..10b6b816489ddc43bb5d180519a0d93e37f91e4e 100644
405--- a/plugins/coffee/_coffee
406+++ b/plugins/coffee/_coffee
407@@ -35,27 +35,37 @@
408 # -------
409 #
410 # * Mario Fernandez (https://github.com/sirech)
411+# * Dong Weiming (https://github.com/dongweiming)
412 #
413 # ------------------------------------------------------------------------------
414
415-local curcontext="$curcontext" state line ret=1
416+local curcontext="$curcontext" state line ret=1 version opts first second third
417 typeset -A opt_args
418+version=(${(f)"$(_call_program version $words[1] --version)"})
419+version=${${(z)${version[1]}}[3]}
420+first=$(echo $version|cut -d '.' -f 1)
421+second=$(echo $version|cut -d '.' -f 2)
422+third=$(echo $version|cut -d '.' -f 3)
423+if (( $first < 2 )) && (( $second < 7 )) && (( $third < 3 ));then
424+ opts+=('(-l --lint)'{-l,--lint}'[pipe the compiled JavaScript through JavaScript Lint]'
425+ '(-r --require)'{-r,--require}'[require a library before executing your script]:library')
426+fi
427+
428
429 _arguments -C \
430 '(- *)'{-h,--help}'[display this help message]' \
431 '(- *)'{-v,--version}'[display the version number]' \
432+ $opts \
433 '(-b --bare)'{-b,--bare}'[compile without a top-level function wrapper]' \
434 '(-e --eval)'{-e,--eval}'[pass a string from the command line as input]:Inline Script' \
435 '(-i --interactive)'{-i,--interactive}'[run an interactive CoffeeScript REPL]' \
436 '(-j --join)'{-j,--join}'[concatenate the source CoffeeScript before compiling]:Destination JS file:_files -g "*.js"' \
437- '(-l --lint)'{-l,--lint}'[pipe the compiled JavaScript through JavaScript Lint]' \
438 '(--nodejs)--nodejs[pass options directly to the "node" binary]' \
439 '(-c --compile)'{-c,--compile}'[compile to JavaScript and save as .js files]' \
440 '(-o --output)'{-o,--output}'[set the output directory for compiled JavaScript]:Output Directory:_files -/' \
441 '(-n -t -p)'{-n,--nodes}'[print out the parse tree that the parser produces]' \
442 '(-n -t -p)'{-p,--print}'[print out the compiled JavaScript]' \
443 '(-n -t -p)'{-t,--tokens}'[print out the tokens that the lexer/rewriter produce]' \
444- '(-r --require)'{-r,--require}'[require a library before executing your script]:library' \
445 '(-s --stdio)'{-s,--stdio}'[listen for and compile scripts over stdio]' \
446 '(-w --watch)'{-w,--watch}'[watch scripts for changes and rerun commands]' \
447 '*:script or directory:_files' && ret=0
448diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh
449index 2d155754174ddb9755351a287309e3e8f857580e..9975aaca482ff737de7e0301879ad9181fa87195 100644
450--- a/plugins/composer/composer.plugin.zsh
451+++ b/plugins/composer/composer.plugin.zsh
452@@ -10,9 +10,25 @@ _composer_get_command_list () {
453 composer --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
454 }
455
456+_composer_get_required_list () {
457+ composer show -s --no-ansi | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }'
458+}
459+
460 _composer () {
461+ local curcontext="$curcontext" state line
462+ typeset -A opt_args
463+ _arguments \
464+ '1: :->command'\
465+ '*: :->args'
466 if [ -f composer.json ]; then
467- compadd `_composer_get_command_list`
468+ case $state in
469+ command)
470+ compadd `_composer_get_command_list`
471+ ;;
472+ *)
473+ compadd `_composer_get_required_list`
474+ ;;
475+ esac
476 else
477 compadd create-project init search selfupdate show
478 fi
479diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh
480index 55b90e3793a3bc1f13cf43f7c1c0e74eb84062cc..b51d0cd37c25f9ac47fc37f23d983cab40f5a963 100644
481--- a/plugins/debian/debian.plugin.zsh
482+++ b/plugins/debian/debian.plugin.zsh
483@@ -6,14 +6,14 @@
484
485 # Use aptitude if installed, or apt-get if not.
486 # You can just set apt_pref='apt-get' to override it.
487-if [[ -e $( which aptitude 2>&1 ) ]]; then
488+if [[ -e $( which -p aptitude 2>&1 ) ]]; then
489 apt_pref='aptitude'
490 else
491 apt_pref='apt-get'
492 fi
493
494 # Use sudo by default if it's installed
495-if [[ -e $( which sudo 2>&1 ) ]]; then
496+if [[ -e $( which -p sudo 2>&1 ) ]]; then
497 use_sudo=1
498 fi
499
500diff --git a/plugins/git/README.md b/plugins/git/README.md
501new file mode 100644
502index 0000000000000000000000000000000000000000..8462dda1cdff0af675651fb744c6ba91258b7ad7
503--- /dev/null
504+++ b/plugins/git/README.md
505@@ -0,0 +1,4 @@
506+## git
507+**Maintainer:** [Stibbons](https://github.com/Stibbons)
508+
509+This plugin adds several git aliases and increase the completion function provided by zsh
510diff --git a/plugins/git/_git-branch b/plugins/git/_git-branch
511new file mode 100644
512index 0000000000000000000000000000000000000000..86d03bc30eeb1a7c0349b20bfcf83f46b95f6d8c
513--- /dev/null
514+++ b/plugins/git/_git-branch
515@@ -0,0 +1,62 @@
516+#compdef git-branch
517+
518+_git-branch ()
519+{
520+ declare l c m d
521+
522+ l='--color --no-color -r -a --all -v --verbose --abbrev --no-abbrev'
523+ c='-l -f --force -t --track --no-track --set-upstream --contains --merged --no-merged'
524+ m='-m -M'
525+ d='-d -D'
526+
527+ declare -a dependent_creation_args
528+ if (( words[(I)-r] == 0 )); then
529+ dependent_creation_args=(
530+ "($l $m $d): :__git_branch_names"
531+ "::start-point:__git_revisions")
532+ fi
533+
534+ declare -a dependent_deletion_args
535+ if (( words[(I)-d] || words[(I)-D] )); then
536+ dependent_creation_args=
537+ dependent_deletion_args=(
538+ '-r[delete only remote-tracking branches]')
539+ if (( words[(I)-r] )); then
540+ dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_remote_branch_names'
541+ else
542+ dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_branch_names'
543+ fi
544+ fi
545+
546+ declare -a dependent_modification_args
547+ if (( words[(I)-m] || words[(I)-M] )); then
548+ dependent_creation_args=
549+ dependent_modification_args=(
550+ ':old or new branch name:__git_branch_names'
551+ '::new branch name:__git_branch_names')
552+ fi
553+
554+ _arguments -w -S -s \
555+ "($c $m $d --no-color :)--color=-[turn on branch coloring]:: :__git_color_whens" \
556+ "($c $m $d : --color)--no-color[turn off branch coloring]" \
557+ "($c $m -a --all)-r[list or delete only remote-tracking branches]" \
558+ "($c $m $d : -r)"{-a,--all}"[list both remote-tracking branches and local branches]" \
559+ "($c $m $d : -v --verbose)"{-v,--verbose}'[show SHA1 and commit subject line for each head]' \
560+ "($c $m $d :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \
561+ "($c $m $d :)--no-abbrev[do not abbreviate sha1s]" \
562+ "($l $m $d)-l[create the branch's reflog]" \
563+ "($l $m $d -f --force)"{-f,--force}"[force the creation of a new branch]" \
564+ "($l $m $d -t --track)"{-t,--track}"[set up configuration so that pull merges from the start point]" \
565+ "($l $m $d)--no-track[override the branch.autosetupmerge configuration variable]" \
566+ "($l $m $d)--set-upstream[set up configuration so that pull merges]" \
567+ "($l $m $d)--contains=[only list branches which contain the specified commit]: :__git_committishs" \
568+ "($l $m $d)--merged=[only list branches which are fully contained by HEAD]: :__git_committishs" \
569+ "($l $m $d)--no-merged=[do not list branches which are fully contained by HEAD]: :__git_committishs" \
570+ $dependent_creation_args \
571+ "($l $c $d -M)-m[rename a branch and the corresponding reflog]" \
572+ "($l $c $d -m)-M[rename a branch even if the new branch-name already exists]" \
573+ $dependent_modification_args \
574+ "($l $c $m -D)-d[delete a fully merged branch]" \
575+ "($l $c $m -d)-D[delete a branch]" \
576+ $dependent_deletion_args
577+}
578diff --git a/plugins/git/_git-remote b/plugins/git/_git-remote
579new file mode 100644
580index 0000000000000000000000000000000000000000..4ba62a357b8872baf2e64d643668144ec4a77985
581--- /dev/null
582+++ b/plugins/git/_git-remote
583@@ -0,0 +1,74 @@
584+#compdef git-remote
585+
586+# NOTE: --track is undocumented.
587+# TODO: --track, -t, --master, and -m should take remote branches, I guess.
588+# NOTE: --master is undocumented.
589+# NOTE: --fetch is undocumented.
590+_git-remote () {
591+ local curcontext=$curcontext state line
592+ declare -A opt_args
593+
594+ _arguments -C \
595+ ':command:->command' \
596+ '*::options:->options' && ret=0
597+
598+ case $state in
599+ (command)
600+ declare -a commands
601+
602+ commands=(
603+ 'add:add a new remote'
604+ 'show:show information about a given remote'
605+ 'prune:delete all stale tracking branches for a given remote'
606+ 'update:fetch updates for a set of remotes'
607+ 'rm:remove a remote from .git/config and all associated tracking branches'
608+ 'rename:rename a remote from .git/config and update all associated tracking branches'
609+ 'set-head:sets or deletes the default branch'
610+ 'set-branches:changes the list of branches tracked by the named remote.'
611+ 'set-url:changes URL remote points to.'
612+ )
613+
614+ _describe -t commands 'sub-command' commands && ret=0
615+ ;;
616+ (options)
617+ case $line[1] in
618+ (add)
619+ _arguments \
620+ '*'{--track,-t}'[track given branch instead of default glob refspec]:branch:__git_branch_names' \
621+ '(--master -m)'{--master,-m}'[set the remote'\''s HEAD to point to given master branch]:branch:__git_branch_names' \
622+ '(--fetch -f)'{--fetch,-f}'[run git-fetch on the new remote after it has been created]' \
623+ ':branch name:__git_remotes' \
624+ ':url:_urls' && ret=0
625+ ;;
626+ (show)
627+ _arguments \
628+ '-n[do not contact the remote for a list of branches]' \
629+ ':remote:__git_remotes' && ret=0
630+ ;;
631+ (prune)
632+ _arguments \
633+ '(--dry-run -n)'{-n,--dry-run}'[do not actually prune, only list what would be done]' \
634+ ':remote:__git_remotes' && ret=0
635+ ;;
636+ (update)
637+ __git_remote-groups && ret=0
638+ ;;
639+ (rm)
640+ __git_remotes && ret=0
641+ ;;
642+ (rename)
643+ __git_remotes && ret=0
644+ ;;
645+ (set-url)
646+ _arguments \
647+ '*--push[manipulate push URLs]' \
648+ '(--add)--add[add URL]' \
649+ '(--delete)--delete[delete URLs]' \
650+ ':branch name:__git_remotes' \
651+ ':url:_urls' && ret=0
652+ ;;
653+
654+ esac
655+ ;;
656+ esac
657+}
658diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
659index af0189fdce0de48c948ccd4d2d993dea62ec27be..3bdf0c30f6bd411facdf434a0e9045e11b6786c5 100644
660--- a/plugins/git/git.plugin.zsh
661+++ b/plugins/git/git.plugin.zsh
662@@ -37,6 +37,12 @@ alias grset='git remote set-url'
663 compdef _git grset=git-remote
664 alias grup='git remote update'
665 compdef _git grset=git-remote
666+alias grbi='git rebase -i'
667+compdef _git grbi=git-rebase
668+alias grbc='git rebase --continue'
669+compdef _git grbc=git-rebase
670+alias grba='git rebase --abort'
671+compdef _git grba=git-rebase
672 alias gb='git branch'
673 compdef _git gb=git-branch
674 alias gba='git branch -a'
675@@ -62,12 +68,20 @@ alias gm='git merge'
676 compdef _git gm=git-merge
677 alias grh='git reset HEAD'
678 alias grhh='git reset HEAD --hard'
679+alias gclean='git reset --hard && git clean -dfx'
680 alias gwc='git whatchanged -p --abbrev-commit --pretty=medium'
681
682 #remove the gf alias
683 #alias gf='git ls-files | grep'
684
685 alias gpoat='git push origin --all && git push origin --tags'
686+alias gmt='git mergetool --no-prompt'
687+compdef _git gm=git-mergetool
688+
689+alias gg='git gui citool'
690+alias gga='git gui citool --amend'
691+alias gk='gitk --all --branches'
692+alias gsts='git stash show --text'
693
694 # Will cd into the top of the current repository
695 # or submodule.
696@@ -98,6 +112,8 @@ function current_repository() {
697 # these aliases take advantage of the previous function
698 alias ggpull='git pull origin $(current_branch)'
699 compdef ggpull=git
700+alias ggpur='git pull --rebase origin $(current_branch)'
701+compdef ggpur=git
702 alias ggpush='git push origin $(current_branch)'
703 compdef ggpush=git
704 alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)'
705diff --git a/plugins/gpg-agent/gpg-agent.plugin.zsh b/plugins/gpg-agent/gpg-agent.plugin.zsh
706index 109af44c8d5d6be7d4ec47fdc6fe1e40cd8aeb58..4071334cb74fc18270a94a7bce4c88e9bf045357 100644
707--- a/plugins/gpg-agent/gpg-agent.plugin.zsh
708+++ b/plugins/gpg-agent/gpg-agent.plugin.zsh
709@@ -14,16 +14,24 @@ function start_agent_withssh {
710 export SSH_AGENT_PID
711 }
712
713-# source settings of old agent, if applicable
714-if [ -f "${GPG_ENV}" ]; then
715- . ${GPG_ENV} > /dev/null
716-fi
717+# check if another agent is running
718+if ! gpg-connect-agent --quiet /bye > /dev/null 2> /dev/null; then
719+ # source settings of old agent, if applicable
720+ if [ -f "${GPG_ENV}" ]; then
721+ . ${GPG_ENV} > /dev/null
722+ fi
723
724-# check for existing ssh-agent
725-if ssh-add -l > /dev/null 2> /dev/null; then
726- start_agent_nossh;
727-else
728- start_agent_withssh;
729+ # check again if another agent is running using the newly sourced settings
730+ if ! gpg-connect-agent --quiet /bye > /dev/null 2> /dev/null; then
731+ # check for existing ssh-agent
732+ if ssh-add -l > /dev/null 2> /dev/null; then
733+ # ssh-agent running, start gpg-agent without ssh support
734+ start_agent_nossh;
735+ else
736+ # otherwise start gpg-agent with ssh support
737+ start_agent_withssh;
738+ fi
739+ fi
740 fi
741
742 GPG_TTY=$(tty)
743diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh
744index b91f93c9565620f53094880cef5bc0469ab3250f..9aa192c1e6a0119c39b1373f6764429faa7f49a1 100644
745--- a/plugins/jira/jira.plugin.zsh
746+++ b/plugins/jira/jira.plugin.zsh
747@@ -3,7 +3,7 @@
748 # .jira-url in the current directory takes precedence
749 #
750 # If you use Rapid Board, set:
751-#JIRA_RAPID_BOARD="yes"
752+#JIRA_RAPID_BOARD="true"
753 # in you .zshrc
754 #
755 # Setup: cd to/my/project
756@@ -11,6 +11,13 @@
757 # Usage: jira # opens a new issue
758 # jira ABC-123 # Opens an existing issue
759 open_jira_issue () {
760+ local open_cmd
761+ if [[ $(uname -s) == 'Darwin' ]]; then
762+ open_cmd='open'
763+ else
764+ open_cmd='xdg-open'
765+ fi
766+
767 if [ -f .jira-url ]; then
768 jira_url=$(cat .jira-url)
769 elif [ -f ~/.jira-url ]; then
770@@ -27,10 +34,10 @@ open_jira_issue () {
771 `open $jira_url/secure/CreateIssue!default.jspa`
772 else
773 echo "Opening issue #$1"
774- if [[ "x$JIRA_RAPID_BOARD" = "yes" ]]; then
775- `open $jira_url/issues/$1`
776+ if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then
777+ $open_cmd "$jira_url/issues/$1"
778 else
779- `open $jira_url/browse/$1`
780+ $open_cmd "$jira_url/browse/$1"
781 fi
782 fi
783 }
784diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh
785index 9aa2d167aa6fb40c01189556beb000b2862b3f85..c18aa726c49cd75b327ae4173a153cd4cb22c0af 100644
786--- a/plugins/mercurial/mercurial.plugin.zsh
787+++ b/plugins/mercurial/mercurial.plugin.zsh
788@@ -1,4 +1,3 @@
789-
790 # Mercurial
791 alias hgc='hg commit'
792 alias hgb='hg branch'
793@@ -17,8 +16,48 @@ alias hgs='hg status'
794 # this is the 'git commit --amend' equivalent
795 alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
796
797-function hg_current_branch() {
798- if [ -d .hg ]; then
799- echo hg:$(hg branch)
800+function in_hg() {
801+ if [[ -d .hg ]] || $(hg summary > /dev/null 2>&1); then
802+ echo 1
803+ fi
804+}
805+
806+function hg_get_branch_name() {
807+ if [ $(in_hg) ]; then
808+ echo $(hg branch)
809+ fi
810+}
811+
812+function hg_prompt_info {
813+ if [ $(in_hg) ]; then
814+ _DISPLAY=$(hg_get_branch_name)
815+ echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_HG_PROMPT_PREFIX\
816+$ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_HG_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(hg_dirty)$ZSH_PROMPT_BASE_COLOR"
817+ unset _DISPLAY
818+ fi
819+}
820+
821+function hg_dirty_choose {
822+ if [ $(in_hg) ]; then
823+ hg status 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'
824+ if [ $pipestatus[-1] -eq 0 ]; then
825+ # Grep exits with 0 when "One or more lines were selected", return "dirty".
826+ echo $1
827+ else
828+ # Otherwise, no lines were found, or an error occurred. Return clean.
829+ echo $2
830+ fi
831 fi
832 }
833+
834+function hg_dirty {
835+ hg_dirty_choose $ZSH_THEME_HG_PROMPT_DIRTY $ZSH_THEME_HG_PROMPT_CLEAN
836+}
837+
838+function hgic() {
839+ hg incoming "$@" | grep "changeset" | wc -l
840+}
841+
842+function hgoc() {
843+ hg outgoing "$@" | grep "changeset" | wc -l
844+}
845diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
846index 51cd7c143436ebf30726f7470bc09562661c74b9..dd785f91131a3e9dd53f5f0e3f01378919c9f230 100644
847--- a/plugins/osx/osx.plugin.zsh
848+++ b/plugins/osx/osx.plugin.zsh
849@@ -6,7 +6,7 @@
850 # ------------------------------------------------------------------------------
851
852 function tab() {
853- local command="cd \\\"$PWD\\\""
854+ local command="cd \\\"$PWD\\\"; clear; "
855 (( $# > 0 )) && command="${command}; $*"
856
857 the_app=$(
858@@ -34,7 +34,7 @@ EOF
859 launch session "Default Session"
860 set current_session to current session
861 tell current_session
862- write text "${command}; clear;"
863+ write text "${command}"
864 end tell
865 end tell
866 end tell
867diff --git a/plugins/postgres/postgres.plugin.zsh b/plugins/postgres/postgres.plugin.zsh
868new file mode 100644
869index 0000000000000000000000000000000000000000..cdd142e92c61c8db172e72a165923b5d96b11d12
870--- /dev/null
871+++ b/plugins/postgres/postgres.plugin.zsh
872@@ -0,0 +1,6 @@
873+# Aliases to stop, start and restart Postgres
874+# Paths noted below are for Postgress installed via Homebrew on OSX
875+
876+alias startpost='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start'
877+alias stoppost='pg_ctl -D /usr/local/var/postgres stop -s -m fast'
878+alias restartpost='stoppost && sleep 1 && startpost'
879diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh
880index 0139d22c3c7151ca8c14ca19f131a184c74ea2a3..dd8b174b2b3a320046cdff854584304841951816 100644
881--- a/plugins/rails/rails.plugin.zsh
882+++ b/plugins/rails/rails.plugin.zsh
883@@ -10,6 +10,8 @@ alias migrate='rake db:migrate && rake db:test:prepare'
884 alias sc='ruby script/console'
885 alias sd='ruby script/server --debugger'
886 alias devlog='tail -f log/development.log'
887+alias testlog='tail -f log/test.log'
888+alias prodlog='tail -f log/production.log'
889 alias -g RET='RAILS_ENV=test'
890 alias -g REP='RAILS_ENV=production'
891 alias -g RED='RAILS_ENV=development'
892diff --git a/plugins/rails3/_rails3 b/plugins/rails3/_rails3
893new file mode 100644
894index 0000000000000000000000000000000000000000..97915e68b90cd84cca1ff24e3b6b175224e4eab3
895--- /dev/null
896+++ b/plugins/rails3/_rails3
897@@ -0,0 +1,56 @@
898+#compdef rails
899+#autoload
900+
901+# rails 3 zsh completion, based on homebrew completion
902+# Extracted from https://github.com/robbyrussell/oh-my-zsh/blob/30620d463850c17f86e7a56fbf6a8b5e793a4e07/plugins/rails3/_rails3
903+# Published by Christopher Chow
904+
905+local -a _1st_arguments
906+_1st_arguments=(
907+ 'generate:Generate new code (short-cut alias: "g")'
908+ 'console:Start the Rails console (short-cut alias: "c")'
909+ 'server:Start the Rails server (short-cut alias: "s")'
910+ 'dbconsole:Start a console for the database specified in config/database.yml (short-cut alias: "db")'
911+ 'new:Create a new Rails application. "rails new my_app" creates a new application called MyApp in "./my_app"'
912+ 'application:Generate the Rails application code'
913+ 'destroy:Undo code generated with "generate"'
914+ 'benchmarker:See how fast a piece of code runs'
915+ 'profiler:Get profile information from a piece of code'
916+ 'plugin:Install a plugin'
917+)
918+
919+_rails_generate_arguments() {
920+ generate_arguments=(
921+ controller
922+ generator
923+ helper
924+ integration_test
925+ mailer
926+ migration
927+ model
928+ observer
929+ performance_test
930+ plugin
931+ resource
932+ scaffold
933+ scaffold_controller
934+ session_migration
935+ stylesheets
936+ )
937+}
938+
939+_arguments \
940+ '(--version)--version[show version]' \
941+ '(--help)--help[show help]' \
942+ '*:: :->subcmds' && return 0
943+
944+if (( CURRENT == 1 )); then
945+ _describe -t commands "rails subcommand" _1st_arguments
946+ return
947+fi
948+
949+case "$words[1]" in
950+ generate)
951+ _rails_generate_arguments
952+ _wanted generate_arguments expl 'all generate' compadd -a generate_arguments ;;
953+esac
954diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh
955index a2697872ab90ca408745722458a8bf72ebcc0f7c..2555fab67218005c4d84bfed089451e7020e34c9 100644
956--- a/plugins/rails3/rails3.plugin.zsh
957+++ b/plugins/rails3/rails3.plugin.zsh
958@@ -19,6 +19,8 @@ alias ru='_rails_command runner'
959 alias rs='_rails_command server'
960 alias rsd='_rails_command server --debugger'
961 alias devlog='tail -f log/development.log'
962+alias testlog='tail -f log/test.log'
963+alias prodlog='tail -f log/production.log'
964 alias rdm='rake db:migrate'
965 alias rdr='rake db:rollback'
966 alias -g RET='RAILS_ENV=test'
967diff --git a/plugins/rails4/rails4.plugin.zsh b/plugins/rails4/rails4.plugin.zsh
968index fce827ee3b459b6ccb2a408d5af6e8e7ce13fae1..cb6cf816d8a8dc48ac6a803409668827bdcaa949 100644
969--- a/plugins/rails4/rails4.plugin.zsh
970+++ b/plugins/rails4/rails4.plugin.zsh
971@@ -21,6 +21,8 @@ alias ru='_rails_command runner'
972 alias rs='_rails_command server'
973 alias rsd='_rails_command server --debugger'
974 alias devlog='tail -f log/development.log'
975+alias testlog='tail -f log/test.log'
976+alias prodlog='tail -f log/production.log'
977 alias rdm='rake db:migrate'
978 alias rdc='rake db:create'
979 alias rdr='rake db:rollback'
980diff --git a/plugins/rand-quote/rand-quote.plugin.zsh b/plugins/rand-quote/rand-quote.plugin.zsh
981new file mode 100644
982index 0000000000000000000000000000000000000000..5544ca565777cd06cc58cc9833399e628a7090d2
983--- /dev/null
984+++ b/plugins/rand-quote/rand-quote.plugin.zsh
985@@ -0,0 +1,17 @@
986+# Get a random quote fron the site http://www.quotationspage.com/random.php3
987+# Created by Eduardo San Martin Morote aka Posva
988+# http://posva.github.io
989+# Sun Jun 09 10:59:36 CEST 2013
990+# Don't remove this header, thank you
991+# Usage: quote
992+
993+if [[ -x `which curl` ]]; then
994+ function quote()
995+ {
996+ Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php3" | grep -m 1 "dt ")
997+ TXT=$(echo "$Q" | sed -e 's/<\/dt>.*//g' -e 's/.*html//g' -e 's/^[^a-zA-Z]*//' -e 's/<\/a..*$//g')
998+ W=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g')
999+ echo "\e[0;33m${W}\e[0;30m: \e[0;35m“${TXT}”\e[m"
1000+ }
1001+ #quote
1002+fi
1003diff --git a/plugins/repo/README.md b/plugins/repo/README.md
1004new file mode 100644
1005index 0000000000000000000000000000000000000000..0b77e6d487fa18bad405763f468058121eafb51e
1006--- /dev/null
1007+++ b/plugins/repo/README.md
1008@@ -0,0 +1,7 @@
1009+## repo
1010+**Maintainer:** [Stibbons](https://github.com/Stibbons)
1011+
1012+This plugin mainly add support automatic completion for the repo command line tool:
1013+http://code.google.com/p/git-repo/
1014+
1015+* `r` aliases `repo`
1016diff --git a/plugins/repo/_repo b/plugins/repo/_repo
1017new file mode 100644
1018index 0000000000000000000000000000000000000000..59e39c9542c6a5e44a679cff558aef36848af97c
1019--- /dev/null
1020+++ b/plugins/repo/_repo
1021@@ -0,0 +1,272 @@
1022+#compdef repo
1023+
1024+
1025+__git_apply_whitespace_strategies ()
1026+{
1027+ declare -a strategies
1028+
1029+ strategies=(
1030+ 'nowarn:turn off the trailing-whitespace warning'
1031+ 'warn:output trailing-whitespace warning, but apply patch'
1032+ 'fix:output trailing-whitespace warning and strip trailing whitespace'
1033+ 'error:output trailing-whitespace warning and refuse to apply patch'
1034+ 'error-all:same as "error", but output warnings for all files')
1035+
1036+ _describe -t strategies 'trailing-whitespace resolution strategy' strategies $*
1037+}
1038+
1039+
1040+_repo()
1041+{
1042+ local context state state_descr line curcontext="$curcontext"
1043+ typeset -A opt_args
1044+
1045+ local ret=1
1046+
1047+ _arguments -C \
1048+ '(- 1 *)--help[show usage]'\
1049+ '1:command:->command'\
1050+ '*::args:->args' && ret=0
1051+
1052+ case $state in
1053+ (command)
1054+ repo list 2> /dev/null > /dev/null
1055+ if [[ $? == 0 ]]; then
1056+ local commands;
1057+ commands=(
1058+ 'abandon:Permanently abandon a development branch'
1059+ 'branch:View current topic branches'
1060+ 'branches:View current topic branches'
1061+ 'checkout:Checkout a branch for development'
1062+ 'cherry-pick:Cherry-pick a change.'
1063+ 'diff:Show changes between commit and working tree'
1064+ 'download:Download and checkout a change'
1065+ 'forall:execute command on several project'
1066+ 'grep:Print lines matching a pattern'
1067+ 'help:Display detailed help on a command'
1068+ 'init:Initialize repo in the current directory'
1069+ 'list:List projects and their associated directories'
1070+ 'manifest:Manifest inspection utility'
1071+ 'overview:Display overview of unmerged project branches'
1072+ 'prune:Prune (delete) already merged topics'
1073+ 'rebase:Rebase local branches on upstream branch'
1074+ 'selfupdate:Update repo to the latest version'
1075+ 'smartsync:Update working tree to the latest known good revision'
1076+ 'stage:Stage file(s) for commit'
1077+ 'start:Start a new branch for development'
1078+ 'status:Show the working tree status'
1079+ 'sync:Update working tree to the latest revision'
1080+ 'upload:Upload changes for code review'
1081+ 'version:Display the version of repo'
1082+ )
1083+ _describe -t commands 'command' commands && ret=0
1084+ else
1085+ local commands;
1086+ commands=(
1087+ 'init:Install repo in the current working directory'
1088+ 'help:Display detailed help on a command'
1089+ )
1090+ _describe -t commands 'command' commands && ret=0
1091+ fi
1092+ ;;
1093+ (args)
1094+ case $words[1] in
1095+ (branch | branches)
1096+ # TODO : list available projects and add them in list to feed compadd with
1097+ _arguments : \
1098+ "(-h --help)"{-h,--help}"[Show help]" \
1099+ ': :__repo_projects' \
1100+ && ret=0
1101+ ;;
1102+ (abandon)
1103+ # TODO : list available projects and add them in list to feed compadd with
1104+ _arguments : \
1105+ "(-h --help)"{-h,--help}"[Show help]" \
1106+ ':branch name:__repo_branch' \
1107+ ': :__repo_projects'\
1108+ && ret=0
1109+ ;;
1110+ (checkout)
1111+ # TODO : list available projects and add them in list to feed compadd with
1112+ _arguments : \
1113+ "(-h --help)"{-h,--help}"[Show help]" \
1114+ ':branch name:__repo_branch' \
1115+ ': :__repo_projects'\
1116+ && ret=0
1117+ ;;
1118+ (init)
1119+ _arguments : \
1120+ "(-h --help)"{-h,--help}"[Show help]" \
1121diff --git a/plugins/repo/repo.plugin.zsh b/plugins/repo/repo.plugin.zsh
1122new file mode 100644
1123index 0000000000000000000000000000000000000000..9cc336959345975e0eece56c05557c5d80d762cf
1124--- /dev/null
1125+++ b/plugins/repo/repo.plugin.zsh
1126@@ -0,0 +1,2 @@
1127+# Aliases
1128+alias r='repo'
1129diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh
1130index cdd0a7847d96339b6a405ef4e99033154ff0dc6f..e6ad6450d343b03a2d85893969c673d67cdb5519 100644
1131--- a/plugins/rvm/rvm.plugin.zsh
1132+++ b/plugins/rvm/rvm.plugin.zsh
1133@@ -3,9 +3,9 @@ fpath=($rvm_path/scripts/zsh/Completion $fpath)
1134 alias rubies='rvm list rubies'
1135 alias gemsets='rvm gemset list'
1136
1137-local ruby18='ruby-1.8.7-p371'
1138-local ruby19='ruby-1.9.3-p392'
1139-local ruby20='ruby-2.0.0-p0'
1140+local ruby18='ruby-1.8.7'
1141+local ruby19='ruby-1.9.3'
1142+local ruby20='ruby-2.0.0'
1143
1144 function rb18 {
1145 if [ -z "$1" ]; then
1146@@ -42,7 +42,6 @@ compdef _rb20 rb20
1147
1148 function rvm-update {
1149 rvm get head
1150- rvm reload # TODO: Reload rvm completion?
1151 }
1152
1153 # TODO: Make this usable w/o rvm.
1154diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh
1155index 465f5b053696789317b2854c20764d585f337424..3ecc2ac69fcb64e7456ac59599a1220e5c4bf2f2 100644
1156--- a/plugins/tmux/tmux.plugin.zsh
1157+++ b/plugins/tmux/tmux.plugin.zsh
1158@@ -14,6 +14,8 @@ if which tmux &> /dev/null
1159 [[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT=$ZSH_TMUX_AUTOSTART
1160 # Set term to screen or screen-256color based on current terminal support
1161 [[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true
1162+ # Set '-CC' option for iTerm2 tmux integration
1163+ [[ -n "$ZSH_TMUX_ITERM2" ]] || ZSH_TMUX_ITERM2=false
1164 # The TERM to use for non-256 color terminals.
1165 # Tmux states this should be screen, but you may need to change it on
1166 # systems without the proper terminfo
1167@@ -36,7 +38,7 @@ if which tmux &> /dev/null
1168 fi
1169
1170 # Set the correct local config file to use.
1171- if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]]
1172+ if [[ "$ZSH_TMUX_ITERM2" == "false" ]] && (( [[ -f $HOME/.tmux.conf ]] || -h $HOME/.tmux.conf ]] ))
1173 then
1174 #use this when they have a ~/.tmux.conf
1175 export _ZSH_TMUX_FIXED_CONFIG="$zsh_tmux_plugin_path/tmux.extra.conf"
1176@@ -55,11 +57,11 @@ if which tmux &> /dev/null
1177 # Try to connect to an existing session.
1178 elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]]
1179 then
1180- \tmux attach || \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` new-session
1181+ \tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` attach || \tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` new-session
1182 [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
1183 # Just run tmux, fixing the TERM variable if requested.
1184 else
1185- \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG`
1186+ \tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG`
1187 [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
1188 fi
1189 }
1190diff --git a/plugins/virtualenv/virtualenv.plugin.zsh b/plugins/virtualenv/virtualenv.plugin.zsh
1191index e8458389f610d72750bb58940f52a7ca01ca44d5..8e06450b1ef028aa189b7449624361fd73d6f20e 100644
1192--- a/plugins/virtualenv/virtualenv.plugin.zsh
1193+++ b/plugins/virtualenv/virtualenv.plugin.zsh
1194@@ -1,9 +1,8 @@
1195 function virtualenv_prompt_info(){
1196- local virtualenv_path="$VIRTUAL_ENV"
1197- if [[ -n $virtualenv_path ]]; then
1198- local virtualenv_name=`basename $virtualenv_path`
1199- printf "%s[%s] " "%{${fg[yellow]}%}" $virtualenv_name
1200+ if [[ -n $VIRTUAL_ENV ]]; then
1201+ printf "%s[%s] " "%{${fg[yellow]}%}" ${${VIRTUAL_ENV}:t}
1202 fi
1203 }
1204
1205+# disables prompt mangling in virtual_env/bin/activate
1206 export VIRTUAL_ENV_DISABLE_PROMPT=1
1207diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
1208index 0ed2565b4fcd1bc2c0ced33cd18ebf71500c65d9..670c287bd425d7b9616866d03f0832c1776d992e 100644
1209--- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
1210+++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
1211@@ -1,40 +1,55 @@
1212-wrapsource=`which virtualenvwrapper_lazy.sh`
1213-
1214-if [[ -f "$wrapsource" ]]; then
1215- source $wrapsource
1216+virtualenvwrapper='virtualenvwrapper_lazy.sh'
1217+if (( $+commands[$virtualenvwrapper] )); then
1218+ source ${${virtualenvwrapper}:c}
1219
1220 if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
1221- # Automatically activate Git projects' virtual environments based on the
1222+ # Automatically activate Git projects's virtual environments based on the
1223 # directory name of the project. Virtual environment name can be overridden
1224 # by placing a .venv file in the project root with a virtualenv name in it
1225 function workon_cwd {
1226- # Check that this is a Git repo
1227- PROJECT_ROOT=`git rev-parse --show-toplevel 2> /dev/null`
1228- if (( $? == 0 )); then
1229+ if [ ! $WORKON_CWD ]; then
1230+ WORKON_CWD=1
1231+ # Check if this is a Git repo
1232+ PROJECT_ROOT=`git rev-parse --show-toplevel 2> /dev/null`
1233+ if (( $? != 0 )); then
1234+ PROJECT_ROOT="."
1235+ fi
1236 # Check for virtualenv name override
1237- ENV_NAME=`basename "$PROJECT_ROOT"`
1238 if [[ -f "$PROJECT_ROOT/.venv" ]]; then
1239 ENV_NAME=`cat "$PROJECT_ROOT/.venv"`
1240+ elif [[ "$PROJECT_ROOT" != "." ]]; then
1241+ ENV_NAME=`basename "$PROJECT_ROOT"`
1242+ else
1243+ ENV_NAME=""
1244 fi
1245- # Activate the environment only if it is not already active
1246- if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
1247- if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
1248- workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
1249+ if [[ "$ENV_NAME" != "" ]]; then
1250+ # Activate the environment only if it is not already active
1251+ if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
1252+ if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
1253+ workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
1254+ fi
1255 fi
1256+ elif [ $CD_VIRTUAL_ENV ]; then
1257+ # We've just left the repo, deactivate the environment
1258+ # Note: this only happens if the virtualenv was activated automatically
1259+ deactivate && unset CD_VIRTUAL_ENV
1260 fi
1261- elif [ $CD_VIRTUAL_ENV ]; then
1262- # We've just left the repo, deactivate the environment
1263- # Note: this only happens if the virtualenv was activated automatically
1264- deactivate && unset CD_VIRTUAL_ENV
1265+ unset PROJECT_ROOT
1266+ unset WORKON_CWD
1267 fi
1268- unset PROJECT_ROOT
1269 }
1270
1271- # New cd function that does the virtualenv magic
1272- function cd {
1273- builtin cd "$@" && workon_cwd
1274- }
1275+ # Append workon_cwd to the chpwd_functions array, so it will be called on cd
1276+ # http://zsh.sourceforge.net/Doc/Release/Functions.html
1277+ # TODO: replace with 'add-zsh-hook chpwd workon_cwd' when oh-my-zsh min version is raised above 4.3.4
1278+ if (( ${+chpwd_functions} )); then
1279+ if (( $chpwd_functions[(I)workon_cwd] == 0 )); then
1280+ set -A chpwd_functions $chpwd_functions workon_cwd
1281+ fi
1282+ else
1283+ set -A chpwd_functions workon_cwd
1284+ fi
1285 fi
1286 else
1287- print "zsh virtualenvwrapper plugin: Cannot find virtualenvwrapper_lazy.sh. Please install with \`pip install virtualenvwrapper\`."
1288+ print "zsh virtualenvwrapper plugin: Cannot find ${virtualenvwrapper}. Please install with \`pip install virtualenvwrapper\`."
1289 fi
1290diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh
1291new file mode 100644
1292index 0000000000000000000000000000000000000000..6b6de2b1585d758cace3c0f808972945058114c4
1293--- /dev/null
1294+++ b/plugins/web-search/web-search.plugin.zsh
1295@@ -0,0 +1,43 @@
1296+# web_search from terminal
1297+
1298+function web_search() {
1299+
1300+ # get the open command
1301+ local open_cmd
1302+ if [[ $(uname -s) == 'Darwin' ]]; then
1303+ open_cmd='open'
1304+ else
1305+ open_cmd='xdg-open'
1306+ fi
1307+
1308+ # check whether the search engine is supported
1309+ if [[ ! $1 =~ '(google|bing|yahoo)' ]];
1310+ then
1311+ echo "Search engine $1 not supported."
1312+ return 1
1313+ fi
1314+
1315+ local url="http://www.$1.com"
1316+
1317+ # no keyword provided, simply open the search engine homepage
1318+ if [[ $# -le 1 ]]; then
1319+ $open_cmd "$url"
1320+ return
1321+ fi
1322+
1323+ url="${url}/search?q="
1324+ shift # shift out $1
1325+
1326+ while [[ $# -gt 0 ]]; do
1327+ url="${url}$1+"
1328+ shift
1329+ done
1330+
1331+ url="${url%?}" # remove the last '+'
1332+
1333+ $open_cmd "$url"
1334+}
1335+
1336+alias bing='web_search bing'
1337+alias google='web_search google'
1338+alias yahoo='web_search yahoo'
1339diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
1340index a9de8c84ea8c8765edd5594df1d6eb9463fb22ab..c7a59ad0d67951960f1a9edb4544bd1da6aa849e 100644
1341--- a/themes/agnoster.zsh-theme
1342+++ b/themes/agnoster.zsh-theme
1343@@ -26,7 +26,7 @@
1344 # A few utility functions to make it easy and re-usable to draw segmented prompts
1345
1346 CURRENT_BG='NONE'
1347-SEGMENT_SEPARATOR='⮀'
1348+SEGMENT_SEPARATOR=''
1349
1350 # Begin a segment
1351 # Takes two arguments, background and foreground. Both can be omitted,
1352@@ -90,7 +90,7 @@ prompt_git() {
1353 zstyle ':vcs_info:*' formats ' %u%c'
1354 zstyle ':vcs_info:*' actionformats '%u%c'
1355 vcs_info
1356- echo -n "${ref/refs\/heads\//⭠ }${vcs_info_msg_0_}"
1357+ echo -n "${ref/refs\/heads\// }${vcs_info_msg_0_}"
1358 fi
1359 }
1360
1361@@ -110,7 +110,7 @@ prompt_hg() {
1362 # if working copy is clean
1363 prompt_segment green black
1364 fi
1365- echo -n $(hg prompt "⭠ {rev}@{branch}") $st
1366+ echo -n $(hg prompt " {rev}@{branch}") $st
1367 else
1368 st=""
1369 rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
1370@@ -124,7 +124,7 @@ prompt_hg() {
1371 else
1372 prompt_segment green black
1373 fi
1374- echo -n "⭠ $rev@$branch" $st
1375+ echo -n " $rev@$branch" $st
1376 fi
1377 fi
1378 }
1379@@ -134,6 +134,14 @@ prompt_dir() {
1380 prompt_segment blue black '%~'
1381 }
1382
1383+# Virtualenv: current working virtualenv
1384+prompt_virtualenv() {
1385+ local virtualenv_path="$VIRTUAL_ENV"
1386+ if [[ -n $virtualenv_path ]]; then
1387+ prompt_segment blue black "(`basename $virtualenv_path`)"
1388+ fi
1389+}
1390+
1391 # Status:
1392 # - was there an error
1393 # - am I root
1394@@ -152,6 +160,7 @@ prompt_status() {
1395 build_prompt() {
1396 RETVAL=$?
1397 prompt_status
1398+ prompt_virtualenv
1399 prompt_context
1400 prompt_dir
1401 prompt_git
1402diff --git a/themes/rkj-repos.zsh-theme b/themes/rkj-repos.zsh-theme
1403index 46b8e83a06e0eaa91d3ccb11b3ceba3d38ee5cef..4ab3bc75724992763451ebe2da0ccebf897a71fc 100644
1404--- a/themes/rkj-repos.zsh-theme
1405+++ b/themes/rkj-repos.zsh-theme
1406@@ -22,6 +22,8 @@ function mygit() {
1407 echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$( git_prompt_status )%{$reset_color%}$ZSH_THEME_GIT_PROMPT_SUFFIX"
1408 }
1409
1410+function retcode() {}
1411+
1412 # alternate prompt with git & hg
1413diff --git a/themes/rkj.zsh-theme b/themes/rkj.zsh-theme
1414index 80122d5c6e2c249635bf62647792e1ad0b41d877..fe06161c8225e45b17a7dd4017d3f02862b31cc6 100644
1415--- a/themes/rkj.zsh-theme
1416+++ b/themes/rkj.zsh-theme
1417@@ -2,7 +2,8 @@
1418 # on two lines for easier vgrepping
1419 # entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888
1420
1421+function retcode() {}
1422+
1423diff --git a/themes/superjarin.zsh-theme b/themes/superjarin.zsh-theme
1424index 86955a5605f01c1ab1e460b0a9a2ad743a9f61dd..2920d17a2831168a491c18d20b066ea570cb28f2 100644
1425--- a/themes/superjarin.zsh-theme
1426+++ b/themes/superjarin.zsh-theme
1427@@ -11,13 +11,13 @@ fi
1428 # Append the current git branch, if in a git repository
1429 JARIN_CURRENT_LOCA_="%{$fg_bold[cyan]%}%~\$(git_prompt_info)%{$reset_color%}"
1430 ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%} <%{$fg[magenta]%}"
1431-ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
1432+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[white]%}"
1433
1434 # Do nothing if the branch is clean (no changes).
1435-ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%}>"
1436+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[white]%}>"
1437
1438 # Add a yellow ✗ if the branch is dirty
1439-ZSH_THEME_GIT_PROMPT_DIRTY="%{$reset_color%}> %{$fg[yellow]%}✗"
1440+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[white]%}> %{$fg[yellow]%}✗"
1441
1442 # Put it all together!
1443 PROMPT="$JARIN_CURRENT_RUBY_ $JARIN_CURRENT_LOCA_ "
1444diff --git a/tools/upgrade.sh b/tools/upgrade.sh
1445index 0aeebdebf5e80262c83b81026f996145a3bb92a3..e04fc672f8b5f62775e00d8e0aad2958b5ed32e5 100644
1446--- a/tools/upgrade.sh
1447+++ b/tools/upgrade.sh
1448@@ -1,9 +1,6 @@
1449-current_path=`pwd`
1450-current_path=${current_path/ /\\ }
1451 printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh"
1452 cd "$ZSH"
1453-
1454-if git pull origin master
1455+if git pull --rebase origin master
1456 then
1457 printf '\033[0;32m%s\033[0m\n' ' __ __ '
1458 printf '\033[0;32m%s\033[0m\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
1459@@ -17,4 +14,3 @@ else
1460 printf '\033[0;31m%s\033[0m\n' 'There was an error updating. Try again later?'
1461 fi
1462
1463-cd "$current_path"