Browse code

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

Pat Regan authored on 27/04/2011 at 08:56:44
Showing 11 changed files
... ...
@@ -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
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
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
new file mode 100644
... ...
@@ -0,0 +1,4 @@
0
+# add redis completion function to path
1
+fpath=($ZSH/plugins/redis-cli $fpath)
2
+autoload -U compinit
3
+compinit -i
0 4
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
 }
64 64
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,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 '  ____  / /_     ____ ___  __  __   ____  _____/ /_ '