6fd0b73e9aba568640005798f737cd73ad0bfdf4
- 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/completion.zsh b/lib/completion.zsh
2index fa1d97f4840fbcc6b60f2c385ffe9c98baa7cd5d..3a19a4eba17a99faf2481a85110bea4f5937b9e7 100644
3--- a/lib/completion.zsh
4+++ b/lib/completion.zsh
5@@ -25,7 +25,12 @@ bindkey -M menuselect '^o' accept-and-infer-next-history
6
7 zstyle ':completion:*:*:*:*:*' menu select
8 zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
9-zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
10+if [ "$OSTYPE[0,7]" = "solaris" ]
11+then
12+ zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm"
13+else
14+ zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
15+fi
16
17 # disable named-directories autocompletion
18 zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
19diff --git a/lib/git.zsh b/lib/git.zsh
20index 7aa5a0ea2fe8f928681efdb3857af10587c3abc3..748520a6fa3dd2a48de8b3b619dec8a0f73abd26 100644
21--- a/lib/git.zsh
22+++ b/lib/git.zsh
23@@ -10,23 +10,20 @@ function git_prompt_info() {
24
25 # Checks if working tree is dirty
26 parse_git_dirty() {
27- local SUBMODULE_SYNTAX=''
28- local GIT_STATUS=''
29- local CLEAN_MESSAGE='nothing to commit (working directory clean)'
30- if [[ "$(command git config --get oh-my-zsh.hide-status)" != "1" ]]; then
31+ local STATUS=''
32+ local FLAGS
33+ FLAGS=('--porcelain')
34+ if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
35 if [[ $POST_1_7_2_GIT -gt 0 ]]; then
36- SUBMODULE_SYNTAX="--ignore-submodules=dirty"
37+ FLAGS+='--ignore-submodules=dirty'
38 fi
39 if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
40- GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null | tail -n1)
41- else
42- GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
43- fi
44- if [[ -n $GIT_STATUS ]]; then
45- echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
46- else
47- echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
48+ FLAGS+='--untracked-files=no'
49 fi
50+ STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
51+ fi
52+ if [[ -n $STATUS ]]; then
53+ echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
54 else
55 echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
56 fi
57@@ -135,17 +132,19 @@ function git_compare_version() {
58 INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
59
60 for i in {1..3}; do
61+ if [[ $INSTALLED_GIT_VERSION[$i] -gt $INPUT_GIT_VERSION[$i] ]]; then
62+ echo 1
63+ return 0
64+ fi
65 if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then
66 echo -1
67 return 0
68 fi
69 done
70- echo 1
71+ echo 0
72 }
73
74 #this is unlikely to change so make it all statically assigned
75 POST_1_7_2_GIT=$(git_compare_version "1.7.2")
76 #clean up the namespace slightly by removing the checker function
77 unset -f git_compare_version
78-
79-
80diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
81index d0e89f31bad238dd2716779524b6765839a1bba3..d75b521c76c0e2192f42d92b709bbe414b22998f 100644
82--- a/oh-my-zsh.sh
83+++ b/oh-my-zsh.sh
84@@ -8,18 +8,20 @@ fi
85 # add a function path
86 fpath=($ZSH/functions $ZSH/completions $fpath)
87
88-# Load all of the config files in ~/oh-my-zsh that end in .zsh
89-# TIP: Add files you don't want in git to .gitignore
90-for config_file ($ZSH/lib/*.zsh); do
91- source $config_file
92-done
93-
94 # Set ZSH_CUSTOM to the path where your custom config files
95 # and plugins exists, or else we will use the default custom/
96 if [[ -z "$ZSH_CUSTOM" ]]; then
97 ZSH_CUSTOM="$ZSH/custom"
98 fi
99
100+# Load all of the config files in ~/oh-my-zsh that end in .zsh
101+# TIP: Add files you don't want in git to .gitignore
102+for config_file ($ZSH/lib/*.zsh); do
103+ custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}"
104+ [ -f "${custom_config_file}" ] && config_file=${custom_config_file}
105+ source $config_file
106+done
107+
108
109 is_plugin() {
110 local base_dir=$1
111diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh
112index 50a694764c9166a5f63bb9caf1cfb4ce0aca51bc..652d22696acfdbb109b185c5baae06ccad2d19c8 100644
113--- a/plugins/autojump/autojump.plugin.zsh
114+++ b/plugins/autojump/autojump.plugin.zsh
115@@ -1,6 +1,8 @@
116 if [ $commands[autojump] ]; then # check if autojump is installed
117 if [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation
118 . $HOME/.autojump/etc/profile.d/autojump.zsh
119+ elif [ -f $HOME/.nix-profile/etc/profile.d/autojump.zsh ]; then # nix installation
120+ . $HOME/.nix-profile/etc/profile.d/autojump.zsh
121 elif [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package
122 . /usr/share/autojump/autojump.zsh
123 elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
124diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
125index 8b57d7db1ca36fb62bf8f53b090a67c62939ed03..de786725f6660624ae982684c346b320515a8c2f 100644
126--- a/plugins/aws/aws.plugin.zsh
127+++ b/plugins/aws/aws.plugin.zsh
128@@ -3,19 +3,17 @@ _homebrew-installed() {
129 }
130
131 _awscli-homebrew-installed() {
132- brew --prefix awscli &> /dev/null
133+ brew list awscli &> /dev/null
134 }
135
136 export AWS_HOME=~/.aws
137
138 function agp {
139 echo $AWS_DEFAULT_PROFILE
140-
141 }
142 function asp {
143 export AWS_DEFAULT_PROFILE=$1
144- export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>"
145-
146+ export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>"
147 }
148 function aws_profiles {
149 reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/'))
150diff --git a/plugins/colored-man/colored-man.plugin.zsh b/plugins/colored-man/colored-man.plugin.zsh
151index 56056284a57ef908b5f682be1964617e186487b5..5c613f49d1fee1832d81ca7d3f0c42abc9d0a1f3 100644
152--- a/plugins/colored-man/colored-man.plugin.zsh
153+++ b/plugins/colored-man/colored-man.plugin.zsh
154@@ -1,3 +1,21 @@
155+if [ "$OSTYPE[0,7]" = "solaris" ]
156+then
157+ if [ ! -x ${HOME}/bin/nroff ]
158+ then
159+ mkdir -p ${HOME}/bin
160+ cat > ${HOME}/bin/nroff <<EOF
161+#!/bin/sh
162+if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then
163+ shift
164+ exec /usr/bin/nroff -u\${_NROFF_U} "\$@"
165+fi
166+#-- Some other invocation of nroff
167+exec /usr/bin/nroff "\$@"
168+EOF
169+ chmod +x ${HOME}/bin/nroff
170+ fi
171+fi
172+
173 man() {
174 env \
175 LESS_TERMCAP_mb=$(printf "\e[1;31m") \
176@@ -7,5 +25,8 @@ man() {
177 LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
178 LESS_TERMCAP_ue=$(printf "\e[0m") \
179 LESS_TERMCAP_us=$(printf "\e[1;32m") \
180+ PAGER=/usr/bin/less \
181+ _NROFF_U=1 \
182+ PATH=${HOME}/bin:${PATH} \
183 man "$@"
184 }
185diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh
186index 228a39da0ea09ddb60a87ab0434ecc881c894918..90d59910c794e7a893281e0c6096be81881c3916 100644
187--- a/plugins/common-aliases/common-aliases.plugin.zsh
188+++ b/plugins/common-aliases/common-aliases.plugin.zsh
189@@ -46,7 +46,6 @@ alias ff='find . -type f -name'
190 alias h='history'
191 alias hgrep="fc -El 0 | grep"
192 alias help='man'
193-alias j='jobs'
194 alias p='ps -f'
195 alias sortnr='sort -n -r'
196 alias unexport='unset'
197diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh
198index 504d7ec14b3817631b2aff8d36fd8a6c8d227c24..d101cfcae6a435ac0d78398f23cb1aac809a0efc 100644
199--- a/plugins/dirhistory/dirhistory.plugin.zsh
200+++ b/plugins/dirhistory/dirhistory.plugin.zsh
201@@ -3,7 +3,7 @@
202 # that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT.
203 #
204
205-dirhistory_past=(`pwd`)
206+dirhistory_past=($PWD)
207 dirhistory_future=()
208 export dirhistory_past
209 export dirhistory_future
210@@ -50,7 +50,7 @@ function push_future() {
211
212 # Called by zsh when directory changes
213 function chpwd() {
214- push_past `pwd`
215+ push_past $PWD
216 # If DIRHISTORY_CD is not set...
217 if [[ -z "${DIRHISTORY_CD+x}" ]]; then
218 # ... clear future.
219@@ -73,7 +73,7 @@ function dirhistory_back() {
220 pop_past cw
221 if [[ "" == "$cw" ]]; then
222 # Someone overwrote our variable. Recover it.
223- dirhistory_past=(`pwd`)
224+ dirhistory_past=($PWD)
225 return
226 fi
227
228diff --git a/plugins/emoji-clock/emoji-clock.plugin.zsh b/plugins/emoji-clock/emoji-clock.plugin.zsh
229index a69446e3c5cd3ee4585ddffd9a9534fe619819e1..0a55528f0d37e446a35cc9c40f59af7780c2f6b1 100644
230--- a/plugins/emoji-clock/emoji-clock.plugin.zsh
231+++ b/plugins/emoji-clock/emoji-clock.plugin.zsh
232@@ -8,21 +8,25 @@
233 # -----------------------------------------------------------------------------
234
235 function emoji-clock() {
236- hour=$(date -v '+15M' '+%I')
237- minutes=$(date -v '+15M' '+%M')
238+ # Add 15 minutes to the current time and save the value as $minutes.
239+ (( minutes = $(date '+%M') + 15 ))
240+ (( hour = $(date '+%I') + minutes / 60 ))
241+ # make sure minutes and hours don't exceed 60 nor 12 respectively
242+ (( minutes %= 60 )); (( hour %= 12 ))
243+
244 case $hour in
245- 01) clock="๐"; [ $minutes -ge 30 ] && clock="๐";;
246- 02) clock="๐"; [ $minutes -ge 30 ] && clock="๐";;
247- 03) clock="๐"; [ $minutes -ge 30 ] && clock="๐";;
248- 04) clock="๐"; [ $minutes -ge 30 ] && clock="๐";;
249- 05) clock="๐"; [ $minutes -ge 30 ] && clock="๐ ";;
250- 06) clock="๐"; [ $minutes -ge 30 ] && clock="๐ก";;
251- 07) clock="๐"; [ $minutes -ge 30 ] && clock="๐ข";;
252- 08) clock="๐"; [ $minutes -ge 30 ] && clock="๐ฃ";;
253- 09) clock="๐"; [ $minutes -ge 30 ] && clock="๐ค";;
254+ 0) clock="๐"; [ $minutes -ge 30 ] && clock="๐ง";;
255+ 1) clock="๐"; [ $minutes -ge 30 ] && clock="๐";;
256+ 2) clock="๐"; [ $minutes -ge 30 ] && clock="๐";;
257+ 3) clock="๐"; [ $minutes -ge 30 ] && clock="๐";;
258+ 4) clock="๐"; [ $minutes -ge 30 ] && clock="๐";;
259+ 5) clock="๐"; [ $minutes -ge 30 ] && clock="๐ ";;
260+ 6) clock="๐"; [ $minutes -ge 30 ] && clock="๐ก";;
261+ 7) clock="๐"; [ $minutes -ge 30 ] && clock="๐ข";;
262+ 8) clock="๐"; [ $minutes -ge 30 ] && clock="๐ฃ";;
263+ 9) clock="๐"; [ $minutes -ge 30 ] && clock="๐ค";;
264 10) clock="๐"; [ $minutes -ge 30 ] && clock="๐ฅ";;
265 11) clock="๐"; [ $minutes -ge 30 ] && clock="๐ฆ";;
266- 12) clock="๐"; [ $minutes -ge 30 ] && clock="๐ง";;
267 *) clock="โ";;
268 esac
269 echo $clock
270diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh
271index a6e16ddf7f352ffdcd10097586eae199f52cd23b..898d3d36ecee0801dcec271804040acdc00465e0 100644
272--- a/plugins/extract/extract.plugin.zsh
273+++ b/plugins/extract/extract.plugin.zsh
274@@ -38,7 +38,7 @@ function extract() {
275 file_name="$( basename "$1" )"
276 extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )"
277 case "$1" in
278- (*.tar.gz|*.tgz) tar xvzf "$1" ;;
279+ (*.tar.gz|*.tgz) [ -z $commands[pigz] ] && tar zxvf "$1" || pigz -dc "$1" | tar xv ;;
280 (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
281 (*.tar.xz|*.txz) tar --xz --help &> /dev/null \
282 && tar --xz -xvf "$1" \
283@@ -47,7 +47,7 @@ function extract() {
284 && tar --lzma -xvf "$1" \
285 || lzcat "$1" | tar xvf - ;;
286 (*.tar) tar xvf "$1" ;;
287- (*.gz) gunzip "$1" ;;
288+ (*.gz) [ -z $commands[pigz] ] && gunzip "$1" || pigz -d "$1" ;;
289 (*.bz2) bunzip2 "$1" ;;
290 (*.xz) unxz "$1" ;;
291 (*.lzma) unlzma "$1" ;;
292diff --git a/plugins/forklift/forklift.plugin.zsh b/plugins/forklift/forklift.plugin.zsh
293index b0e60a43440f45a3369732818c6ad3dd2bee719e..692ca5790710d88c2e154e28243b549092c1c34a 100644
294--- a/plugins/forklift/forklift.plugin.zsh
295+++ b/plugins/forklift/forklift.plugin.zsh
296@@ -1,4 +1,4 @@
297-# Open folder in ForkLift.app of ForkLift2.app from console
298+# Open folder in ForkLift.app or ForkLift2.app from console
299 # Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
300 # Updated to support ForkLift2 by Johan Kaving
301 #
302diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh
303index 38b1a80ea4394fe0abd9b3feef4128cbbf588aba..f1d45b0d12e0eafec4a4c876a8b544c76a06fa33 100644
304--- a/plugins/frontend-search/frontend-search.plugin.zsh
305+++ b/plugins/frontend-search/frontend-search.plugin.zsh
306@@ -118,7 +118,7 @@ alias jquery='frontend jquery'
307 alias mdn='frontend mdn'
308
309 # pre processors frameworks
310-alias compass='frontend compass'
311+alias compassdoc='frontend compass'
312
313 # important links
314 alias html5please='frontend html5please'
315diff --git a/plugins/gitignore/gitignore.plugin.zsh b/plugins/gitignore/gitignore.plugin.zsh
316index be037d87a6603bb5fc5a93442615e56d1d0d4165..481d487bad12cf9e39fd3cf01d41234e17f94648 100644
317--- a/plugins/gitignore/gitignore.plugin.zsh
318+++ b/plugins/gitignore/gitignore.plugin.zsh
319@@ -1,12 +1,12 @@
320-function gi() { curl http://www.gitignore.io/api/$@ ;}
321+function gi() { curl -sL https://www.gitignore.io/api/$@ ;}
322
323-_gitignireio_get_command_list() {
324- curl -s http://www.gitignore.io/api/list | tr "," "\n"
325+_gitignoreio_get_command_list() {
326+ curl -sL https://www.gitignore.io/api/list | tr "," "\n"
327 }
328
329-_gitignireio () {
330+_gitignoreio () {
331 compset -P '*,'
332- compadd -S '' `_gitignireio_get_command_list`
333+ compadd -S '' `_gitignoreio_get_command_list`
334 }
335
336-compdef _gitignireio gi
337+compdef _gitignoreio gi
338diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh
339index 1b23b5d427937f103ec948a09735b63952fbf8ab..b16814fe4d12b9935a046e745ab46169090c3446 100644
340--- a/plugins/jump/jump.plugin.zsh
341+++ b/plugins/jump/jump.plugin.zsh
342@@ -14,12 +14,12 @@ jump() {
343
344 mark() {
345 if (( $# == 0 )); then
346- MARK=$(basename "$(pwd)")
347+ MARK=$(basename "$PWD")
348 else
349 MARK="$1"
350 fi
351- if read -q \?"Mark $(pwd) as ${MARK}? (y/n) "; then
352- mkdir -p "$MARKPATH"; ln -s "$(pwd)" "$MARKPATH/$MARK"
353+ if read -q \?"Mark $PWD as ${MARK}? (y/n) "; then
354+ mkdir -p "$MARKPATH"; ln -s "$PWD" "$MARKPATH/$MARK"
355 fi
356 }
357
358diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
359index a63f0ee053ccbcbf0182660a04991754e1979268..2eea0d8ef1b5de801dd43a03b86d964e30cd2113 100644
360--- a/plugins/osx/osx.plugin.zsh
361+++ b/plugins/osx/osx.plugin.zsh
362@@ -139,7 +139,7 @@ function man-preview() {
363
364 function trash() {
365 local trash_dir="${HOME}/.Trash"
366- local temp_ifs=$IFS
367+ local temp_ifs="$IFS"
368 IFS=$'\n'
369 for item in "$@"; do
370 if [[ -e "$item" ]]; then
371diff --git a/plugins/pj/pj.plugin.zsh b/plugins/pj/pj.plugin.zsh
372index ba3765b83ce12893215ea45c10665ccd2517f2ef..1572e9363402906636bcad77e77d61b103c77290 100644
373--- a/plugins/pj/pj.plugin.zsh
374+++ b/plugins/pj/pj.plugin.zsh
375@@ -18,8 +18,11 @@ function pj() {
376 file=$1
377
378 if [[ "open" == "$file" ]] then
379- file=$2
380+ shift
381+ file=$*
382 cmd=(${(s: :)EDITOR})
383+ else
384+ file=$*
385 fi
386
387 for project in $PROJECT_PATHS; do
388@@ -36,7 +39,11 @@ function pj() {
389 alias pjo="pj open"
390
391 function _pj () {
392- compadd `/bin/ls -l $PROJECT_PATHS 2>/dev/null | awk '{ print $9 }'`
393+ # might be possible to improve this using glob, without the basename trick
394+ typeset -a projects
395+ projects=($PROJECT_PATHS/*)
396+ projects=$projects:t
397+ _arguments "*:file:($projects)"
398 }
399
400 compdef _pj pj
401diff --git a/plugins/pow/pow.plugin.zsh b/plugins/pow/pow.plugin.zsh
402index d85c8877777a44e57924eda79315fdfae38c9de0..ded3336a738932d250360da7819bc4a1e9f93aa6 100644
403--- a/plugins/pow/pow.plugin.zsh
404+++ b/plugins/pow/pow.plugin.zsh
405@@ -21,13 +21,13 @@
406
407 rack_root(){
408 setopt chaselinks
409- local orgdir="$(pwd)"
410- local basedir="$(pwd)"
411+ local orgdir="$PWD"
412+ local basedir="$PWD"
413
414 while [[ $basedir != '/' ]]; do
415 test -e "$basedir/config.ru" && break
416 builtin cd ".." 2>/dev/null
417- basedir="$(pwd)"
418+ basedir="$PWD"
419 done
420
421 builtin cd "$orgdir" 2>/dev/null
422@@ -56,7 +56,7 @@ kapow(){
423 compctl -W ~/.pow -/ kapow
424
425 powit(){
426- local basedir="$(pwd)"
427+ local basedir="$PWD"
428 local vhost=$1
429 [ ! -n "$vhost" ] && vhost=$(rack_root_detect)
430 if [ ! -h ~/.pow/$vhost ]
431diff --git a/plugins/profiles/profiles.plugin.zsh b/plugins/profiles/profiles.plugin.zsh
432index 8faae6b53290b9fa9fb37255fb0159d142327df7..5bc56cea0620d0ac3d9224f6accd9d013d1568da 100644
433--- a/plugins/profiles/profiles.plugin.zsh
434+++ b/plugins/profiles/profiles.plugin.zsh
435@@ -2,7 +2,7 @@
436
437 # This will look for a custom profile for the local machine and each domain or
438 # subdomain it belongs to. (e.g. com, example.com and foo.example.com)
439-parts=(${(s:.:)$(hostname)})
440+parts=(${(s:.:)HOST})
441 for i in {${#parts}..1}; do
442 profile=${(j:.:)${parts[$i,${#parts}]}}
443 file=$ZSH_CUSTOM/profiles/$profile
444diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh
445index fb46cdcf0710612900cc298118f96afebddac5da..824658e4458c6e7f6f7aba8f49ed42975c815865 100644
446--- a/plugins/rails/rails.plugin.zsh
447+++ b/plugins/rails/rails.plugin.zsh
448@@ -6,7 +6,7 @@ function _rails_command () {
449 elif [ -e "script/server" ]; then
450 ruby script/$@
451 else
452- rails $@
453+ command rails $@
454 fi
455 }
456
457@@ -14,7 +14,7 @@ function _rake_command () {
458 if [ -e "bin/rake" ]; then
459 bin/rake $@
460 else
461- rake $@
462+ command rake $@
463 fi
464 }
465
466diff --git a/plugins/scd/README.md b/plugins/scd/README.md
467index 197cea50a45df926f924e10c8cd6647d50b7a5e0..86ab6720329f1faa13bb1aeab28d051c10b42bf2 100644
468--- a/plugins/scd/README.md
469+++ b/plugins/scd/README.md
470@@ -11,12 +11,9 @@ the index. A selection menu is displayed in case of several matches, with a
471 preference given to recently visited paths. `scd` can create permanent
472 directory aliases, which appear as named directories in zsh session.
473
474-## INSTALLATION
475+## INSTALLATION NOTES
476
477-For oh-my-zsh, add `scd` to the `plugins` array in the ~/.zshrc file as in the
478-[template file](../../templates/zshrc.zsh-template#L45).
479-
480-Besides zsh, `scd` can be used with *bash*, *dash* or *tcsh*
481+Besides oh-my-zsh, `scd` can be used with *bash*, *dash* or *tcsh*
482 shells and is also available as [Vim](http://www.vim.org/) plugin and
483 [IPython](http://ipython.org/) extension. For installation details, see
484 https://github.com/pavoljuhas/smart-change-directory.
485@@ -34,7 +31,7 @@ scd [options] [pattern1 pattern2 ...]
486 add specified directories to the directory index.</dd><dt>
487
488 --unindex</dt><dd>
489- remove specified directories from the index.</dd><dt>
490+ remove current or specified directories from the index.</dd><dt>
491
492 -r, --recursive</dt><dd>
493 apply options <em>--add</em> or <em>--unindex</em> recursively.</dd><dt>
494@@ -47,6 +44,10 @@ scd [options] [pattern1 pattern2 ...]
495 remove ALIAS definition for the current or specified directory from
496 <em>~/.scdalias.zsh</em>.</dd><dt>
497
498+-A, --all</dt><dd>
499+ include all matching directories. Disregard matching by directory
500+ alias and filtering of less likely paths.</dd><dt>
501+
502 --list</dt><dd>
503 show matching directories and exit.</dd><dt>
504
505@@ -70,7 +71,7 @@ scd doc
506 scd a b c
507
508 # Change to a directory path that ends with "ts"
509-scd "ts(#e)"
510+scd "ts$"
511
512 # Show selection menu and ranking of 20 most likely directories
513 scd -v
514diff --git a/plugins/scd/scd b/plugins/scd/scd
515index 1567d2736cf8f4fb9582dc35dfc97b2bace9d0c9..39b28237d11809cbd8f81c4a86bbdc85260903fa 100755
516--- a/plugins/scd/scd
517+++ b/plugins/scd/scd
518@@ -11,20 +11,22 @@ fi
519 local DOC='scd -- smart change to a recently used directory
520 usage: scd [options] [pattern1 pattern2 ...]
521 Go to a directory path that contains all fixed string patterns. Prefer
522-recently visited directories and directories with patterns in their tail
523-component. Display a selection menu in case of multiple matches.
524+recent or frequently visited directories as found in the directory index.
525+Display a selection menu in case of multiple matches.
526
527 Options:
528- -a, --add add specified directories to the directory index
529- --unindex remove specified directories from the index
530- -r, --recursive apply options --add or --unindex recursively
531+ -a, --add add specified directories to the directory index.
532+ --unindex remove current or specified directories from the index.
533+ -r, --recursive apply options --add or --unindex recursively.
534 --alias=ALIAS create alias for the current or specified directory and
535- store it in ~/.scdalias.zsh
536+ store it in ~/.scdalias.zsh.
537 --unalias remove ALIAS definition for the current or specified
538- directory from ~/.scdalias.zsh
539- --list show matching directories and exit
540- -v, --verbose display directory rank in the selection menu
541- -h, --help display this message and exit
542+ directory from ~/.scdalias.zsh.
543+ -A, --all include all matching directories. Disregard matching by
544+ directory alias and filtering of less likely paths.
545+ --list show matching directories and exit.
546+ -v, --verbose display directory rank in the selection menu.
547+ -h, --help display this message and exit.
548 '
549
550 local SCD_HISTFILE=${SCD_HISTFILE:-${HOME}/.scdhistory}
551@@ -35,9 +37,9 @@ local SCD_THRESHOLD=${SCD_THRESHOLD:-0.005}
552 local SCD_SCRIPT=${RUNNING_AS_COMMAND:+$SCD_SCRIPT}
553 local SCD_ALIAS=~/.scdalias.zsh
554
555-local ICASE a d m p i tdir maxrank threshold
556+local ICASE a d m p i maxrank threshold
557 local opt_help opt_add opt_unindex opt_recursive opt_verbose
558-local opt_alias opt_unalias opt_list
559+local opt_alias opt_unalias opt_all opt_list
560 local -A drank dalias
561 local dmatching
562 local last_directory
563@@ -56,7 +58,8 @@ zmodload -i zsh/zutil
564 zmodload -i zsh/datetime
565 zparseopts -D -- a=opt_add -add=opt_add -unindex=opt_unindex \
566 r=opt_recursive -recursive=opt_recursive \
567- -alias:=opt_alias -unalias=opt_unalias -list=opt_list \
568+ -alias:=opt_alias -unalias=opt_unalias \
569+ A=opt_all -all=opt_all -list=opt_list \
570 v=opt_verbose -verbose=opt_verbose h=opt_help -help=opt_help \
571 || $EXIT $?
572
573@@ -68,6 +71,11 @@ fi
574 # load directory aliases if they exist
575 [[ -r $SCD_ALIAS ]] && source $SCD_ALIAS
576
577+# Private internal functions are prefixed with _scd_Y19oug_.
578+# Clean them up when the scd function returns.
579+setopt localtraps
580+trap 'unfunction -m "_scd_Y19oug_*"' EXIT
581+
582 # works faster than the (:a) modifier and is compatible with zsh 4.2.6
583 _scd_Y19oug_abspath() {
584 set -A $1 ${(ps:\0:)"$(
585@@ -123,11 +131,52 @@ if [[ -n $opt_unalias ]]; then
586 $EXIT $?
587 fi
588
589+# The "compress" function collapses repeated directories to
590+# one entry with a time stamp that gives equivalent-probability.
591+_scd_Y19oug_compress() {
592+ awk -v epochseconds=$EPOCHSECONDS -v meanlife=$SCD_MEANLIFE '
593+ BEGIN { FS = "[:;]"; }
594+ length($0) < 4096 && $2 > 0 {
595+ tau = 1.0 * ($2 - epochseconds) / meanlife;
596+ if (tau < -6.9078) tau = -6.9078;
597+ prob = exp(tau);
598+ sub(/^[^;]*;/, "");
599+ if (NF) {
600+ dlist[last[$0]] = "";
601+ dlist[NR] = $0;
602+ last[$0] = NR;
603+ ptot[$0] += prob;
604+ }
605+ }
606+ END {
607+ for (i = 1; i <= NR; ++i) {
608+ d = dlist[i];
609+ if (d) {
610+ ts = log(ptot[d]) * meanlife + epochseconds;
611+ printf(": %.0f:0;%s\n", ts, d);
612+ }
613+ }
614+ }
615+ ' $*
616+}
617+
618diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh
619index ef6da5bd3cb6e6447e59c224fc8a158ecc1ac590..ba281d7909499529a6fcbd4e988078b2f32a22d5 100644
620--- a/plugins/svn/svn.plugin.zsh
621+++ b/plugins/svn/svn.plugin.zsh
622@@ -77,7 +77,7 @@ function svn_dirty() {
623
624 function svn_dirty_choose_pwd () {
625 if in_svn; then
626- root=`pwd`
627+ root=$PWD
628 if $(svn status $root 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'); then
629 # Grep exits with 0 when "One or more lines were selected", return "dirty".
630 echo $1
631diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh
632index f5e44c66f500850daa234c407825493ad0ec58f9..4ae70dfa751dc124c3cb47b83eb1f6c57c34b203 100644
633--- a/plugins/systemadmin/systemadmin.plugin.zsh
634+++ b/plugins/systemadmin/systemadmin.plugin.zsh
635@@ -30,7 +30,7 @@ function retlog() {
636 }
637
638 alias ping='ping -c 5'
639-alias clr='clear;echo "Currently logged in on $(tty), as $(whoami) in directory $(pwd)."'
640+alias clr='clear;echo "Currently logged in on $(tty), as $USER in directory $PWD."'
641 alias path='echo -e ${PATH//:/\\n}'
642 alias mkdir='mkdir -pv'
643 # get top process eating memory
644diff --git a/plugins/vim-interaction/vim-interaction.plugin.zsh b/plugins/vim-interaction/vim-interaction.plugin.zsh
645index 5142f1f9b586607ec17355c33161ef99c9c486f8..b0b9414cd2aac90e3403418c6b3e38e381cbcc6b 100644
646--- a/plugins/vim-interaction/vim-interaction.plugin.zsh
647+++ b/plugins/vim-interaction/vim-interaction.plugin.zsh
648@@ -9,7 +9,7 @@ function resolveFile
649 if [ -f "$1" ]; then
650 echo $(readlink -f "$1")
651 elif [[ "${1#/}" == "$1" ]]; then
652- echo "$(pwd)/$1"
653+ echo "$PWD/$1"
654 else
655 echo $1
656 fi
657diff --git a/plugins/virtualenv/virtualenv.plugin.zsh b/plugins/virtualenv/virtualenv.plugin.zsh
658index 8e06450b1ef028aa189b7449624361fd73d6f20e..e250eb63e40e98c9bfeb998b46b11f935426c7e0 100644
659--- a/plugins/virtualenv/virtualenv.plugin.zsh
660+++ b/plugins/virtualenv/virtualenv.plugin.zsh
661@@ -1,7 +1,6 @@
662 function virtualenv_prompt_info(){
663- if [[ -n $VIRTUAL_ENV ]]; then
664- printf "%s[%s] " "%{${fg[yellow]}%}" ${${VIRTUAL_ENV}:t}
665- fi
666+ [[ -n ${VIRTUAL_ENV} ]] || return
667+ echo "${ZSH_THEME_VIRTUALENV_PREFIX:=[}${VIRTUAL_ENV:t}${ZSH_THEME_VIRTUALENV_SUFFIX:=]}"
668 }
669
670 # disables prompt mangling in virtual_env/bin/activate
671diff --git a/plugins/wd/README.md b/plugins/wd/README.md
672index bc0ebe334ed4ed556d93c2a4c0876cd610f76579..bcfeab684f81eb98cb9f48957f1729d21ef35c97 100644
673--- a/plugins/wd/README.md
674+++ b/plugins/wd/README.md
675@@ -1,8 +1,60 @@
676-## wd
677+wd
678+==
679+
680+[](https://travis-ci.org/mfaerevaag/wd)
681+
682+`wd` (*warp directory*) lets you jump to custom directories in zsh, without using `cd`. Why? Because `cd` seems ineffecient when the folder is frequently visited or has a long path.
683+
684+
685+### Setup
686+
687+### oh-my-zsh
688+
689+`wd` comes bundles with [oh-my-zshell](https://github.com/robbyrussell/oh-my-zsh)!
690+
691+Just add the plugin in your `~/.zshrc` file:
692+
693+ plugins=(... wd)
694+
695+
696+#### Automatic
697+
698+Run either in terminal:
699+
700+ * `curl -L https://github.com/mfaerevaag/wd/raw/master/install.sh | sh`
701+
702+ * `wget --no-check-certificate https://github.com/mfaerevaag/wd/raw/master/install.sh -O - | sh`
703+
704+
705+#### Manual
706+
707+ * Clone this repo to your liking
708+
709+ * Add `wd` function to `.zshrc` (or `.profile` etc.):
710+
711+ wd() {
712+ . ~/paht/to/wd/wd.sh
713+ }
714+
715+ * Install manpage. From `wd`'s base directory (requires root permissions):
716+
717+ # cp wd.1 /usr/share/man/man1/wd.1
718+ # chmod 644 /usr/share/man/man1/wd.1
719+
720+ Note, when pulling and updating `wd`, you'll need to do this again in case of changes to the manpage.
721+
722+
723+#### Completion
724+
725diff --git a/plugins/wd/_wd.sh b/plugins/wd/_wd.sh
726index 0b03d8fff3b7f5a2578742736445b922da523df6..2bb58dd31b03f5b5e629ed6ede796fbd6195720c 100644
727--- a/plugins/wd/_wd.sh
728+++ b/plugins/wd/_wd.sh
729@@ -21,7 +21,8 @@ function _wd() {
730 'add!:Overwrites existing warp point'
731 'rm:Removes the given warp point'
732 'ls:Outputs all stored warp points'
733- 'show:Outputs all warp points that point to the current directory'
734+ 'show:Outputs all warp points that point to the current directory or shows a specific target directory for a point'
735+ 'show:Outputs all warp points that point to the current directory or shows a specific target directory for a point'
736 'help:Show this extremely helpful text'
737 '..:Go back to last directory'
738 )
739@@ -43,6 +44,9 @@ function _wd() {
740 add)
741 _message 'Write the name of your warp point' && ret=0
742 ;;
743+ show)
744+ _describe -t points "Warp points" warp_points && ret=0
745+ ;;
746 esac
747 ;;
748 esac
749diff --git a/plugins/wd/wd.sh b/plugins/wd/wd.sh
750index dfb9ad89a4dc3478112eb053a4f70088b34ec280..5ecbdc5035496dd1ec96e734800b45c594281019 100755
751--- a/plugins/wd/wd.sh
752+++ b/plugins/wd/wd.sh
753@@ -7,40 +7,108 @@
754 #
755 # @github.com/mfaerevaag/wd
756
757-
758-## variables
759-readonly CONFIG=$HOME/.warprc
760+# version
761+readonly WD_VERSION=0.4
762
763 # colors
764-readonly BLUE="\033[96m"
765-readonly GREEN="\033[92m"
766-readonly YELLOW="\033[93m"
767-readonly RED="\033[91m"
768-readonly NOC="\033[m"
769+readonly WD_BLUE="\033[96m"
770+readonly WD_GREEN="\033[92m"
771+readonly WD_YELLOW="\033[93m"
772+readonly WD_RED="\033[91m"
773+readonly WD_NOC="\033[m"
774
775+## functions
776
777-## init
778+# helpers
779+wd_yesorno()
780+{
781+ # variables
782+ local question="${1}"
783+ local prompt="${question} "
784+ local yes_RETVAL="0"
785+ local no_RETVAL="3"
786+ local RETVAL=""
787+ local answer=""
788+
789+ # read-eval loop
790+ while true ; do
791+ printf $prompt
792+ read -r answer
793+
794+ case ${answer:=${default}} in
795+ Y|y|YES|yes|Yes )
796+ RETVAL=${yes_RETVAL} && \
797+ break
798+ ;;
799+ N|n|NO|no|No )
800+ RETVAL=${no_RETVAL} && \
801+ break
802+ ;;
803+ * )
804+ echo "Please provide a valid answer (y or n)"
805+ ;;
806+ esac
807+ done
808
809-# check if config file exists
810-if [ ! -e $CONFIG ]
811-then
812- # if not, create config file
813- touch $CONFIG
814-fi
815+ return ${RETVAL}
816+}
817
818-# load warp points
819-typeset -A points
820-while read -r line
821-do
822- arr=(${(s,:,)line})
823- key=${arr[1]}
824- val=${arr[2]}
825+wd_print_msg()
826+{
827+ if [[ -z $wd_quiet_mode ]]
828+ then
829+ local color=$1
830+ local msg=$2
831
832- points[$key]=$val
833-done < $CONFIG
834+ if [[ $color == "" || $msg == "" ]]
835+ then
836+ print " ${WD_RED}*${WD_NOC} Could not print message. Sorry!"
837+ else
838+ print " ${color}*${WD_NOC} ${msg}"
839+ fi
840+ fi
841+}
842
843+wd_print_usage()
844+{
845+ cat <<- EOF
846+Usage: wd [command] <point>
847
848-## functions
849+Commands:
850+ add <point> Adds the current working directory to your warp points
851+ add! <point> Overwrites existing warp point
852+ rm <point> Removes the given warp point
853diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh
854index e59bee8c767ad7da79d317218928953f5555317a..b7b75cf9376c16e4196c4457b3728660482e72a3 100644
855--- a/plugins/xcode/xcode.plugin.zsh
856+++ b/plugins/xcode/xcode.plugin.zsh
857@@ -16,4 +16,9 @@ function xcsel {
858
859 alias xcb='xcodebuild'
860 alias xcp='xcode-select --print-path'
861-alias simulator='open $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'
862+
863+if [[ -d $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app ]]; then
864+ alias simulator='open $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'
865+else
866+ alias simulator='open $(xcode-select -p)/Applications/iOS\ Simulator.app'
867+fi
868diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template
869index a12eca2a0855f4a67c71d607f72eb0b29633f898..763288dfd6eab436b7742622f4eb065f3f162f68 100644
870--- a/templates/zshrc.zsh-template
871+++ b/templates/zshrc.zsh-template
872@@ -47,13 +47,13 @@ ZSH_THEME="robbyrussell"
873 # Add wisely, as too many plugins slow down shell startup.
874 plugins=(git)
875
876-source $ZSH/oh-my-zsh.sh
877-
878 # User configuration
879
880 export PATH=$HOME/bin:/usr/local/bin:$PATH
881 # export MANPATH="/usr/local/man:$MANPATH"
882
883+source $ZSH/oh-my-zsh.sh
884+
885 # You may need to manually set your language environment
886 # export LANG=en_US.UTF-8
887
888diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme
889index aa3093f64139751b78f6264755128d32e003fb96..6869c8a20ae20203ded67bd33f1ee987af09bd19 100644
890--- a/themes/adben.zsh-theme
891+++ b/themes/adben.zsh-theme
892@@ -89,9 +89,8 @@ function precmd {
893
894 # Context: user@directory or just directory
895 prompt_context () {
896- local user=`whoami`
897- if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
898- echo -n "${PR_RESET}${PR_RED}$user@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
899+ if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
900+ echo -n "${PR_RESET}${PR_RED}$USER@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
901 else
902 echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
903 fi
904diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
905index 2b33c48bc7bc2cec58bad4ecff372026c2a023e1..7a62bd860802d3f093d28eb2387bd26f4e427ea1 100644
906--- a/themes/agnoster.zsh-theme
907+++ b/themes/agnoster.zsh-theme
908@@ -60,10 +60,8 @@ prompt_end() {
909
910 # Context: user@hostname (who am I and where am I)
911 prompt_context() {
912- local user=`whoami`
913-
914- if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
915- prompt_segment black default "%(!.%{%F{yellow}%}.)$user@%m"
916+ if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
917+ prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m"
918 fi
919 }
920
921diff --git a/themes/candy-kingdom.zsh-theme b/themes/candy-kingdom.zsh-theme
922index 718977d904d512eeafe1b9d9ec6bd0c0f34c3d43..8891287585152e18aa193edc1c4c53428659dd47 100644
923--- a/themes/candy-kingdom.zsh-theme
924+++ b/themes/candy-kingdom.zsh-theme
925@@ -13,7 +13,7 @@ patches: <patches|join( โ )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset
926 }
927
928 function box_name {
929- [ -f ~/.box-name ] && cat ~/.box-name || hostname -s
930+ [ -f ~/.box-name ] && cat ~/.box-name || echo $SHORT_HOST || echo $HOST
931 }
932
933 PROMPT='
934diff --git a/themes/dieter.zsh-theme b/themes/dieter.zsh-theme
935index 0a5e9265bd680e628c2da9ae61b5ae37159d1214..58d9f88a9c0ed2de78a3b9ab8f769caa6d312db4 100644
936--- a/themes/dieter.zsh-theme
937+++ b/themes/dieter.zsh-theme
938@@ -21,7 +21,7 @@ local user="%(!.%{$fg[blue]%}.%{$fg[blue]%})%n%{$reset_color%}"
939
940 # Hostname part. compressed and colorcoded per host_repr array
941 # if not found, regular hostname in default color
942-local host="@${host_repr[$(hostname)]:-$(hostname)}%{$reset_color%}"
943+local host="@${host_repr[$HOST]:-$HOST}%{$reset_color%}"
944
945 # Compacted $PWD
946 local pwd="%{$fg[blue]%}%c%{$reset_color%}"
947diff --git a/themes/fino-time.zsh-theme b/themes/fino-time.zsh-theme
948index 901c4d99fdfe730a91ed92e95860dea1a8cbcf67..67b6b6e08edd45f5069aeb76c19dcd37c314930a 100644
949--- a/themes/fino-time.zsh-theme
950+++ b/themes/fino-time.zsh-theme
951@@ -21,7 +21,7 @@ function prompt_char {
952 }
953
954 function box_name {
955- [ -f ~/.box-name ] && cat ~/.box-name || hostname -s
956+ [ -f ~/.box-name ] && cat ~/.box-name || echo $SHORT_HOST || echo $HOST
957 }
958
959
960diff --git a/themes/fino.zsh-theme b/themes/fino.zsh-theme
961index 411dec9b9dedd052ffa2c15ed6d275283da1443f..50d41e89976ed0f7062523a52c1701218a60d42f 100644
962--- a/themes/fino.zsh-theme
963+++ b/themes/fino.zsh-theme
964@@ -17,7 +17,7 @@ function prompt_char {
965 }
966
967 function box_name {
968- [ -f ~/.box-name ] && cat ~/.box-name || hostname -s
969+ [ -f ~/.box-name ] && cat ~/.box-name || echo $SHORT_HOST || echo $HOST
970 }
971
972 local ruby_env=''
973diff --git a/themes/flazz.zsh-theme b/themes/flazz.zsh-theme
974index 280794f2b83c33bf3c039e2fdb3a868b92d55ca2..c0a7fb5d0a9824cb17374cd90ee22262198803e9 100644
975--- a/themes/flazz.zsh-theme
976+++ b/themes/flazz.zsh-theme
977@@ -1,4 +1,4 @@
978-if [ "$(whoami)" = "root" ]
979+if [ "$USER" = "root" ]
980 then CARETCOLOR="red"
981 else CARETCOLOR="blue"
982 fi
983diff --git a/themes/gallois.zsh-theme b/themes/gallois.zsh-theme
984index f1057a9a974fafd033ea30a613d76295aefaaaa5..d383ed5830d168409c82c67b8b17c8be7fe1f538 100644
985--- a/themes/gallois.zsh-theme
986+++ b/themes/gallois.zsh-theme
987@@ -11,19 +11,11 @@ git_custom_status() {
988 fi
989 }
990
991-#RVM and git settings
992-if [[ -s ~/.rvm/scripts/rvm ]] ; then
993- RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1'
994-else
995- if which rbenv &> /dev/null; then
996- RPS1='$(git_custom_status)%{$fg[red]%}[`rbenv version | sed -e "s/ (set.*$//"`]%{$reset_color%} $EPS1'
997- else
998- if [[ -n `which chruby_prompt_info` && -n `chruby_prompt_info` ]]; then
999- RPS1='$(git_custom_status)%{$fg[red]%}[`chruby_prompt_info`]%{$reset_color%} $EPS1'
1000- else
1001- RPS1='$(git_custom_status) $EPS1'
1002- fi
1003- fi
1004-fi
1005+# RVM component of prompt
1006+ZSH_THEME_RVM_PROMPT_PREFIX="%{$fg[red]%}["
1007+ZSH_THEME_RVM_PROMPT_SUFFIX="]%{$reset_color%}"
1008+
1009+# Combine it all into a final right-side prompt
1010+RPS1='$(git_custom_status)$(ruby_prompt_info) $EPS1'
1011
1012 PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b '
1013diff --git a/themes/kardan.zsh-theme b/themes/kardan.zsh-theme
1014index fd6586a9d70ce03e7fe20bdc7921d66b94e3576e..9a3d59109ac31b8199f46712cb43759cdb56a6c4 100644
1015--- a/themes/kardan.zsh-theme
1016+++ b/themes/kardan.zsh-theme
1017@@ -1,7 +1,7 @@
1018 # Simple theme based on my old zsh settings.
1019
1020 function get_host {
1021- echo '@'`hostname`''
1022+ echo '@'$HOST
1023 }
1024
1025 PROMPT='> '
1026diff --git a/themes/michelebologna.zsh-theme b/themes/michelebologna.zsh-theme
1027index ef4c6d740d8abd92e0fb647906c172050748caa0..a7599c8f52ce077e2b4aa7dd223f86a528cec1f4 100644
1028--- a/themes/michelebologna.zsh-theme
1029+++ b/themes/michelebologna.zsh-theme
1030@@ -17,7 +17,7 @@ USERNAME_NORMAL_COLOR=$WHITE
1031 USERNAME_ROOT_COLOR=$RED
1032 HOSTNAME_NORMAL_COLOR=$BLUE
1033 # uncomment next line if you want auto-generated hostname color
1034-#for i in `hostname`; HOSTNAME_NORMAL_COLOR=$COLOR_ARRAY[$[((#i))%7+1]]
1035+#for i in $HOST; HOSTNAME_NORMAL_COLOR=$COLOR_ARRAY[$[((#i))%7+1]]
1036 HOSTNAME_ROOT_COLOR=$RED
1037 HOSTNAME_COLOR=%(!.$HOSTNAME_ROOT_COLOR.$HOSTNAME_NORMAL_COLOR)
1038 CURRENT_DIR_COLOR=$CYAN
1039diff --git a/themes/obraun.zsh-theme b/themes/obraun.zsh-theme
1040index 08d13766585b414d92b7d4df2ceb66e179669810..7af44056f606654d564f839f36d14f8e60ed01b6 100644
1041--- a/themes/obraun.zsh-theme
1042+++ b/themes/obraun.zsh-theme
1043@@ -1,4 +1,4 @@
1044-if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
1045+if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
1046
1047 local return_code="%(?..%{$fg[red]%}%? โต%{$reset_color%})"
1048
1049diff --git a/themes/re5et.zsh-theme b/themes/re5et.zsh-theme
1050index 5bded76a3e99bf06a895424a1ac955967fe3fe26..95af1e2ee3bf110fe16e03555526b12067fe4dd3 100644
1051--- a/themes/re5et.zsh-theme
1052+++ b/themes/re5et.zsh-theme
1053@@ -1,4 +1,4 @@
1054-if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi
1055+if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi
1056
1057 local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})"
1058
1059diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme
1060index 9d27410b861694e5c414ececefa3094aaa1bf467..e38188d353daafe1d7673719b9a99c9fe78aa87c 100644
1061--- a/themes/steeef.zsh-theme
1062+++ b/themes/steeef.zsh-theme
1063@@ -7,6 +7,8 @@
1064 # git untracked files modification from Brian Carper:
1065 # http://briancarper.net/blog/570/git-info-in-your-zsh-prompt
1066
1067+export VIRTUAL_ENV_DISABLE_PROMPT=1
1068+
1069 function virtualenv_info {
1070 [ $VIRTUAL_ENV ] && echo '('$fg[blue]`basename $VIRTUAL_ENV`%{$reset_color%}') '
1071 }
1072diff --git a/themes/sunrise.zsh-theme b/themes/sunrise.zsh-theme
1073index 4bea20a1bd37cdc544daead93b798a72c180a47d..28befd01b5059b7973a16225fe00223c9e3914c0 100644
1074--- a/themes/sunrise.zsh-theme
1075+++ b/themes/sunrise.zsh-theme
1076@@ -10,7 +10,7 @@ Y=$fg_no_bold[yellow]
1077 B=$fg_no_bold[blue]
1078 RESET=$reset_color
1079
1080-if [ "$(whoami)" = "root" ]; then
1081+if [ "$USER" = "root" ]; then
1082 PROMPTCOLOR="%{$R%}" PREFIX="-!-";
1083 else
1084 PROMPTCOLOR="" PREFIX="---";
1085diff --git a/themes/superjarin.zsh-theme b/themes/superjarin.zsh-theme
1086index 2920d17a2831168a491c18d20b066ea570cb28f2..86fa9c706dfc4a6047934995be290d83e81af504 100644
1087--- a/themes/superjarin.zsh-theme
1088+++ b/themes/superjarin.zsh-theme
1089@@ -1,11 +1,5 @@
1090-# Grab the current version of ruby in use (via RVM): [ruby-1.8.7]
1091-if [ -e ~/.rvm/bin/rvm-prompt ]; then
1092- JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
1093-else
1094- if which rbenv &> /dev/null; then
1095- JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg[white]%}]%{$reset_color%}"
1096- fi
1097-fi
1098+# Grab the current version of ruby in use: [ruby-1.8.7]
1099+JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(ruby_prompt_info)%{$fg[white]%}]%{$reset_color%}"
1100
1101 # Grab the current filepath, use shortcuts: ~/Desktop
1102 # Append the current git branch, if in a git repository
1103diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme
1104index a44f295f4acd229833e20051c4c84a600d1dbb71..0171391001a171b1f3e8f1bb0ae09d339b7d963a 100644
1105--- a/themes/ys.zsh-theme
1106+++ b/themes/ys.zsh-theme
1107@@ -8,7 +8,7 @@
1108
1109 # Machine name.
1110 function box_name {
1111- [ -f ~/.box-name ] && cat ~/.box-name || hostname
1112+ [ -f ~/.box-name ] && cat ~/.box-name || echo $HOST
1113 }
1114
1115 # Directory info.
1116@@ -33,7 +33,7 @@ ${git_info} \
1117 %{$fg[white]%}[%*]
1118 %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"
1119
1120-if [[ "$(whoami)" == "root" ]]; then
1121+if [[ "$USER" == "root" ]]; then
1122 PROMPT="
1123 %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
1124 %{$bg[yellow]%}%{$fg[cyan]%}%n%{$reset_color%} \
1125diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
1126index 35e074297e865c8adfb82c360936a8e886c9a11b..4a0803210e85a57e1d24f13229521a2d4caa0f2c 100644
1127--- a/tools/check_for_upgrade.sh
1128+++ b/tools/check_for_upgrade.sh
1129@@ -1,7 +1,9 @@
1130-#!/bin/sh
1131+#!/usr/bin/env zsh
1132+
1133+zmodload zsh/datetime
1134
1135 function _current_epoch() {
1136- echo $(($(date +%s) / 60 / 60 / 24))
1137+ echo $(( $EPOCHSECONDS / 60 / 60 / 24 ))
1138 }
1139
1140 function _update_zsh_update() {