Diff
1diff --git a/README.textile b/README.textile
2index 8b1b6875a516e0cde5783df464f6eea1ff368721..0659aded875b3ff85cb695560d8fe9bbc3e1d4c1 100644
3--- a/README.textile
4+++ b/README.textile
5@@ -8,7 +8,7 @@ h2. Setup
6
7 h3. The automatic installer... (do you trust me?)
8
9-@wget http://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@
10+@wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@
11
12 h3. The manual way
13
14@@ -38,7 +38,7 @@ h2. Usage
15 * enable the plugins you want in your @~/.zshrc@ (take a look at @plugins/@ to see what's possible)
16 ** example: @plugins=(git osx ruby)@
17 * Theme support: Change the @ZSH_THEME@ environment variable in @~/.zshrc@.
18-** Take a look at the "current themes":http://wiki.github.com/robbyrussell/oh-my-zsh/themes that come bundled with _Oh My Zsh_.
19+** Take a look at the "current themes":https://wiki.github.com/robbyrussell/oh-my-zsh/themes that come bundled with _Oh My Zsh_.
20 * much much more... take a look at @lib/@ what _Oh My Zsh_ offers...
21
22 h2. Useful
23diff --git a/lib/functions.zsh b/lib/functions.zsh
24index 914f2ef25a22d141cfd2e8c9c6255e535641274b..6f5d015f7a598739ddc3de8e5fbf451817a8e125 100644
25--- a/lib/functions.zsh
26+++ b/lib/functions.zsh
27@@ -1,26 +1,3 @@
28-## fixme, i duplicated this in xterms - oops
29-function title {
30- if [[ $TERM == "screen" ]]; then
31- # Use these two for GNU Screen:
32- print -nR $'\033k'$1$'\033'\\\
33-
34- print -nR $'\033]0;'$2$'\a'
35- elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]]; then
36- # Use this one instead for XTerms:
37- print -nR $'\033]0;'$*$'\a'
38- fi
39-}
40-
41-function precmd {
42- title zsh "$PWD"
43-}
44-
45-function preexec {
46- emulate -L zsh
47- local -a cmd; cmd=(${(z)1})
48- title $cmd[1]:t "$cmd[2,-1]"
49-}
50-
51 function zsh_stats() {
52 history | awk '{print $2}' | sort | uniq -c | sort -rn | head
53 }
54diff --git a/lib/git.zsh b/lib/git.zsh
55index 75fdc1f9c2e90f605d8b99542b3974d848b826a9..8512de8a40ba542e24d86be6e5c83c7245623875 100644
56--- a/lib/git.zsh
57+++ b/lib/git.zsh
58@@ -26,6 +26,10 @@ git_prompt_status() {
59 fi
60 if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then
61 STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
62+ elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then
63+ STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
64+ elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then
65+ STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
66 fi
67 if $(echo "$INDEX" | grep '^R ' &> /dev/null); then
68 STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS"
69diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
70index fef9787486b1d2f5d06ae49958dc0dad73235ff0..e1e536690be580eb0c99a1df47ad5b3df9494073 100644
71--- a/lib/termsupport.zsh
72+++ b/lib/termsupport.zsh
73@@ -1,21 +1,26 @@
74-case "$TERM" in
75- xterm*|rxvt*)
76- preexec () {
77- print -Pn "\e]0;%n@%m: $1\a" # xterm
78- }
79- precmd () {
80- print -Pn "\e]0;%n@%m: %~\a" # xterm
81- }
82- ;;
83- screen*)
84- preexec () {
85- local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]}
86- echo -ne "\ek$CMD\e\\"
87- print -Pn "\e]0;%n@%m: $1\a" # xterm
88- }
89- precmd () {
90- echo -ne "\ekzsh\e\\"
91- print -Pn "\e]0;%n@%m: %~\a" # xterm
92- }
93- ;;
94-esac
95+#usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title
96+#http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
97+#Fully support screen, iterm, and probably most modern xterm and rxvt
98+#Limited support for Apple Terminal (Terminal can't set window or tab separately)
99+function title {
100+ if [[ "$TERM" == "screen" ]]; then
101+ print -Pn "\ek$1\e\\" #set screen hardstatus, usually truncated at 20 chars
102+ elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
103+ print -Pn "\e]2;$2\a" #set window name
104+ print -Pn "\e]1;$1\a" #set icon (=tab) name (will override window name on broken terminal)
105+ fi
106+}
107+
108+ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
109+ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
110+
111+#Appears when you have the prompt
112+function precmd {
113+ title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
114+}
115+
116+#Appears at the beginning of (and during) of command execution
117+function preexec {
118+ local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
119+ title "$CMD" "%100>...>$2%<<"
120+}
121diff --git a/lib/appearance.zsh b/lib/theme-and-appearance.zsh
122rename from lib/appearance.zsh
123rename to lib/theme-and-appearance.zsh
124diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
125new file mode 100644
126index 0000000000000000000000000000000000000000..fb40e2cec10dc79da5875c660d18d70d4ee9ac10
127--- /dev/null
128+++ b/plugins/bundler/bundler.plugin.zsh
129@@ -0,0 +1,3 @@
130+alias be="bundle exec"
131+alias bi="bundle install"
132+alias bu="bundle update"
133diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
134index fce88c79669f8169b68c8da25aca707c0ba59f96..81eed5e92af372466fc02bb682a9d5a8b26091e8 100644
135--- a/plugins/osx/osx.plugin.zsh
136+++ b/plugins/osx/osx.plugin.zsh
137@@ -1,11 +1,57 @@
138+function savepath() {
139+ pwd > ~/.current_path~
140+}
141+
142 function tab() {
143- osascript 2>/dev/null <<EOF
144+savepath
145+osascript >/dev/null <<EOF
146+on do_submenu(app_name, menu_name, menu_item, submenu_item)
147+ -- bring the target application to the front
148+ tell application app_name
149+ activate
150+ end tell
151 tell application "System Events"
152- tell process "Terminal" to keystroke "t" using command down
153- end
154- tell application "Terminal"
155+ tell process app_name
156+ tell menu bar 1
157+ tell menu bar item menu_name
158+ tell menu menu_name
159+ tell menu item menu_item
160+ tell menu menu_item
161+ click menu item submenu_item
162+ end tell
163+ end tell
164+ end tell
165+ end tell
166+ end tell
167+ end tell
168+ end tell
169+end do_submenu
170+
171+do_submenu("Terminal", "Shell", "New Tab", 1)
172+EOF
173+}
174+
175+function itab() {
176+savepath
177+osascript >/dev/null <<EOF
178+on do_submenu(app_name, menu_name, menu_item)
179+ -- bring the target application to the front
180+ tell application app_name
181 activate
182- do script with command "cd \"$PWD\"; $*" in window 1
183 end tell
184+ tell application "System Events"
185+ tell process app_name
186+ tell menu bar 1
187+ tell menu bar item menu_name
188+ tell menu menu_name
189+ click menu item menu_item
190+ end tell
191+ end tell
192+ end tell
193+ end tell
194+ end tell
195+end do_submenu
196+
197+do_submenu("iTerm", "Shell", "New Tab")
198 EOF
199-}
200+}
201diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh
202index 20ba0408ce8ccd1773282bfec3f87f6df97b418e..6bf2ba0882a8dcbff97412725beb4f45c00b4c6f 100644
203--- a/plugins/rails3/rails3.plugin.zsh
204+++ b/plugins/rails3/rails3.plugin.zsh
205@@ -3,6 +3,8 @@ alias rg='ruby script/rails generate'
206 alias rd='ruby script/rails destroy'
207 alias rp='ruby script/rails plugin'
208 alias rdbm='rake db:migrate db:test:clone'
209+alias rdbmr='rake db:migrate && rake db:migrate:redo'
210 alias rc='ruby script/rails console'
211-alias rd='ruby script/rais server --debugger'
212+alias rd='ruby script/rails server --debugger'
213 alias devlog='tail -f log/development.log'
214+
215diff --git a/themes/Soliah.zsh-theme b/themes/Soliah.zsh-theme
216index 7ad876d41756daf9911162235ac5a8a205a0656d..1c0ab3cc971e9633b7c42f32e118f0977d30375b 100644
217--- a/themes/Soliah.zsh-theme
218+++ b/themes/Soliah.zsh-theme
219@@ -1,6 +1,63 @@
220-PROMPT='%{$fg[blue]%}%B%20~%b%{$reset_color%}%{$(git_prompt_info)%} $ '
221+PROMPT='%{$fg[blue]%}%n%{$reset_color%} on %{$fg[red]%}%M%{$reset_color%} in %{$fg[blue]%}%~%b%{$reset_color%}$(git_time_since_commit)$(git_prompt_info)
222+$ '
223
224-ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[green]%}"
225+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}"
226 ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})"
227-ZSH_THEME_GIT_PROMPT_DIRTY="*%{$reset_color%}"
228
229+# Text to display if the branch is dirty
230+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}"
231+
232+# Text to display if the branch is clean
233+ZSH_THEME_GIT_PROMPT_CLEAN=""
234+
235+# Colors vary depending on time lapsed.
236+ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}"
237+ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
238+ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
239+ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
240+
241+# Determine the time since last commit. If branch is clean,
242+# use a neutral color, otherwise colors will vary according to time.
243+function git_time_since_commit() {
244+ if git rev-parse --git-dir > /dev/null 2>&1; then
245+ # Only proceed if there is actually a commit.
246+ if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then
247+ # Get the last commit.
248+ last_commit=`git log --pretty=format:'%at' -1 2> /dev/null`
249+ now=`date +%s`
250+ seconds_since_last_commit=$((now-last_commit))
251+
252+ # Totals
253+ MINUTES=$((seconds_since_last_commit / 60))
254+ HOURS=$((seconds_since_last_commit/3600))
255+
256+ # Sub-hours and sub-minutes
257+ DAYS=$((seconds_since_last_commit / 86400))
258+ SUB_HOURS=$((HOURS % 24))
259+ SUB_MINUTES=$((MINUTES % 60))
260+
261+ if [[ -n $(git status -s 2> /dev/null) ]]; then
262+ if [ "$MINUTES" -gt 30 ]; then
263+ COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
264+ elif [ "$MINUTES" -gt 10 ]; then
265+ COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM"
266+ else
267+ COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT"
268+ fi
269+ else
270+ COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
271+ fi
272+
273+ if [ "$HOURS" -gt 24 ]; then
274+ echo "($COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
275+ elif [ "$MINUTES" -gt 60 ]; then
276+ echo "($COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
277+ else
278+ echo "($COLOR${MINUTES}m%{$reset_color%}|"
279+ fi
280+ else
281+ COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
282+ echo "($COLOR~|"
283+ fi
284+ fi
285+}
286diff --git a/themes/nanotech.zsh-theme b/themes/nanotech.zsh-theme
287new file mode 100644
288index 0000000000000000000000000000000000000000..5d3331639dd86f3775730a977b78446b3ea9f5ff
289--- /dev/null
290+++ b/themes/nanotech.zsh-theme
291@@ -0,0 +1,7 @@
292+PROMPT='%F{green}%2c%F{blue} [%f '
293+RPROMPT='$(git_prompt_info) %F{blue}] %F{green}%D{%L:%M} %F{yellow}%D{%p}%f'
294+
295+ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}"
296+ZSH_THEME_GIT_PROMPT_SUFFIX="%f"
297+ZSH_THEME_GIT_PROMPT_DIRTY=" %F{red}*%f"
298+ZSH_THEME_GIT_PROMPT_CLEAN=""
299diff --git a/themes/nicoulaj.zsh-theme b/themes/nicoulaj.zsh-theme
300new file mode 100644
301index 0000000000000000000000000000000000000000..333aa5e702e65256e0a73e0cef28effe65448964
302--- /dev/null
303+++ b/themes/nicoulaj.zsh-theme
304@@ -0,0 +1,43 @@
305+#!/usr/bin/env zsh
306+# ------------------------------------------------------------------------------
307+# Prompt for the Zsh shell:
308+# * One line.
309+# * VCS info on the right prompt.
310+# * Only shows the path on the left prompt by default.
311+# * Crops the path to a defined length and only shows the path relative to
312+# the current VCS repository root.
313+# * Wears a different color wether the last command succeeded/failed.
314+# * Shows user@hostname if connected through SSH.
315+# * Shows if logged in as root or not.
316+# ------------------------------------------------------------------------------
317+
318+# Customizable parameters.
319+PROMPT_PATH_MAX_LENGTH=30
320+PROMPT_DEFAULT_END=❯
321+PROMPT_ROOT_END=❯❯❯
322+PROMPT_SUCCESS_COLOR=$FG[071]
323+PROMPT_FAILURE_COLOR=$FG[124]
324+PROMPT_VCS_INFO_COLOR=$FG[242]
325+
326+# Set required options.
327+setopt promptsubst
328+
329+# Load required modules.
330+autoload -U add-zsh-hook
331+autoload -Uz vcs_info
332+
333+# Add hook for calling vcs_info before each command.
334+add-zsh-hook precmd vcs_info
335+
336+# Set vcs_info parameters.
337+zstyle ':vcs_info:*' enable hg bzr git
338+zstyle ':vcs_info:*:*' check-for-changes true # Can be slow on big repos.
339+zstyle ':vcs_info:*:*' unstagedstr '!'
340+zstyle ':vcs_info:*:*' stagedstr '+'
341+zstyle ':vcs_info:*:*' actionformats "%S" "%r/%s/%b %u%c (%a)"
342+zstyle ':vcs_info:*:*' formats "%S" "%r/%s/%b %u%c"
343+zstyle ':vcs_info:*:*' nvcsformats "%~" ""
344+
345+# Define prompts.
346+PROMPT="%(0?.%{$PROMPT_SUCCESS_COLOR%}.%{$PROMPT_FAILURE_COLOR%})${SSH_TTY:+[%n@%m]}%{$FX[bold]%}%$PROMPT_PATH_MAX_LENGTH<..<"'${vcs_info_msg_0_%%.}'"%<<%(!.$PROMPT_ROOT_END.$PROMPT_DEFAULT_END)%{$FX[no-bold]%}%{$FX[reset]%} "
347+RPROMPT="%{$PROMPT_VCS_INFO_COLOR%}"'$vcs_info_msg_1_'"%{$FX[reset]%}"
348diff --git a/themes/sorin.zsh-theme b/themes/sorin.zsh-theme
349new file mode 100644
350index 0000000000000000000000000000000000000000..601dbe5d70d629f1ea3b13444f76c03c57f9fe39
351--- /dev/null
352+++ b/themes/sorin.zsh-theme
353@@ -0,0 +1,48 @@
354+# ------------------------------------------------------------------------------
355+# FILE: sorin.zsh-theme
356+# DESCRIPTION: oh-my-zsh theme file.
357+# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
358+# VERSION: 1.0.2
359+# SCREENSHOT: http://i.imgur.com/aipDQ.png
360+# ------------------------------------------------------------------------------
361+
362+
363+if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_LS_COLORS" != "true" ]]; then
364+ MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}"
365+ local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}"
366+
367+ PROMPT='%{$fg[cyan]%}%c$(git_prompt_info) %(!.%{$fg_bold[red]%}#.%{$fg_bold[green]%}❯)%{$reset_color%} '
368+
369+ ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[blue]%}git%{$reset_color%}:%{$fg[red]%}"
370+ ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
371+ ZSH_THEME_GIT_PROMPT_DIRTY=""
372+ ZSH_THEME_GIT_PROMPT_CLEAN=""
373+
374+ RPROMPT='${return_status}$(git_prompt_status)%{$reset_color%}'
375+
376+ ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚"
377+ ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹"
378+ ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖"
379+ ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜"
380+ ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
381+ ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
382+else
383+ MODE_INDICATOR="❮❮❮"
384+ local return_status="%(?::⏎)"
385+
386+ PROMPT='%c$(git_prompt_info) %(!.#.❯) '
387+
388+ ZSH_THEME_GIT_PROMPT_PREFIX=" git:"
389+ ZSH_THEME_GIT_PROMPT_SUFFIX=""
390+ ZSH_THEME_GIT_PROMPT_DIRTY=""
391+ ZSH_THEME_GIT_PROMPT_CLEAN=""
392+
393+ RPROMPT='${return_status}$(git_prompt_status)'
394+
395+ ZSH_THEME_GIT_PROMPT_ADDED=" ✚"
396+ ZSH_THEME_GIT_PROMPT_MODIFIED=" ✹"
397+ ZSH_THEME_GIT_PROMPT_DELETED=" ✖"
398+ ZSH_THEME_GIT_PROMPT_RENAMED=" ➜"
399+ ZSH_THEME_GIT_PROMPT_UNMERGED=" ═"
400+ ZSH_THEME_GIT_PROMPT_UNTRACKED=" ✭"
401+fi
402diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
403index c59ebaed48ebd8b7a3778c6d81f34126d101aa24..4643739ca51b136737c4a1981e3354b8162cb66c 100644
404--- a/tools/check_for_upgrade.sh
405+++ b/tools/check_for_upgrade.sh
406@@ -16,7 +16,7 @@ then
407 _update_zsh_update && return 0;
408 fi
409
410- epoch_diff=$((${_current_epoch} - $LAST_EPOCH))
411+ epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
412 if [ $epoch_diff -gt 6 ]
413 then
414 echo "[Oh My Zsh] Would you like to check for updates?"