Browse code

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

Robby Russell authored on 01/06/2011 at 07:33:49
Showing 20 changed files
... ...
@@ -2,5 +2,6 @@ locals.zsh
2 2
 log/.zsh_history
3 3
 projects.zsh
4 4
 custom/*
5
+!custom/example
5 6
 !custom/example.zsh
6 7
 cache
... ...
@@ -48,7 +48,9 @@ the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty fo
48 48
 h3. Customization
49 49
 
50 50
 If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory.
51
-If you have many functions which go good together you can put them as a *.plugin.zsh file in the @plugin/@ directory and then enable this plugin.
51
+If you have many functions which go good together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin.
52
+If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@.
53
+
52 54
 
53 55
 h3. Uninstalling
54 56
 
... ...
@@ -68,4 +70,4 @@ This project wouldn't exist without all of our awesome users and contributors.
68 68
 
69 69
 * "View our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors
70 70
 
71
-Thank you so much!
72 71
\ No newline at end of file
72
+Thank you so much!
73 73
new file mode 100644
... ...
@@ -0,0 +1,2 @@
0
+# Add your own custom plugins in the custom/plugins directory. Plugins placed
1
+# here will override ones with the same name in the main plugins directory.
... ...
@@ -52,11 +52,11 @@ git_prompt_status() {
52 52
   if $(echo "$INDEX" | grep '^R  ' &> /dev/null); then
53 53
     STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS"
54 54
   fi
55
-  if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
55
+  if $(echo "$INDEX" | grep '^D ' &> /dev/null); then
56 56
     STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
57 57
   fi
58 58
   if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
59 59
     STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
60 60
   fi
61 61
   echo $STATUS
62
-}
63 62
\ No newline at end of file
63
+}
... ...
@@ -17,7 +17,9 @@ compinit -i
17 17
 
18 18
 # Load all of the plugins that were defined in ~/.zshrc
19 19
 for plugin ($plugins); do
20
-  if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
20
+  if [ -f $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh ]; then
21
+    source $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh
22
+  elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
21 23
     source $ZSH/plugins/$plugin/$plugin.plugin.zsh
22 24
   fi
23 25
 done
... ...
@@ -1,8 +1,15 @@
1
+stat -f%m . > /dev/null 2>&1
2
+if [ "$?" = 0 ]; then
3
+	stat_cmd=(stat -f%m)
4
+else
5
+	stat_cmd=(stat -L --format=%y)
6
+fi
7
+
1 8
 _ant_does_target_list_need_generating () {
2 9
   if [ ! -f .ant_targets ]; then return 0;
3 10
   else
4
-    accurate=$(stat -f%m .ant_targets)
5
-    changed=$(stat -f%m build.xml)
11
+    accurate=$($stat_cmd -f%m .ant_targets)
12
+    changed=$($stat_cmd -f%m build.xml)
6 13
     return $(expr $accurate '>=' $changed)
7 14
   fi
8 15
 }
... ...
@@ -25,10 +25,12 @@ _1st_arguments=(
25 25
   'link:link a formula'
26 26
   'list:list files in a formula or not-installed formulae'
27 27
   'log:git commit log for a formula'
28
+  'missing:check all installed formuale for missing dependencies.'
28 29
   'outdated:list formulas for which a newer version is available'
29 30
   'prune:remove dead links'
30 31
   'remove:remove a formula'
31 32
   'search:search for a formula (/regex/ or string)'
33
+  'server:start a local web app that lets you browse formulae (requires Sinatra)'
32 34
   'unlink:unlink a formula'
33 35
   'update:freshen up links'
34 36
   'upgrade:upgrade outdated formulae'
... ...
@@ -36,10 +38,14 @@ _1st_arguments=(
36 36
 )
37 37
 
38 38
 local expl
39
-local -a formula installed_formulae
39
+local -a formulae installed_formulae
40 40
 
41 41
 _arguments \
42
-  '(-v --verbose)'{-v,--verbose}'[verbose]' \
42
+  '(-v)-v[verbose]' \
43
+  '(--cellar)--cellar[brew cellar]' \
44
+  '(--config)--config[brew configuration]' \
45
+  '(--env)--env[brew environment]' \
46
+  '(--repository)--repository[brew repository]' \
43 47
   '(--version)--version[version information]' \
44 48
   '(--prefix)--prefix[where brew lives on this system]' \
45 49
   '(--cache)--cache[brew cache]' \
... ...
@@ -51,20 +57,24 @@ if (( CURRENT == 1 )); then
51 51
 fi
52 52
 
53 53
 case "$words[1]" in
54
-  list)
54
+  search|-S)
55
+    _arguments \
56
+      '(--macports)--macports[search the macports repository]' \
57
+      '(--fink)--fink[search the fink repository]' ;;
58
+  list|ls)
55 59
     _arguments \
56 60
       '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
61
+      '(--versions)--versions[list all installed versions of a formula]' \
57 62
       '1: :->forms' &&  return 0
58 63
 
59 64
       if [[ "$state" == forms ]]; then
60 65
         _brew_installed_formulae
61
-        _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae
66
+        _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
62 67
       fi ;;
63
-  install|home|log|info|uses|cat|deps)
68
+  install|home|homepage|log|info|abv|uses|cat|deps|edit|options)
64 69
     _brew_all_formulae
65 70
     _wanted formulae expl 'all formulae' compadd -a formulae ;;
66
-  remove|edit|xo)
71
+  remove|rm|uninstall|unlink|cleanup|link|ln)
67 72
     _brew_installed_formulae
68 73
     _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
69 74
 esac
70
-
71 75
new file mode 100644
... ...
@@ -0,0 +1 @@
0
+alias brews='brew list -1'
... ...
@@ -18,4 +18,4 @@ function _cap () {
18 18
   fi
19 19
 }
20 20
 
21
-compctl -K _cap cap
22 21
\ No newline at end of file
22
+compctl -K _cap cap
... ...
@@ -5,7 +5,6 @@
5 5
 #       VERSION:  1.0.0
6 6
 # ------------------------------------------------------------------------------
7 7
 
8
-
9 8
 if (( ${+commands[compleat]} )); then
10 9
   local prefix="${commands[compleat]:h:h}"
11 10
   local setup="${prefix}/share/compleat-1.0/compleat_setup" 
... ...
@@ -19,4 +18,3 @@ if (( ${+commands[compleat]} )); then
19 19
     source "$setup" 
20 20
   fi
21 21
 fi
22
-
... ...
@@ -4,4 +4,3 @@ if [ "$commands[(I)hub]" ]; then
4 4
     # eval `hub alias -s zsh`
5 5
     function git(){hub "$@"}
6 6
 fi
7
-
8 7
new file mode 100644
... ...
@@ -0,0 +1,5 @@
0
+# Open the node api for your current version to the optional section.
1
+# TODO: Make the section part easier to use.
2
+function node-docs {
3
+	open "http://nodejs.org/docs/$(node --version)/api/all.html#$1"
4
+}
... ...
@@ -1,3 +1,9 @@
1
+alias showfiles='defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder'
2
+alias hidefiles='defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder'
3
+
4
+# Recursively delete .DS_Store files
5
+alias rm-dsstore="find . -name '*.DS_Store' -type f -delete"
6
+
1 7
 function savepath() {
2 8
   pwd > ~/.current_path~
3 9
 }
4 10
new file mode 100644
... ...
@@ -0,0 +1,10 @@
0
+# Thanks to Christopher Sexton
1
+# https://gist.github.com/965032
2
+function kapow {
3
+	touch ~/.pow/$1/tmp/restart.txt
4
+	if [ $? -eq 0 ]; then
5
+		echo "$fg[yellow]Pow restarting $1...$reset_color"
6
+	fi
7
+}
8
+
9
+compctl -W ~/.pow -/ kapow
... ...
@@ -1,4 +1,6 @@
1
+# TODO: Make this compatible with rvm.
2
+#       Run sudo gem on the system ruby, not the active ruby.
1 3
 alias sgem='sudo gem'
2 4
 
3 5
 # Find ruby file
4
-alias rfind='find . -name *.rb | xargs grep -n'
5 6
\ No newline at end of file
7
+alias rfind='find . -name *.rb | xargs grep -n'
... ...
@@ -1,3 +1,44 @@
1
-fpath=($ZSH/plugins/rvm $fpath)
2
-autoload -U compinit
3
-compinit -i
1
+alias rubies='rvm list rubies'
2
+alias gemsets='rvm gemset list'
3
+
4
+local ruby18='ruby-1.8.7-p334'
5
+local ruby19='ruby-1.9.2-p180'
6
+
7
+function rb18 {
8
+	if [ -z "$1" ]; then
9
+		rvm use "$ruby18"
10
+	else
11
+		rvm use "$ruby18@$1"
12
+	fi
13
+}
14
+
15
+_rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`}
16
+compdef _rb18 rb18
17
+
18
+function rb19 {
19
+	if [ -z "$1" ]; then
20
+		rvm use "$ruby19"
21
+	else
22
+		rvm use "$ruby19@$1"
23
+	fi
24
+}
25
+
26
+_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`}
27
+compdef _rb19 rb19
28
+
29
+function rvm-update {
30
+	rvm get head
31
+	rvm reload # TODO: Reload rvm completion?
32
+}
33
+
34
+# TODO: Make this usable w/o rvm.
35
+function gems {
36
+	local current_ruby=`rvm-prompt i v p`
37
+	local current_gemset=`rvm-prompt g`
38
+
39
+	gem list $@ | sed \
40
+		-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
41
+		-Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
42
+		-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
43
+		-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
44
+}
... ...
@@ -1,11 +1,9 @@
1
-
2
-# TextMate
3 1
 alias et='mate .'
4 2
 alias ett='mate app config lib db public spec test Rakefile Capfile Todo'
5 3
 alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
6 4
 alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
7 5
 
8
-# Editor Ruby file in TextMate
6
+# Edit Ruby app in TextMate
9 7
 alias mr='mate CHANGELOG app config db lib public script spec test'
10 8
 
11 9
 function tm() {
12 10
new file mode 100644
... ...
@@ -0,0 +1,4 @@
0
+#compdef thor
1
+#autoload
2
+
3
+compadd `thor list | grep thor | cut -d " " -f 2`
0 4
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[white]%}["
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 "- $ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
10
+  fi
11
+}
12
+
13
+
14
+PROMPT='%2~ $(git_custom_status) »%b '
0 15
\ No newline at end of file
1 16
new file mode 100644
... ...
@@ -0,0 +1,95 @@
0
+# Name:   trapd00r zsh theme
1
+# Author: Magnus Woldrich <m@japh.se>
2
+#
3
+# This theme needs a terminal supporting 256 colors as well as unicode. It also
4
+# needs the script that splits up the current path and makes it fancy as located
5
+# here: https://github.com/trapd00r/utils/blob/master/zsh_path
6
+#
7
+# By default it spans over two lines like so:
8
+#
9
+# scp1@shiva:pts/9-> /home » scp1 (0)
10
+# >
11
+#
12
+# that's  user@host:pts/-> splitted path (return status)
13
+#
14
+# If the current directory is a git repository, we span 3 lines;
15
+#
16
+# git❨ master ❩ DIRTY
17
+# scp1@shiva:pts/4-> /home » scp1 » dev » utils (0)
18
+# >
19
+
20
+autoload -U add-zsh-hook
21
+autoload -Uz vcs_info
22
+
23
+local c0=$( printf "\e[m")
24
+local c1=$( printf "\e[38;5;245m")
25
+local c2=$( printf "\e[38;5;250m")
26
+local c3=$( printf "\e[38;5;242m")
27
+local c4=$( printf "\e[38;5;197m")
28
+local c5=$( printf "\e[38;5;225m")
29
+local c6=$( printf "\e[38;5;240m")
30
+local c7=$( printf "\e[38;5;242m")
31
+local c8=$( printf "\e[38;5;244m")
32
+local c9=$( printf "\e[38;5;162m")
33
+local c10=$(printf "\e[1m")
34
+local c11=$(printf "\e[38;5;208m\e[1m")
35
+local c12=$(printf "\e[38;5;142m\e[1m")
36
+local c13=$(printf "\e[38;5;196m\e[1m")
37
+
38
+
39
+# We dont want to use the extended colorset in the TTY / VC.
40
+if [ "$TERM" = "linux" ]; then
41
+    c1=$( printf "\e[34;1m")
42
+    c2=$( printf "\e[35m")
43
+    c3=$( printf "\e[31m")
44
+    c4=$( printf "\e[31;1m")
45
+    c5=$( printf "\e[32m")
46
+    c6=$( printf "\e[32;1m")
47
+    c7=$( printf "\e[33m")
48
+    c8=$( printf "\e[33;1m")
49
+    c9=$( printf "\e[34m")
50
+
51
+    c11=$(printf "\e[35;1m")
52
+    c12=$(printf "\e[36m")
53
+    c13=$(printf "\e[31;1m")
54
+fi
55
+
56
+zstyle ':vcs_info:*' actionformats \
57
+    '%{$c8%}(%f%s)%{$c7%}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
58
+
59
+zstyle ':vcs_info:*' formats \
60
+    "%{$c8%}%s%%{$c7%}❨ %{$c9%}%{$c11%}%b%{$c7%} ❩%{$reset_color%}%f "
61
+
62
+zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
63
+zstyle ':vcs_info:*' enable git
64
+
65
+add-zsh-hook precmd prompt_jnrowe_precmd
66
+
67
+prompt_jnrowe_precmd () {
68
+  vcs_info
69
+  if [ "${vcs_info_msg_0_}" = "" ]; then
70
+    dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
71
+    PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%}
72
+> '
73
+
74
+# modified, to be commited
75
+  elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then
76
+    dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
77
+    PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%}
78
+%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
79
+> '
80
+
81
+  elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then
82
+    dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
83
+    PROMPT='${vcs_info_msg_0_}%{$bg_bold[red]%}%{$fg_bold[blue]%}D%{$fg_bold[black]%}IRTY%{$reset_color%}
84
+%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
85
+%{$c13%}>%{$c0%} '
86
+  else
87
+    dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
88
+    PROMPT='${vcs_info_msg_0_}
89
+%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%}
90
+> '
91
+fi
92
+}
93
+
94
+#  vim: set ft=zsh sw=2 et tw=0: