Browse code

Merge branch 'master' of github.com:robbyrussell/oh-my-zsh

Robby Russell authored on 29/04/2011 at 09:24:51
Showing 26 changed files
... ...
@@ -8,9 +8,6 @@ setopt always_to_end
8 8
 
9 9
 WORDCHARS=''
10 10
 
11
-autoload -U compinit
12
-compinit -i
13
-
14 11
 zmodload -i zsh/complist
15 12
 
16 13
 ## case-insensitive (all),partial-word and then substring completion
... ...
@@ -4,7 +4,8 @@ function git_prompt_info() {
4 4
   echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
5 5
 }
6 6
 
7
-parse_git_dirty () {
7
+# Checks if working tree is dirty
8
+parse_git_dirty() {
8 9
   if [[ -n $(git status -s 2> /dev/null) ]]; then
9 10
     echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
10 11
   else
... ...
@@ -12,7 +13,24 @@ parse_git_dirty () {
12 12
   fi
13 13
 }
14 14
 
15
-# get the status of the working tree
15
+# Checks if there are commits ahead from remote
16
+function git_prompt_ahead() {
17
+  if $(echo "$(git log origin/master..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
18
+    echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
19
+  fi
20
+}
21
+
22
+# Formats prompt string for current git commit short SHA
23
+function git_prompt_short_sha() {
24
+  SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
25
+}
26
+
27
+# Formats prompt string for current git commit long SHA
28
+function git_prompt_long_sha() {
29
+  SHA=$(git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
30
+}
31
+
32
+# Get the status of the working tree
16 33
 git_prompt_status() {
17 34
   INDEX=$(git status --porcelain 2> /dev/null)
18 35
   STATUS=""
... ...
@@ -41,4 +59,4 @@ git_prompt_status() {
41 41
     STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
42 42
   fi
43 43
   echo $STATUS
44
-}
44
+}
45 45
\ No newline at end of file
... ...
@@ -1,6 +1,4 @@
1 1
 # TODO: Explain what some of this does..
2
-autoload -U compinit
3
-compinit -i
4 2
 
5 3
 bindkey -e
6 4
 bindkey '\ew' kill-region
... ...
@@ -7,12 +7,23 @@ fpath=($ZSH/functions $fpath)
7 7
 # TIP: Add files you don't want in git to .gitignore
8 8
 for config_file ($ZSH/lib/*.zsh) source $config_file
9 9
 
10
-# Load all of your custom configurations from custom/
11
-for config_file ($ZSH/custom/*.zsh) source $config_file
10
+# Add all defined plugins to fpath
11
+plugin=${plugin:=()}
12
+for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath)
13
+
14
+# Load and run compinit
15
+autoload -U compinit
16
+compinit -i
12 17
 
13 18
 # Load all of the plugins that were defined in ~/.zshrc
14
-plugin=${plugin:=()}
15
-for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh
19
+for plugin ($plugins); do
20
+  if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
21
+    source $ZSH/plugins/$plugin/$plugin.plugin.zsh
22
+  fi
23
+done
24
+
25
+# Load all of your custom configurations from custom/
26
+for config_file ($ZSH/custom/*.zsh) source $config_file
16 27
 
17 28
 # Load the theme
18 29
 # Check for updates on initial load...
... ...
@@ -31,6 +31,7 @@ _1st_arguments=(
31 31
   'search:search for a formula (/regex/ or string)'
32 32
   'unlink:unlink a formula'
33 33
   'update:freshen up links'
34
+  'upgrade:upgrade outdated formulae'
34 35
   'uses:show formulas which depend on a formula'
35 36
 )
36 37
 
37 38
deleted file mode 100644
... ...
@@ -1,4 +0,0 @@
1
-# add brew completion function to path
2
-fpath=($ZSH/plugins/brew $fpath)
3
-autoload -U compinit
4
-compinit -i
5 1
deleted file mode 100644
... ...
@@ -1,4 +0,0 @@
1
-# add cpanm completion function to path
2
-fpath=($ZSH/plugins/cpanm $fpath)
3
-autoload -U compinit
4
-compinit -i
... ...
@@ -9,4 +9,5 @@ alias ar="sudo apt-get remove --purge && \
9 9
 		sudo apt-get autoremove --purge"	# remove package
10 10
 alias ap="apt-cache policy"				# apt policy
11 11
 alias av="apt-cache show"				# show package info
12
+alias acs="apt-cache search"                            # search package
12 13
 alias ac="sudo apt-get clean && sudo apt-get autoclean" # clean apt cache
13 14
deleted file mode 100644
... ...
@@ -1,4 +0,0 @@
1
-# add gem completion function to path
2
-fpath=($ZSH/plugins/gem $fpath)
3
-autoload -U compinit
4
-compinit -i
... ...
@@ -5,7 +5,3 @@ if [ "$commands[(I)hub]" ]; then
5 5
     function git(){hub "$@"}
6 6
 fi
7 7
 
8
-# add github completion function to path
9
-fpath=($ZSH/plugins/github $fpath)
10
-autoload -U compinit
11
-compinit -i
... ...
@@ -6,7 +6,3 @@ alias puni="sudo port uninstall inactive"
6 6
 alias puo="sudo port upgrade outdated"
7 7
 alias pup="psu && puo"
8 8
 
9
-# add macports completion function to path
10
-fpath=($ZSH/plugins/macports $fpath)
11
-autoload -U compinit
12
-compinit -i
13 9
new file mode 100644
... ...
@@ -0,0 +1,8 @@
0
+# commands to control local mysql-server installation
1
+# paths are for osx installation via macports
2
+
3
+alias mysqlstart='sudo /opt/local/share/mysql5/mysql/mysql.server start'
4
+alias mysqlstop='sudo /opt/local/share/mysql5/mysql/mysql.server stop'
5
+alias mysqlrestart='sudo /opt/local/share/mysql5/mysql/mysql.server restart'
6
+
7
+alias mysqlstatus='mysqladmin5 -u root -p ping'
0 8
deleted file mode 100644
... ...
@@ -1,6 +0,0 @@
1
-# commands to control local mysql-server installation
2
-# paths are for osx installtion via macports
3
-
4
-alias mysqlstart='sudo /opt/local/bin/mysqld_safe5'
5
-alias mysqlstop='/opt/local/bin/mysqladmin5 -u root -p shutdown'
6
-alias mysqlstatus='mysqladmin5 -u root -p ping'
7 1
\ No newline at end of file
8 2
deleted file mode 100644
... ...
@@ -1,4 +0,0 @@
1
-# add npm completion function to path
2
-fpath=($ZSH/plugins/npm $fpath)
3
-autoload -U compinit
4
-compinit -i
5 1
deleted file mode 100644
... ...
@@ -1,4 +0,0 @@
1
-# add brew completion function to path
2
-fpath=($ZSH/plugins/pip $fpath)
3
-autoload -U compinit
4
-compinit -i
5 1
new file mode 100644
... ...
@@ -0,0 +1,142 @@
0
+#compdef redis-cli rec
1
+#autoload
2
+
3
+#redis cli completion, based off homebrew completion (ref. 2011-04-14)
4
+
5
+local -a _1st_arguments
6
+_1st_arguments=(
7
+  'append:append a value to a key'
8
+  'auth:authenticate to the server'
9
+  'bgrewriteeaof:asynchronously rewrite the append-only file'
10
+  'bgsave:asynchornously save the dataset to disk'
11
+  'blpop:remove and get the first element in a list, or block until one is available'
12
+  'brpop:remove and get the last element in a list, or block until one is available'
13
+  'brpoplpush:pop a value from a list, push it to another list and return it; or block until one is available'
14
+  # 'config get:get the value of a configuration parameter'
15
+  # 'config set:set a configuration parameter to the given value'
16
+  # 'config resetstat: reset the stats returned by INFO'
17
+  'dbsize:return the number of keys in the selected database'
18
+  # 'debug object:get debugging information about a key'
19
+  # 'debug setgfault:make the server crash'
20
+  'decr:decrement the integer value of a key by one'
21
+  'decrby:decrement the integet value of a key by the given number'
22
+  'del:delete a key'
23
+  'discard:discard all commands issued after MULTI'
24
+  'echo:echo the given string'
25
+  'exec:execute all commands issued after a MULTI'
26
+  'exists:determine if a key exists'
27
+  'expire:set the time to live for a key, in seconds'
28
+  'expireat:set the expiration for a key as a UNIX timestamp'
29
+  'flushall:remove all keys from all databases'
30
+  'flushdb:remove all keys from the current database'
31
+  'get:get the value of a key'
32
+  'getbit:returns the bit value at offset in the string value stored at key'
33
+  'getrange:get a substring of the string stored at a key'
34
+  'getset:set the string value of a key and return its old value'
35
+  'hdel:delete a hash field'
36
+  'hexists:determine if a hash field exists'
37
+  'hget:get the value of a hash field'
38
+  'hgetall:get all the fields and values in a hash'
39
+  'hincrby:increment the integer value of a hash field by the given number'
40
+  'hkeys:get all the fields in a hash'
41
+  'hlen:get the number of fields in a hash'
42
+  'hmget:get the values of all the given hash fields'
43
+  'hmset:set multiple hash fields to multiple values'
44
+  'hset:set the string value of a hash field'
45
+  'hsetnx:set the value of a hash field, only if the field does not exist'
46
+  'hvals:get all the values in a hash'
47
+  'incr:increment the integer value of a key by one'
48
+  'incrby:increment the integer value of a key by the given number'
49
+  'info:get information and statistics about the server'
50
+  'keys:find all keys matching the given pattern'
51
+  'lastsave:get the UNIX timestamp of the last successful save to disk'
52
+  'lindex:get an element from a list by its index'
53
+  'linset:insert an element before or after another element in a list'
54
+  'llen:get the length of a list'
55
+  'lpop:remove and get the first element in a list'
56
+  'lpush:prepend a value to a list'
57
+  'lpushx:prepend a value to a list, only if the list exists'
58
+  'lrange:get a range of elements from a list'
59
+  'lrem:remove elements from a list'
60
+  'lset:set the value of an element in a list by its index'
61
+  'ltrim:trim a list to the specified range'
62
+  'mget:get the values of all the given keys'
63
+  'monitor:listen for all requests received by the server in real time'
64
+  'move:move a key to another database'
65
+  'mset:set multiple keys to muliple values'
66
+  'msetnx:set multiple keys tom ultiple values, only if none of the keys exist'
67
+  'multi:mark the start of a transaction block'
68
+  'object:inspect the internals of Redis objects'
69
+  'persist:remove the expiration from a key'
70
+  'ping:ping the server'
71
+  'psubscribe:listen for messages published to channels matching the given patterns'
72
+  'publish:post a message to a channel'
73
+  'punsubscribe:stop listening for messages posted to channels matching the given patterns'
74
+  'quit:close the connection'
75
+  'randomkey:return a random key from the keyspace'
76
+  'rename:rename a key'
77
+  'renamenx:rename a key, only if the new key does not exist'
78
+  'rpop:remove and get the last element in a list'
79
+  'rpoplpush:remove the last element in a list, append it to another list and return it'
80
+  'rpush:append a value to a list'
81
+  'rpushx:append a value to a list, only if the list exists'
82
+  'sadd:add a member to a set'
83
+  'save:synchronously save the dataset to disk'
84
+  'scard:get the number of members in a set'
85
+  'sdiff:subtract multiple sets'
86
+  'sdiffstore:subtract multiple sets and store the resulting set in a key'
87
+  'select:change the selected database for the current connection'
88
+  'set:set the string value of a key'
89
+  'setbit:sets or clears the bit at offset in the string value stored at key'
90
+  'setex:set the value and expiration of a key'
91
+  'setnx:set the value of a key, only if the key does not exist'
92
+  'setrange:overwrite part of a string at key starting at the specified offset'
93
+  'shutdown:synchronously save the dataset to disk and then shut down the server'
94
+  'sinter:intersect multiple sets'
95
+  'sinterstore:intersect multiple sets and store the resulting set in a key'
96
+  'sismember:determine if a given value is a member of a set'
97
+  'slaveof:make the server a slave of another instance, or promote it as master'
98
+  'smembers:get all the members in a set'
99
+  'smove:move a member from one set to another'
100
+  'sort:sort the elements in a list, set or sorted set'
101
+  'spop:remove and return a random member from a set'
102
+  'srandmember:get a random member from a set'
103
+  'srem:remove a member from a set'
104
+  'strlen:get the length of the value stored in a key'
105
+  'subscribe:listen for messages published to the given channels'
106
+  'sunion:add multiple sets'
107
+  'sunionstore:add multiple sets and store the resulting set in a key'
108
+  'ttl:get the time to live for a key'
109
+  'type:determine the type stored at key'
110
+  'unsubscribe:stop listening for messages posted to the given channels'
111
+  'unwatch:forget about all watched keys'
112
+  'watch:watch the given keys to determine execution of the MULTI/EXEC block'
113
+  'zadd:add a member to a sorted set, or update its score if it already exists'
114
+  'zcard:get the number of members in a sorted set'
115
+  'zcount:count the members in a sorted set with scores within the given values'
116
+  'zincrby:increment the score of a member in a sorted set'
117
+  'zinterstore:intersect multiple sorted sets and store the resulting sorted set in a new key'
118
+  'zrange:return a range of members in a sorted set, by index'
119
+  'zrangebyscore:return a range of members in a sorted set, by score'
120
+  'zrank:determine the index of a member in a sorted set'
121
+  'zrem:remove a member from a sorted set'
122
+  'zremrangebyrank:remove all members in a sorted set within the given indexes'
123
+  'zremrangebyscore:remove all members in a sorted set within the given scores'
124
+  'zrevrange:return a range of membrs in a sorted set, by index, with scores ordered from high to low'
125
+  'zrevrangebyscore:return a range of members in a sorted set, by score, with scores ordered from high to low'
126
+  'zrevrank:determine the index of a member in a sorted set, with scores ordered from high to low'
127
+  'zscore:get the score associated with the given member in a sorted set'
128
+  'zunionstore:add multiple sorted sets and store te resulting sorted set in a new key'
129
+)
130
+
131
+local expl
132
+
133
+_arguments \
134
+  '(-v --version)'{-v,--version}'[show version]' \
135
+  '(-h --help)'{-h,--help}'[show help]' \
136
+  '*:: :->subcmds' && return 0
137
+
138
+if (( CURRENT == 1 )); then
139
+  _describe -t commands "redis-cli subcommand" _1st_arguments
140
+  return
141
+fi
0 142
\ No newline at end of file
1 143
deleted file mode 100644
... ...
@@ -1,3 +0,0 @@
1
-fpath=($ZSH/plugins/vagrant $fpath)
2
-autoload -U compinit
3
-compinit -i
4 1
new file mode 100644
... ...
@@ -0,0 +1,12 @@
0
+## Aliases
1
+
2
+alias ys="yum search"                       # search package
3
+alias yp="yum info"                         # show package info
4
+alias yl="yum list"                         # list packages
5
+alias yli="yum list installed"              # print all installed packages
6
+
7
+alias yu="sudo yum update"                  # upgrate packages
8
+alias yi="sudo yum install"                 # install package
9
+alias yr="sudo yum remove"                  # remove package
10
+alias yrl="sudo yum remove --remove-leaves" # remove package and leaves
11
+alias yc="sudo yum clean all"               # clean cache
... ...
@@ -1,4 +1,4 @@
1
-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)
1
+PROMPT='%{$fg[blue]%}%n%{$reset_color%} on %{$fg[red]%}%M%{$reset_color%} in %{$fg[blue]%}%~%b%{$reset_color%}$(git_time_since_commit)$(check_git_prompt_info)
2 2
 $ '
3 3
 
4 4
 ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}"
... ...
@@ -16,6 +16,29 @@ ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
16 16
 ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
17 17
 ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
18 18
 
19
+
20
+# Git sometimes goes into a detached head state. git_prompt_info doesn't
21
+# return anything in this case. So wrap it in another function and check
22
+# for an empty string.
23
+function check_git_prompt_info() {
24
+    if git rev-parse --git-dir > /dev/null 2>&1; then
25
+        if [[ -z $(git_prompt_info) ]]; then
26
+            echo "%{$fg[magenta]%}detached-head%{$reset_color%})"
27
+        else
28
+            echo "$(git_prompt_info)"
29
+        fi
30
+    fi
31
+}
32
+
33
+# Determine if we are using a gemset.
34
+function rvm_gemset() {
35
+    GEMSET=`rvm gemset list | grep '=>' | cut -b4-`
36
+    if [[ -n $GEMSET ]]; then
37
+        echo "%{$fg[yellow]%}$GEMSET%{$reset_color%}|"
38
+    fi 
39
+
40
+}
41
+
19 42
 # Determine the time since last commit. If branch is clean,
20 43
 # use a neutral color, otherwise colors will vary according to time.
21 44
 function git_time_since_commit() {
... ...
@@ -49,15 +72,15 @@ function git_time_since_commit() {
49 49
             fi
50 50
 
51 51
             if [ "$HOURS" -gt 24 ]; then
52
-                echo "($COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
52
+                echo "($(rvm_gemset)$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
53 53
             elif [ "$MINUTES" -gt 60 ]; then
54
-                echo "($COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
54
+                echo "($(rvm_gemset)$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
55 55
             else
56
-                echo "($COLOR${MINUTES}m%{$reset_color%}|"
56
+                echo "($(rvm_gemset)$COLOR${MINUTES}m%{$reset_color%}|"
57 57
             fi
58 58
         else
59 59
             COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
60
-            echo "($COLOR~|"
60
+            echo "($(rvm_gemset)$COLOR~|"
61 61
         fi
62 62
     fi
63 63
 }
... ...
@@ -3,7 +3,7 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
3 3
 
4 4
 local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
5 5
 local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
6
-local rvm_ruby='%{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v g)›%{$reset_color%}'
6
+local rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
7 7
 local git_branch='$(git_prompt_info)%{$reset_color%}'
8 8
 
9 9
 PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
10 10
new file mode 100644
... ...
@@ -0,0 +1,85 @@
0
+# -----------------------------------------------------------------------------
1
+#          FILE: dogenpunk.zsh-theme
2
+#   DESCRIPTION: oh-my-zsh theme file.
3
+#        AUTHOR: Matthew Nelson (dogenpunk@gmail.com)
4
+#       VERSION: 0.1
5
+#    SCREENSHOT: coming soon
6
+# -----------------------------------------------------------------------------
7
+
8
+MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}"
9
+local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}"
10
+
11
+PROMPT='%{$fg[blue]%}%m%{$reset_color%}%{$fg_bold[white]%} ओम् %{$reset_color%}%{$fg[cyan]%}%~:%{$reset_color%}$(git_time_since_commit)$(git_prompt_info)
12
+%{$fg[red]%}%!%{$reset_color%} $(prompt_char) '
13
+
14
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[green]%}git%{$reset_color%}@%{$bg[white]%}%{$fg[black]%}"
15
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})"
16
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!%{$reset_color%}"
17
+ZSH_THEME_GIT_PROMPT_CLEAN=""
18
+
19
+RPROMPT='${return_status}$(git_prompt_status)%{$reset_color%}'
20
+
21
+ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚"
22
+ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹"
23
+ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖"
24
+ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜"
25
+ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
26
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
27
+
28
+function prompt_char() {
29
+  git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return
30
+  hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return
31
+  echo "%{$fg[cyan]%}◯ %{$reset_color%}"
32
+}
33
+
34
+# Colors vary depending on time lapsed.
35
+ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}"
36
+ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
37
+ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
38
+ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
39
+
40
+# Determine the time since last commit. If branch is clean,
41
+# use a neutral color, otherwise colors will vary according to time.
42
+function git_time_since_commit() {
43
+    if git rev-parse --git-dir > /dev/null 2>&1; then
44
+        # Only proceed if there is actually a commit.
45
+        if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then
46
+            # Get the last commit.
47
+            last_commit=`git log --pretty=format:'%at' -1 2> /dev/null`
48
+            now=`date +%s`
49
+            seconds_since_last_commit=$((now-last_commit))
50
+
51
+            # Totals
52
+            MINUTES=$((seconds_since_last_commit / 60))
53
+            HOURS=$((seconds_since_last_commit/3600))
54
+
55
+            # Sub-hours and sub-minutes
56
+            DAYS=$((seconds_since_last_commit / 86400))
57
+            SUB_HOURS=$((HOURS % 24))
58
+            SUB_MINUTES=$((MINUTES % 60))
59
+
60
+            if [[ -n $(git status -s 2> /dev/null) ]]; then
61
+                if [ "$MINUTES" -gt 30 ]; then
62
+                    COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
63
+                elif [ "$MINUTES" -gt 10 ]; then
64
+                    COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM"
65
+                else
66
+                    COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT"
67
+                fi
68
+            else
69
+                COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
70
+            fi
71
+
72
+            if [ "$HOURS" -gt 24 ]; then
73
+                echo "($COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
74
+            elif [ "$MINUTES" -gt 60 ]; then
75
+                echo "($COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
76
+            else
77
+                echo "($COLOR${MINUTES}m%{$reset_color%}|"
78
+            fi
79
+        else
80
+            COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
81
+            echo "($COLOR~|"
82
+        fi
83
+    fi
84
+}
0 85
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}["
1
+ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}"
2
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}"
3
+ZSH_THEME_GIT_PROMPT_CLEAN=""
4
+
5
+#Customized git status, oh-my-zsh currently does not allow render dirty status before branch
6
+git_custom_status() {
7
+  local cb=$(current_branch)
8
+  if [ -n "$cb" ]; then
9
+    echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX"
10
+  fi
11
+}
12
+
13
+#RVM and git settings
14
+if [[ -s ~/.rvm/scripts/rvm ]] ; then 
15
+  RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1'
16
+fi
17
+
18
+PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b '
0 19
new file mode 100644
... ...
@@ -0,0 +1,137 @@
0
+function precmd {
1
+    local TERMWIDTH
2
+    (( TERMWIDTH = ${COLUMNS} - 1 ))
3
+
4
+
5
+    ###
6
+    # Truncate the path if it's too long.
7
+    
8
+    PR_FILLBAR=""
9
+    PR_PWDLEN=""
10
+    
11
+    local promptsize=${#${(%):---(%n@%m:%l)---()--}}
12
+    local rubyprompt=`rvm_prompt_info`
13
+    local rubypromptsize=${#${rubyprompt}}
14
+    local pwdsize=${#${(%):-%~}}
15
+    
16
+    if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then
17
+      ((PR_PWDLEN=$TERMWIDTH - $promptsize))
18
+    else
19
+      PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $rubypromptsize + $pwdsize)))..${PR_HBAR}.)}"
20
+    fi
21
+
22
+}
23
+
24
+
25
+setopt extended_glob
26
+preexec () {
27
+    if [[ "$TERM" == "screen" ]]; then
28
+	local CMD=${1[(wr)^(*=*|sudo|-*)]}
29
+	echo -n "\ek$CMD\e\\"
30
+    fi
31
+}
32
+
33
+
34
+setprompt () {
35
+    ###
36
+    # Need this so the prompt will work.
37
+
38
+    setopt prompt_subst
39
+
40
+
41
+    ###
42
+    # See if we can use colors.
43
+
44
+    autoload colors zsh/terminfo
45
+    if [[ "$terminfo[colors]" -ge 8 ]]; then
46
+	colors
47
+    fi
48
+    for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do
49
+	eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
50
+	eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
51
+	(( count = $count + 1 ))
52
+    done
53
+    PR_NO_COLOUR="%{$terminfo[sgr0]%}"
54
+
55
+    ###
56
+    # Modify Git prompt
57
+    ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}"
58
+    ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
59
+    ZSH_THEME_GIT_PROMPT_DIRTY=""
60
+    ZSH_THEME_GIT_PROMPT_CLEAN=""
61
+
62
+    ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚"
63
+    ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹"
64
+    ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖"
65
+    ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜"
66
+    ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
67
+    ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
68
+
69
+    ###
70
+    # See if we can use extended characters to look nicer.
71
+    
72
+    typeset -A altchar
73
+    set -A altchar ${(s..)terminfo[acsc]}
74
+    PR_SET_CHARSET="%{$terminfo[enacs]%}"
75
+    PR_SHIFT_IN="%{$terminfo[smacs]%}"
76
+    PR_SHIFT_OUT="%{$terminfo[rmacs]%}"
77
+    PR_HBAR=${altchar[q]:--}
78
+    PR_ULCORNER=${altchar[l]:--}
79
+    PR_LLCORNER=${altchar[m]:--}
80
+    PR_LRCORNER=${altchar[j]:--}
81
+    PR_URCORNER=${altchar[k]:--}
82
+
83
+    
84
+    ###
85
+    # Decide if we need to set titlebar text.
86
+    
87
+    case $TERM in
88
+	xterm*)
89
+	    PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}'
90
+	    ;;
91
+	screen)
92
+	    PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}'
93
+	    ;;
94
+	*)
95
+	    PR_TITLEBAR=''
96
+	    ;;
97
+    esac
98
+    
99
+    
100
+    ###
101
+    # Decide whether to set a screen title
102
+    if [[ "$TERM" == "screen" ]]; then
103
+	PR_STITLE=$'%{\ekzsh\e\\%}'
104
+    else
105
+	PR_STITLE=''
106
+    fi
107
+    
108
+    
109
+    ###
110
+    # Finally, the prompt.
111
+
112
+    PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
113
+$PR_CYAN$PR_SHIFT_IN$PR_ULCORNER$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\
114
+$PR_GREEN%$PR_PWDLEN<...<%~%<<\
115
+$PR_GREY)`rvm_prompt_info`$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\
116
+$PR_CYAN%(!.%SROOT%s.%n)$PR_GREY@$PR_GREEN%m:%l\
117
+$PR_GREY)$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_URCORNER$PR_SHIFT_OUT\
118
+
119
+$PR_CYAN$PR_SHIFT_IN$PR_LLCORNER$PR_BLUE$PR_HBAR$PR_SHIFT_OUT(\
120
+$PR_YELLOW%D{%H:%M:%S}\
121
+$PR_LIGHT_BLUE%{$reset_color%}`git_prompt_info``git_prompt_status`$PR_BLUE)$PR_CYAN$PR_SHIFT_IN$PR_HBAR\
122
+$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
123
+>$PR_NO_COLOUR '
124
+
125
+    # display exitcode on the right when >0
126
+    return_code="%(?..%{$fg[red]%}%? ↵ %{$reset_color%})"
127
+    RPROMPT=' $return_code$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_BLUE$PR_HBAR$PR_SHIFT_OUT\
128
+($PR_YELLOW%D{%a,%b%d}$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_CYAN$PR_LRCORNER$PR_SHIFT_OUT$PR_NO_COLOUR'
129
+
130
+    PS2='$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
131
+$PR_BLUE$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT(\
132
+$PR_LIGHT_GREEN%_$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
133
+$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR '
134
+}
135
+
136
+setprompt
0 137
new file mode 100644
... ...
@@ -0,0 +1,8 @@
0
+#PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
1
+PROMPT="%{$fg_bold[cyan]%}%T%{$fg_bold[green]%} %{$fg_bold[white]%}%n%{$fg[magenta]%}@%{$fg_bold[white]%}%m %{$fg_bold[green]%}%d
2
+%{$fg_bold[yellow]%}%% $(git_prompt_info)%{$reset_color%}"
3
+
4
+#ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
5
+#ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
6
+#ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
7
+#ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
0 8
new file mode 100644
... ...
@@ -0,0 +1,14 @@
0
+local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
1
+local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
2
+local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}'
3
+local rvm_ruby='%{$fg[red]%}$(rvm_prompt_info)%{$reset_color%}'
4
+local git_branch='%{$fg[blue]%}$(git_prompt_info)%{$reset_color%}'
5
+
6
+PROMPT="${user_host}:${current_dir} ${rvm_ruby}
7
+${git_branch} %B$%b "
8
+RPS1="${return_code}"
9
+
10
+ZSH_THEME_GIT_PROMPT_PREFIX=""
11
+ZSH_THEME_GIT_PROMPT_SUFFIX=""
12
+ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}✗%{$reset_color%}"
13
+ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%{$reset_color%}"
... ...
@@ -5,7 +5,7 @@ then
5 5
 fi
6 6
 
7 7
 echo "Cloning Oh My Zsh..."
8
-/usr/bin/env git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
8
+/usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
9 9
 
10 10
 echo "Looking for an existing zsh config..."
11 11
 if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]
... ...
@@ -22,7 +22,7 @@ echo "Copying your current PATH and adding it to the end of ~/.zshrc for you."
22 22
 echo "export PATH=$PATH" >> ~/.zshrc
23 23
 
24 24
 echo "Time to change your default shell to zsh!"
25
-chsh -s "/usr/bin/env zsh"
25
+chsh -s `which zsh`
26 26
 
27 27
 echo '         __                                     __  '
28 28
 echo '  ____  / /_     ____ ___  __  __   ____  _____/ /_ '