8105d4acc960229e8c7fa9dc6936d8ce881c6b8d
- Author
- zghember <zghpku@gmail.com>
- Committer
- zghember <zghpku@gmail.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/lib/git.zsh b/lib/git.zsh
2index 748520a6fa3dd2a48de8b3b619dec8a0f73abd26..118841f06efc88a698463a47698371c64619b5c5 100644
3--- a/lib/git.zsh
4+++ b/lib/git.zsh
5@@ -78,7 +78,7 @@ function git_prompt_long_sha() {
6 git_prompt_status() {
7 INDEX=$(command git status --porcelain -b 2> /dev/null)
8 STATUS=""
9- if $(echo "$INDEX" | grep -E '^\?\? ' &> /dev/null); then
10+ if $(echo "$INDEX" | command grep -E '^\?\? ' &> /dev/null); then
11 STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
12 fi
13 if $(echo "$INDEX" | grep '^A ' &> /dev/null); then
14diff --git a/lib/grep.zsh b/lib/grep.zsh
15index 276fec382ffbb056fc4f77ef01c0f0a94f22ef94..348ebe62316d8e3865949dcf01fd8906bd6c467b 100644
16--- a/lib/grep.zsh
17+++ b/lib/grep.zsh
18@@ -1,24 +1,24 @@
19-#
20-# Color grep results
21-# Examples: http://rubyurl.com/ZXv
22-#
23-
24-GREP_OPTIONS="--color=auto"
25-
26-# avoid VCS folders (if the necessary grep flags are available)
27+# is x grep argument available?
28 grep-flag-available() {
29 echo | grep $1 "" >/dev/null 2>&1
30 }
31+
32+# color grep results
33+GREP_OPTIONS="--color=auto"
34+
35+# ignore VCS folders (if the necessary grep flags are available)
36+VCS_FOLDERS="{.bzr,.cvs,.git,.hg,.svn}"
37+
38 if grep-flag-available --exclude-dir=.cvs; then
39- for PATTERN in .cvs .git .hg .svn; do
40- GREP_OPTIONS+=" --exclude-dir=$PATTERN"
41- done
42+ GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS"
43 elif grep-flag-available --exclude=.cvs; then
44- for PATTERN in .cvs .git .hg .svn; do
45- GREP_OPTIONS+=" --exclude=$PATTERN"
46- done
47+ GREP_OPTIONS+=" --exclude=$VCS_FOLDERS"
48 fi
49-unfunction grep-flag-available
50
51-export GREP_OPTIONS="$GREP_OPTIONS"
52-export GREP_COLOR='1;32'
53+# export grep settings
54+alias grep="grep $GREP_OPTIONS"
55+
56+# clean up
57+unset GREP_OPTIONS
58+unset VCS_FOLDERS
59+unfunction grep-flag-available
60diff --git a/lib/history.zsh b/lib/history.zsh
61index 1d83e56e3a63391133304d3f92596fab97fa1d55..e78a98e9e8da4e9a11d101dfa6fa1ffd7e9f9c32 100644
62--- a/lib/history.zsh
63+++ b/lib/history.zsh
64@@ -1,7 +1,8 @@
65 ## Command history configuration
66-if [ -z $HISTFILE ]; then
67+if [ -z "$HISTFILE" ]; then
68 HISTFILE=$HOME/.zsh_history
69 fi
70+
71 HISTSIZE=10000
72 SAVEHIST=10000
73
74diff --git a/lib/nvm.zsh b/lib/nvm.zsh
75index 5cadf706195fcb84b0f7e32f9f831d5cd2539a9a..61d997fc07806ccb114df0895a8c6dc4c96866d8 100644
76--- a/lib/nvm.zsh
77+++ b/lib/nvm.zsh
78@@ -1,6 +1,6 @@
79 # get the node.js version
80 function nvm_prompt_info() {
81- [ -f $HOME/.nvm/nvm.sh ] || return
82+ [ -f "$HOME/.nvm/nvm.sh" ] || return
83 local nvm_prompt
84 nvm_prompt=$(node -v 2>/dev/null)
85 [[ "${nvm_prompt}x" == "x" ]] && return
86diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh
87index 652d22696acfdbb109b185c5baae06ccad2d19c8..4cf0364013b2655dac01bf250d063ff2d7b2d1b5 100644
88--- a/plugins/autojump/autojump.plugin.zsh
89+++ b/plugins/autojump/autojump.plugin.zsh
90@@ -1,6 +1,8 @@
91 if [ $commands[autojump] ]; then # check if autojump is installed
92 if [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation
93 . $HOME/.autojump/etc/profile.d/autojump.zsh
94+ elif [ -f $HOME/.autojump/share/autojump/autojump.zsh ]; then # another manual user-local installation
95+ . $HOME/.autojump/share/autojump/autojump.zsh
96 elif [ -f $HOME/.nix-profile/etc/profile.d/autojump.zsh ]; then # nix installation
97 . $HOME/.nix-profile/etc/profile.d/autojump.zsh
98 elif [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package
99diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
100index de786725f6660624ae982684c346b320515a8c2f..0ae18dd561f9a052cb5a49a01b9ac7c2cd47203f 100644
101--- a/plugins/aws/aws.plugin.zsh
102+++ b/plugins/aws/aws.plugin.zsh
103@@ -22,7 +22,10 @@ function aws_profiles {
104 compctl -K aws_profiles asp
105
106 if _homebrew-installed && _awscli-homebrew-installed ; then
107- source $(brew --prefix)/opt/awscli/libexec/bin/aws_zsh_completer.sh
108+ _aws_zsh_completer_path=$(brew --prefix)/opt/awscli/libexec/bin/aws_zsh_completer.sh
109 else
110- source `which aws_zsh_completer.sh`
111+ _aws_zsh_completer_path=$(which aws_zsh_completer.sh)
112 fi
113+
114+[ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path
115+unset _aws_zsh_completer_path
116diff --git a/plugins/brew/_brew b/plugins/brew/_brew
117index 40442a1d3bc5fdb258ff2f21ba1b4c3495abfe4c..d11aa245de88d64c81d6b7fc6d082b0498dbce93 100644
118--- a/plugins/brew/_brew
119+++ b/plugins/brew/_brew
120@@ -19,21 +19,18 @@ _brew_outdated_formulae() {
121 outdated_formulae=(`brew outdated`)
122 }
123
124-_brew_running_services() {
125- running_services=(`brew services list | awk '{print $1}'`)
126-}
127-
128 local -a _1st_arguments
129 _1st_arguments=(
130 'audit:check formulae for Homebrew coding style'
131- 'bundle:look for a Brewfile and run each line as a brew command'
132 'cat:display formula file for a formula'
133 'cleanup:uninstall unused and old versions of packages'
134 'commands:show a list of commands'
135 'create:create a new formula'
136- 'deps:list dependencies and dependants of a formula'
137+ 'deps:list dependencies of a formula'
138 'doctor:audits your installation for common issues'
139 'edit:edit a formula'
140+ 'fetch:download formula resources to the cache'
141+ 'gist-logs:generate a gist of the full build logs'
142 'home:visit the homepage of a formula or the brew project'
143 'info:information about a formula'
144 'install:install a formula'
145@@ -44,32 +41,24 @@ _1st_arguments=(
146 'missing:check all installed formuale for missing dependencies.'
147 'outdated:list formulae for which a newer version is available'
148 'pin:pin specified formulae'
149+ 'postinstall:perform post_install for a given formula'
150 'prune:remove dead links'
151 'remove:remove a formula'
152 'search:search for a formula (/regex/ or string)'
153- 'server:start a local web app that lets you browse formulae (requires Sinatra)'
154- 'services:small wrapper around `launchctl` for supported formulae'
155+ 'switch:switch linkage between installed versions of a formula'
156 'tap:tap a new formula repository from GitHub, or list existing taps'
157+ 'test-bot:test a formula and build a bottle'
158 'uninstall:uninstall a formula'
159 'unlink:unlink a formula'
160 'unpin:unpin specified formulae'
161 'untap:remove a tapped repository'
162- 'update:freshen up links'
163+ 'update:pull latest repository'
164 'upgrade:upgrade outdated formulae'
165 'uses:show formulae which depend on a formula'
166 )
167
168-local -a _service_arguments
169-_service_arguments=(
170- 'cleanup:get rid of stale services and unused plists'
171- 'list:list all services managed by `brew services`'
172- 'restart:gracefully restart selected service'
173- 'start:start selected service'
174- 'stop:stop selected service'
175-)
176-
177 local expl
178-local -a formulae installed_formulae installed_taps outdated_formulae running_services
179+local -a formulae installed_formulae installed_taps outdated_formulae
180
181 _arguments \
182 '(-v)-v[verbose]' \
183@@ -80,6 +69,7 @@ _arguments \
184 '(--version)--version[version information]' \
185 '(--prefix)--prefix[where brew lives on this system]' \
186 '(--cache)--cache[brew cache]' \
187+ '(--force)--force[brew force]' \
188 '*:: :->subcmds' && return 0
189
190 if (( CURRENT == 1 )); then
191@@ -109,16 +99,6 @@ case "$words[1]" in
192 _arguments \
193 '(--macports)--macports[search the macports repository]' \
194 '(--fink)--fink[search the fink repository]' ;;
195- services)
196- if [[ -n "$words[2]" ]]; then
197- case "$words[2]" in
198- restart|start|stop)
199- _brew_running_services
200- _wanted running_services expl 'running services' compadd -a running_services ;;
201- esac
202- else
203- _describe -t commands "brew services subcommand" _service_arguments
204- fi ;;
205 untap)
206 _brew_installed_taps
207 _wanted installed_taps expl 'installed taps' compadd -a installed_taps ;;
208diff --git a/plugins/chruby/chruby.plugin.zsh b/plugins/chruby/chruby.plugin.zsh
209index 2a2c80cf67e637fada84a931134debb3e5f1df15..b461b0c9be7d5b39a27ebc7d646e93434e57e15a 100644
210--- a/plugins/chruby/chruby.plugin.zsh
211+++ b/plugins/chruby/chruby.plugin.zsh
212@@ -24,7 +24,7 @@ _homebrew-installed() {
213 }
214
215 _chruby-from-homebrew-installed() {
216- brew --prefix chruby &> /dev/null
217+ [ -r $(brew --prefix chruby)] &> /dev/null
218 }
219
220 _ruby-build_installed() {
221@@ -45,11 +45,11 @@ _source_from_omz_settings() {
222 zstyle -s :omz:plugins:chruby path _chruby_path
223 zstyle -s :omz:plugins:chruby auto _chruby_auto
224
225- if _chruby_path && [[ -r _chruby_path ]]; then
226+ if ${_chruby_path} && [[ -r ${_chruby_path} ]]; then
227 source ${_chruby_path}
228 fi
229
230- if _chruby_auto && [[ -r _chruby_auto ]]; then
231+ if ${_chruby_auto} && [[ -r ${_chruby_auto} ]]; then
232 source ${_chruby_auto}
233 fi
234 }
235diff --git a/plugins/dircycle/dircycle.plugin.zsh b/plugins/dircycle/dircycle.plugin.zsh
236index 46a0ab268796c897de82a82c6108641446fb596c..c6b6ba78576f5d1d51b79ee642f9a8b7210057dd 100644
237--- a/plugins/dircycle/dircycle.plugin.zsh
238+++ b/plugins/dircycle/dircycle.plugin.zsh
239@@ -5,6 +5,6 @@
240 eval "insert-cycledleft () { zle push-line; LBUFFER='pushd -q +1'; zle accept-line }"
241 zle -N insert-cycledleft
242 bindkey "\e[1;6D" insert-cycledleft
243-eval "insert-cycledright () { zle push-line; LBUFFER='pushd -q -0'; zle accept-line }"
244+eval "insert-cycledright () { zle push-line; LBUFFER='pushd -q +0'; zle accept-line }"
245 zle -N insert-cycledright
246 bindkey "\e[1;6C" insert-cycledright
247diff --git a/plugins/docker/_docker b/plugins/docker/_docker
248index 28568a6e5d0841bd8090a75f1e28b0221332134b..880b6faa6fec9de9241f376209beca5b3e76d6cd 100644
249--- a/plugins/docker/_docker
250+++ b/plugins/docker/_docker
251@@ -4,6 +4,7 @@
252 # Requires: Docker installed
253 # Author: Azaan (@aeonazaan)
254 # Updates: Bob Maerten (@bobmaerten) for Docker v0.9+
255+# Paul van den Berg (@bergvandenp) for Docker v1.3+
256
257
258 # ----- Helper functions
259@@ -238,6 +239,14 @@ __wait() {
260 __docker_containers
261 }
262
263+__exec() {
264+ _arguments \
265+ '(-d,--detach=)'{-d,--detach=}'[Detached mode: run command in the background]' \
266+ '(-i,--interactive=)'{-i,--interactive=}'[Keep STDIN open even if not attached]' \
267+ '(-t,--tty=)'{-t,--tty=}'[Allocate a pseudo-TTY]'
268+ __docker_containers
269+}
270+
271 # end commands ---------
272 # ----------------------
273
274@@ -276,6 +285,7 @@ _1st_arguments=(
275 "top":"Lookup the running processes of a container"
276 "version":"Show the docker version information"
277 "wait":"Block until a container stops, then print its exit code"
278+ "exec":"Run a task inside a running container"
279 )
280
281 _arguments '*:: :->command'
282@@ -353,4 +363,6 @@ case "$words[1]" in
283 __version ;;
284 wait)
285 __wait ;;
286+ exec)
287+ __exec ;;
288 esac
289diff --git a/plugins/heroku/_heroku b/plugins/heroku/_heroku
290index 46663303ac8e50ab7e491881a9bc03c23509a850..bb2f7403f697f6b24bbd80f8a343fcd423a94cbe 100644
291--- a/plugins/heroku/_heroku
292+++ b/plugins/heroku/_heroku
293@@ -27,8 +27,6 @@ _1st_arguments=(
294 "config\:push":"push local config vars to heroku"
295 "config\:set":"set one or more config vars"
296 "config\:unset":"unset one or more config vars"
297- "db\:push":"push local data up to your app"
298- "db\:pull":"pull heroku data down into your local database"
299 "domains":"list custom domains for an app"
300 "domains\:add":"add a custom domain to an app"
301 "domains\:remove":"remove a custom domain from an app"
302@@ -43,12 +41,20 @@ _1st_arguments=(
303 "logs\:drains":"manage syslog drains"
304 "maintenance\:on":"put the app into maintenance mode"
305 "maintenance\:off":"take the app out of maintenance mode"
306+ "pg\:credentials":"display the DATABASE credentials"
307+ "pg\:diagnose":"run diagnostics report on DATABASE"
308 "pg\:info":"display database information"
309- "pg\:ingress":"allow direct connections to the database from this IP for one minute"
310+ "pg\:kill":"kill a query"
311+ "pg\:killall":"terminates ALL connections"
312+ "pg\:maintenance":"manage maintenance for DATABASE"
313 "pg\:promote":"sets DATABASE as your DATABASE_URL"
314+ "pg\:ps":"view active queries with execution time"
315 "pg\:psql":"open a psql shell to the database"
316+ "pg\:pull":"pull from REMOTE_SOURCE_DATABASE to LOCAL_TARGET_DATABASE"
317+ "pg\:push":"push from LOCAL_SOURCE_DATABASE to REMOTE_TARGET_DATABASE"
318 "pg\:reset":"delete all data in DATABASE"
319 "pg\:unfollow":"stop a replica from following and make it a read/write database"
320+ "pg\:upgrade":"unfollow a database and upgrade it to the latest PostgreSQL version"
321 "pg\:wait":"monitor database creation, exit when complete"
322 "pgbackups":"list captured backups"
323 "pgbackups\:url":"get a temporary URL for a backup"
324@@ -108,26 +114,6 @@ case "$words[1]" in
325 '(-s|--shell)'{-s,--shell}'[output config vars in shell format]' \
326 )
327 ;;
328- db:push)
329- _command_args=(
330- '(-c|--chunksize)'{-c,--chunksize}'[specify the number of rows to send in each batch]' \
331- '(-d|--debug)'{-d,--debug}'[enable debugging output]' \
332- '(-e|--exclude)'{-e,--exclude}'[exclude the specified tables from the push]' \
333- '(-f|--filter)'{-f,--filter}'[only push certain tables]' \
334- '(-r|--resume)'{-r,--resume}'[resume transfer described by a .dat file]' \
335- '(-t|--tables)'{-t,--tables}'[only push the specified tables]' \
336- )
337- ;;
338- db:pull)
339- _command_args=(
340- '(-c|--chunksize)'{-c,--chunksize}'[specify the number of rows to send in each batch]' \
341- '(-d|--debug)'{-d,--debug}'[enable debugging output]' \
342- '(-e|--exclude)'{-e,--exclude}'[exclude the specified tables from the pull]' \
343- '(-f|--filter)'{-f,--filter}'[only pull certain tables]' \
344- '(-r|--resume)'{-r,--resume}'[resume transfer described by a .dat file]' \
345- '(-t|--tables)'{-t,--tables}'[only pull the specified tables]' \
346- )
347- ;;
348 keys)
349 _command_args=(
350 '(-l|--long)'{-l,--long}'[display extended information for each key]' \
351diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh
352index ff95d5e40093d796783c2a72e0a8226dcc2d6ec2..ed4d23713dca292151e0dfd8c0e228ad0e000038 100644
353--- a/plugins/mercurial/mercurial.plugin.zsh
354+++ b/plugins/mercurial/mercurial.plugin.zsh
355@@ -42,7 +42,7 @@ $ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_HG_PROMPT_SU
356
357 function hg_dirty_choose {
358 if [ $(in_hg) ]; then
359- hg status 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'
360+ hg status 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'
361 if [ $pipestatus[-1] -eq 0 ]; then
362 # Grep exits with 0 when "One or more lines were selected", return "dirty".
363 echo $1
364diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
365index 2eea0d8ef1b5de801dd43a03b86d964e30cd2113..d366f1fc879f19c060e3a7606dafaa96133ad34e 100644
366--- a/plugins/osx/osx.plugin.zsh
367+++ b/plugins/osx/osx.plugin.zsh
368@@ -177,12 +177,43 @@ function itunes() {
369 vol)
370 opt="set sound volume to $1" #$1 Due to the shift
371 ;;
372+ shuf|shuff|shuffle)
373+ # The shuffle property of current playlist can't be changed in iTunes 12,
374+ # so this workaround uses AppleScript to simulate user input instead.
375+ # Defaults to toggling when no options are given.
376+ # The toggle option depends on the shuffle button being visible in the Now playing area.
377+ # On and off use the menu bar items.
378+ local state=$1
379+
380+ if [[ -n "$state" && ! "$state" =~ "^(on|off|toggle)$" ]]
381+ then
382+ print "Usage: itunes shuffle [on|off|toggle]. Invalid option."
383+ return 1
384+ fi
385+
386+ case "$state" in
387+ on|off)
388+ # Inspired by: http://stackoverflow.com/a/14675583
389+ osascript 1>/dev/null 2>&1 <<-EOF
390+ tell application "System Events" to perform action "AXPress" of (menu item "${state}" of menu "Shuffle" of menu item "Shuffle" of menu "Controls" of menu bar item "Controls" of menu bar 1 of application process "iTunes" )
391+EOF
392+ return 0
393+ ;;
394+ toggle|*)
395+ osascript 1>/dev/null 2>&1 <<-EOF
396+ tell application "System Events" to perform action "AXPress" of (button 2 of process "iTunes"'s window "iTunes"'s scroll area 1)
397+EOF
398+ return 0
399+ ;;
400+ esac
401+ ;;
402 ""|-h|--help)
403 echo "Usage: itunes <option>"
404 echo "option:"
405 echo "\tlaunch|play|pause|stop|rewind|resume|quit"
406 echo "\tmute|unmute\tcontrol volume set"
407 echo "\tnext|previous\tplay next or previous track"
408+ echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer."
409 echo "\tvol\tSet the volume, takes an argument from 0 to 100"
410 echo "\thelp\tshow this message and exit"
411 return 0
412diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/phing.plugin.zsh
413index 795f1db852874932e0331bb5bcb9e14ba59bdd50..1f022047c1bbe71990684a4e67ac247ffb970eb5 100644
414--- a/plugins/phing/phing.plugin.zsh
415+++ b/plugins/phing/phing.plugin.zsh
416@@ -1,13 +1,13 @@
417 _phing_does_target_list_need_generating () {
418 [ ! -f .phing_targets ] && return 0;
419- [ .phing_targets -nt build.xml ] && return 0;
420+ [ build.xml -nt .phing_targets ] && return 0;
421 return 1;
422 }
423
424 _phing () {
425 if [ -f build.xml ]; then
426 if _phing_does_target_list_need_generating; then
427- phing -l |grep -v ":$" |grep -v "^-*$" > .phing_targets
428+ phing -l|grep -v "\[property\]"|grep -v "Buildfile"|sed 1d|grep -v ":$" |grep -v "^\-*$"|awk '{print $1}' > .phing_targets
429 fi
430 compadd `cat .phing_targets`
431 fi
432diff --git a/plugins/svn-fast-info/svn-fast-info.plugin.zsh b/plugins/svn-fast-info/svn-fast-info.plugin.zsh
433index ea19bcea07f2d71e04a2ad49e5e4811ab4953ea3..9ea7f641dc1e0a243ef6f587e6dd71bb2d5bd860 100644
434--- a/plugins/svn-fast-info/svn-fast-info.plugin.zsh
435+++ b/plugins/svn-fast-info/svn-fast-info.plugin.zsh
436@@ -63,11 +63,11 @@ function svn_current_revision() {
437 function svn_status_info() {
438 local svn_status_string="$ZSH_THEME_SVN_PROMPT_CLEAN"
439 local svn_status="$(svn status 2> /dev/null)";
440- if grep -E '^\s*A' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"; fi
441- if grep -E '^\s*D' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DELETIONS:-✖}"; fi
442- if grep -E '^\s*M' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-✎}"; fi
443- if grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-∿}"; fi
444- if grep -E '^\s*\?' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"; fi
445- if grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DIRTY:-'!'}"; fi
446+ if command grep -E '^\s*A' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"; fi
447+ if command grep -E '^\s*D' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DELETIONS:-✖}"; fi
448+ if command grep -E '^\s*M' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-✎}"; fi
449+ if command grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-∿}"; fi
450+ if command grep -E '^\s*\?' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"; fi
451+ if command grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DIRTY:-'!'}"; fi
452 echo $svn_status_string
453 }
454diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh
455index ba281d7909499529a6fcbd4e988078b2f32a22d5..9f7a4c6eb4721c57b5f6c1b710a052b494248dc9 100644
456--- a/plugins/svn/svn.plugin.zsh
457+++ b/plugins/svn/svn.plugin.zsh
458@@ -61,7 +61,7 @@ function svn_get_rev_nr() {
459 function svn_dirty_choose() {
460 if in_svn; then
461 root=`svn info 2> /dev/null | sed -n 's/^Working Copy Root Path: //p'`
462- if $(svn status $root 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'); then
463+ if $(svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'); then
464 # Grep exits with 0 when "One or more lines were selected", return "dirty".
465 echo $1
466 else
467@@ -78,7 +78,7 @@ function svn_dirty() {
468 function svn_dirty_choose_pwd () {
469 if in_svn; then
470 root=$PWD
471- if $(svn status $root 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'); then
472+ if $(svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'); then
473 # Grep exits with 0 when "One or more lines were selected", return "dirty".
474 echo $1
475 else
476diff --git a/plugins/symfony2/symfony2.plugin.zsh b/plugins/symfony2/symfony2.plugin.zsh
477index 8df22e9ad4438ecfed0cc9a44cbcc492f62c5f4c..7a19cbdd3fabe6cddb8739024844145dc1330e11 100644
478--- a/plugins/symfony2/symfony2.plugin.zsh
479+++ b/plugins/symfony2/symfony2.plugin.zsh
480@@ -5,7 +5,7 @@ _symfony_console () {
481 }
482
483 _symfony2_get_command_list () {
484- `_symfony_console` --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
485+ `_symfony_console` --no-ansi | sed "1,/Available commands/d" | awk '/^ ?[a-z]+/ { print $1 }'
486 }
487
488 _symfony2 () {
489@@ -23,4 +23,4 @@ alias sfcl='sf cache:clear'
490 alias sfcw='sf cache:warmup'
491 alias sfroute='sf router:debug'
492 alias sfcontainer='sf container:debug'
493-alias sfgb='sf generate:bundle'
494+alias sfgb='sf generate:bundle'
495diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh
496index 626c41f3d72a47dd56b4846bf9e8a1c8b28c3fd3..bc32c8907312353ee849eeb97babb6aa2b4cbc0b 100644
497--- a/plugins/tmux/tmux.plugin.zsh
498+++ b/plugins/tmux/tmux.plugin.zsh
499@@ -5,6 +5,8 @@
500 alias ta='tmux attach -t'
501 alias ts='tmux new-session -s'
502 alias tl='tmux list-sessions'
503+alias tksv='tmux kill-server'
504+alias tkss='tmux kill-session -t'
505
506 # Only run if tmux is actually installed
507 if which tmux &> /dev/null
508diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
509index f58bda1ad40a763a733b8532cdd684080bc36173..52e02d3e01390c77f669d2fa657d2b65e7ae5029 100644
510--- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
511+++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
512@@ -1,57 +1,63 @@
513 virtualenvwrapper='virtualenvwrapper.sh'
514 if (( $+commands[$virtualenvwrapper] )); then
515+
516 source ${${virtualenvwrapper}:c}
517
518- if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
519- # Automatically activate Git projects's virtual environments based on the
520- # directory name of the project. Virtual environment name can be overridden
521- # by placing a .venv file in the project root with a virtualenv name in it
522- function workon_cwd {
523+ if [[ "$WORKON_HOME" == "" ]]; then
524+ echo "\$WORKON_HOME is not defined so ZSH plugin virtualenvwrapper will not work"
525+ else
526+
527+ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
528+ # Automatically activate Git projects's virtual environments based on the
529+ # directory name of the project. Virtual environment name can be overridden
530+ # by placing a .venv file in the project root with a virtualenv name in it
531+ function workon_cwd {
532 if [ ! $WORKON_CWD ]; then
533- WORKON_CWD=1
534- # Check if this is a Git repo
535- PROJECT_ROOT=`git rev-parse --show-toplevel 2> /dev/null`
536- if (( $? != 0 )); then
537- PROJECT_ROOT="."
538- fi
539- # Check for virtualenv name override
540- if [[ -f "$PROJECT_ROOT/.venv" ]]; then
541- ENV_NAME=`cat "$PROJECT_ROOT/.venv"`
542- elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]];then
543- ENV_NAME="$PROJECT_ROOT/.venv"
544- elif [[ "$PROJECT_ROOT" != "." ]]; then
545- ENV_NAME=`basename "$PROJECT_ROOT"`
546- else
547- ENV_NAME=""
548- fi
549- if [[ "$ENV_NAME" != "" ]]; then
550- # Activate the environment only if it is not already active
551- if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
552- if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
553- workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
554- elif [[ -e "$ENV_NAME/bin/activate" ]]; then
555- source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME"
556- fi
557- fi
558- elif [ $CD_VIRTUAL_ENV ]; then
559- # We've just left the repo, deactivate the environment
560- # Note: this only happens if the virtualenv was activated automatically
561- deactivate && unset CD_VIRTUAL_ENV
562+ WORKON_CWD=1
563+ # Check if this is a Git repo
564+ PROJECT_ROOT=`git rev-parse --show-toplevel 2> /dev/null`
565+ if (( $? != 0 )); then
566+ PROJECT_ROOT="."
567+ fi
568+ # Check for virtualenv name override
569+ if [[ -f "$PROJECT_ROOT/.venv" ]]; then
570+ ENV_NAME=`cat "$PROJECT_ROOT/.venv"`
571+ elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]];then
572+ ENV_NAME="$PROJECT_ROOT/.venv"
573+ elif [[ "$PROJECT_ROOT" != "." ]]; then
574+ ENV_NAME=`basename "$PROJECT_ROOT"`
575+ else
576+ ENV_NAME=""
577+ fi
578+ if [[ "$ENV_NAME" != "" ]]; then
579+ # Activate the environment only if it is not already active
580+ if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
581+ if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
582+ workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
583+ elif [[ -e "$ENV_NAME/bin/activate" ]]; then
584+ source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME"
585+ fi
586 fi
587- unset PROJECT_ROOT
588- unset WORKON_CWD
589+ elif [ $CD_VIRTUAL_ENV ]; then
590+ # We've just left the repo, deactivate the environment
591+ # Note: this only happens if the virtualenv was activated automatically
592+ deactivate && unset CD_VIRTUAL_ENV
593+ fi
594+ unset PROJECT_ROOT
595+ unset WORKON_CWD
596 fi
597- }
598+ }
599
600- # Append workon_cwd to the chpwd_functions array, so it will be called on cd
601- # http://zsh.sourceforge.net/Doc/Release/Functions.html
602- # TODO: replace with 'add-zsh-hook chpwd workon_cwd' when oh-my-zsh min version is raised above 4.3.4
603- if (( ${+chpwd_functions} )); then
604+ # Append workon_cwd to the chpwd_functions array, so it will be called on cd
605+ # http://zsh.sourceforge.net/Doc/Release/Functions.html
606+ # TODO: replace with 'add-zsh-hook chpwd workon_cwd' when oh-my-zsh min version is raised above 4.3.4
607+ if (( ${+chpwd_functions} )); then
608 if (( $chpwd_functions[(I)workon_cwd] == 0 )); then
609- set -A chpwd_functions $chpwd_functions workon_cwd
610+ set -A chpwd_functions $chpwd_functions workon_cwd
611 fi
612diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh
613index 371e3a303189793797c1a65e404f28d2c76ae14d..28559deb9d084895371a348ee89585be703b0b33 100644
614--- a/plugins/web-search/web-search.plugin.zsh
615+++ b/plugins/web-search/web-search.plugin.zsh
616@@ -37,8 +37,7 @@ function web_search() {
617 done
618
619 url="${url%?}" # remove the last '+'
620- nohup $open_cmd "$url"
621- rm nohup.out
622+ nohup $open_cmd "$url" >/dev/null 2&>1
623 }
624
625
626diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh
627index b7b75cf9376c16e4196c4457b3728660482e72a3..1d1205b80887400804f6a45f8d96c17a71507ef4 100644
628--- a/plugins/xcode/xcode.plugin.zsh
629+++ b/plugins/xcode/xcode.plugin.zsh
630@@ -16,6 +16,7 @@ function xcsel {
631
632 alias xcb='xcodebuild'
633 alias xcp='xcode-select --print-path'
634+alias xcdd='rm -rf ~/Library/Developer/Xcode/DerivedData/*'
635
636 if [[ -d $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app ]]; then
637 alias simulator='open $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'
638diff --git a/plugins/yii2/README.md b/plugins/yii2/README.md
639new file mode 100644
640index 0000000000000000000000000000000000000000..345b66eb61faf883985de78d84860267d25d49b9
641--- /dev/null
642+++ b/plugins/yii2/README.md
643@@ -0,0 +1,7 @@
644+# Yii2 autocomplete plugin
645+
646+* Adds autocomplete commands and subcommands for yii.
647+
648+## Requirements
649+
650+Autocomplete works from directory where your `yii` file contains.
651diff --git a/plugins/yii2/yii2.plugin.zsh b/plugins/yii2/yii2.plugin.zsh
652new file mode 100644
653index 0000000000000000000000000000000000000000..e8993adf4f6ed4884f8977d7c50935d0ef097f3d
654--- /dev/null
655+++ b/plugins/yii2/yii2.plugin.zsh
656@@ -0,0 +1,29 @@
657+# Yii2 command completion
658+
659+_yii2_format_command () {
660+ awk '/^- [a-z]+/ { sub(":", "", $2); print $2 }'
661+}
662+
663+_yii2 () {
664+ if [ -f ./yii ]; then
665+ _arguments \
666+ '1: :->command'\
667+ '*: :->params'
668+
669+ case $state in
670+ command)
671+
672+ local -a commands
673+ local -a name
674+
675+ if [[ $words[2] == *\/ ]]; then
676+ name=$words[2]
677+ fi
678+
679+ commands=(${(f)"$(./yii help $name --color=0 | _yii2_format_command)"})
680+ compadd -Q -S '' -a -- commands
681+ esac
682+ fi
683+}
684+
685+compdef _yii2 yii
686diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
687index 7a62bd860802d3f093d28eb2387bd26f4e427ea1..8c7be6e0123e95f7c737966e3f975d8a67102808 100644
688--- a/themes/agnoster.zsh-theme
689+++ b/themes/agnoster.zsh-theme
690@@ -123,10 +123,10 @@ prompt_hg() {
691 st=""
692 rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
693 branch=$(hg id -b 2>/dev/null)
694- if `hg st | grep -Eq "^\?"`; then
695+ if `hg st | grep -q "^\?"`; then
696 prompt_segment red black
697 st='±'
698- elif `hg st | grep -Eq "^(M|A)"`; then
699+ elif `hg st | grep -q "^(M|A)"`; then
700 prompt_segment yellow black
701 st='±'
702 else
703diff --git a/themes/bureau.zsh-theme b/themes/bureau.zsh-theme
704index 443d1d5ee736621b92a2123126c2e01a2f759f95..148abec10e9cb207fac5dc35e2398e9979d688a6 100644
705--- a/themes/bureau.zsh-theme
706+++ b/themes/bureau.zsh-theme
707@@ -31,7 +31,7 @@ bureau_git_status () {
708 if $(echo "$_INDEX" | grep '^.[MTD] ' &> /dev/null); then
709 _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED"
710 fi
711- if $(echo "$_INDEX" | grep -E '^\?\? ' &> /dev/null); then
712+ if $(echo "$_INDEX" | command grep -E '^\?\? ' &> /dev/null); then
713 _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED"
714 fi
715 if $(echo "$_INDEX" | grep '^UU ' &> /dev/null); then
716diff --git a/themes/mira.zsh-theme b/themes/mira.zsh-theme
717new file mode 100644
718index 0000000000000000000000000000000000000000..e6c952998657ab64b402ed085913ab654a5e7485
719--- /dev/null
720+++ b/themes/mira.zsh-theme
721@@ -0,0 +1,29 @@
722+# Based on bira zsh theme with nvm, rvm and jenv support
723+local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
724+
725+local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
726+local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
727+
728+local rvm_ruby=''
729+if which rvm-prompt &> /dev/null; then
730+ rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
731+else
732+ if which rbenv &> /dev/null; then
733+ rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}'
734+ fi
735+fi
736+
737+local nvm_node=''
738+nvm_node='%{$fg[green]%}‹node-$(nvm_prompt_info)›%{$reset_color%}'
739+
740+local jenv_java=''
741+jenv_java='%{$fg[blue]%}‹$(jenv_prompt_info)›%{$reset_color%}'
742+
743+local git_branch='$(git_prompt_info)%{$reset_color%}'
744+
745+PROMPT="╭─${user_host} ${current_dir} ${nvm_node} ${rvm_ruby} ${jenv_java} ${git_branch}
746+╰─%B$%b "
747+RPS1="${return_code}"
748+
749+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}("
750+ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}"
751diff --git a/themes/mortalscumbag.zsh-theme b/themes/mortalscumbag.zsh-theme
752index 5dbf2e4f69417aa99423cad14509dce9579ee6dd..ccce4197ac29e5c1ac85d5dc8b4280fa567e973b 100644
753--- a/themes/mortalscumbag.zsh-theme
754+++ b/themes/mortalscumbag.zsh-theme
755@@ -10,12 +10,12 @@ function my_git_prompt() {
756 fi
757
758 # is anything staged?
759- if $(echo "$INDEX" | grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then
760+ if $(echo "$INDEX" | command grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then
761 STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED"
762 fi
763
764 # is anything unstaged?
765- if $(echo "$INDEX" | grep -E -e '^[ MARC][MD] ' &> /dev/null); then
766+ if $(echo "$INDEX" | command grep -E -e '^[ MARC][MD] ' &> /dev/null); then
767 STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED"
768 fi
769
770@@ -25,7 +25,7 @@ function my_git_prompt() {
771 fi
772
773 # is anything unmerged?
774- if $(echo "$INDEX" | grep -E -e '^(A[AU]|D[DU]|U[ADU]) ' &> /dev/null); then
775+ if $(echo "$INDEX" | command grep -E -e '^(A[AU]|D[DU]|U[ADU]) ' &> /dev/null); then
776 STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED"
777 fi
778
779diff --git a/themes/rkj-repos.zsh-theme b/themes/rkj-repos.zsh-theme
780index 6289427c202a2e1f9ea22b65a2272a184930d664..eed084f15a9eb722095aaea1262ba06ad32e835f 100644
781--- a/themes/rkj-repos.zsh-theme
782+++ b/themes/rkj-repos.zsh-theme
783@@ -4,7 +4,7 @@
784
785 function hg_prompt_info {
786 hg prompt --angle-brackets "\
787-<hg:%{$fg[magenta]%}<branch>%{$reset_color%}>\
788+<hg:%{$fg[magenta]%}<branch>%{$reset_color%}><:%{$fg[magenta]%}<bookmark>%{$reset_color%}>\
789 </%{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\
790 %{$fg[red]%}<status|modified|unknown><update>%{$reset_color%}<
791 patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset_color%})|pre_unapplied(%{$fg_bold[black]%})|post_unapplied(%{$reset_color%})>>" 2>/dev/null
792diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
793index 4a0803210e85a57e1d24f13229521a2d4caa0f2c..b2b356e0cb957a0701b29732be1a2a43cd760e12 100644
794--- a/tools/check_for_upgrade.sh
795+++ b/tools/check_for_upgrade.sh
796@@ -22,8 +22,6 @@ if [[ -z "$epoch_target" ]]; then
797 epoch_target=13
798 fi
799
800-[ -f ~/.profile ] && source ~/.profile
801-
802 # Cancel upgrade if the current user doesn't have write permissions for the
803 # oh-my-zsh directory.
804 [[ -w "$ZSH" ]] || return 0