Browse code

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

Roman Kamyk authored on 15/09/2011 at 10:56:40
Showing 83 changed files
... ...
@@ -2,5 +2,7 @@ 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
8
+*.swp
... ...
@@ -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.
... ...
@@ -22,4 +22,3 @@ alias sl=ls # often screw this up
22 22
 
23 23
 alias afind='ack-grep -il'
24 24
 
25
-alias x=extract
... ...
@@ -59,3 +59,12 @@ zstyle ':completion:*:*:*:users' ignored-patterns \
59 59
 # ... unless we really want to.
60 60
 zstyle '*' single-ignored show
61 61
 
62
+if [ "x$COMPLETION_WAITING_DOTS" = "xtrue" ]; then
63
+  expand-or-complete-with-dots() {
64
+    echo -n "\e[31m......\e[0m"
65
+    zle expand-or-complete
66
+    zle redisplay
67
+  }
68
+  zle -N expand-or-complete-with-dots
69
+  bindkey "^I" expand-or-complete-with-dots
70
+fi
62 71
new file mode 100644
... ...
@@ -0,0 +1,3 @@
0
+autoload -U edit-command-line
1
+zle -N edit-command-line
2
+bindkey '\C-x\C-e' edit-command-line
... ...
@@ -15,38 +15,3 @@ function take() {
15 15
   cd $1
16 16
 }
17 17
 
18
-function extract() {
19
-    unset REMOVE_ARCHIVE
20
-    
21
-    if test "$1" = "-r"; then
22
-        REMOVE=1
23
-        shift
24
-    fi
25
-  if [[ -f $1 ]]; then
26
-    case $1 in
27
-      *.tar.bz2) tar xvjf $1;;
28
-      *.tar.gz) tar xvzf $1;;
29
-      *.tar.xz) tar xvJf $1;;
30
-      *.tar.lzma) tar --lzma -xvf $1;;
31
-      *.bz2) bunzip $1;;
32
-      *.rar) unrar $1;;
33
-      *.gz) gunzip $1;;
34
-      *.tar) tar xvf $1;;
35
-      *.tbz2) tar xvjf $1;;
36
-      *.tgz) tar xvzf $1;;
37
-      *.zip) unzip $1;;
38
-      *.Z) uncompress $1;;
39
-      *.7z) 7z x $1;;
40
-      *) echo "'$1' cannot be extracted via >extract<";;
41
-    esac
42
-
43
-    if [[ $REMOVE_ARCHIVE -eq 1 ]]; then
44
-        echo removing "$1";
45
-        /bin/rm "$1";
46
-    fi
47
-
48
-  else
49
-    echo "'$1' is not a valid file"
50
-  fi
51
-}
52
-
... ...
@@ -15,7 +15,7 @@ parse_git_dirty() {
15 15
 
16 16
 # Checks if there are commits ahead from remote
17 17
 function git_prompt_ahead() {
18
-  if $(echo "$(git log origin/master..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
18
+  if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
19 19
     echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
20 20
   fi
21 21
 }
... ...
@@ -54,9 +54,11 @@ git_prompt_status() {
54 54
   fi
55 55
   if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
56 56
     STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
57
+  elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then
58
+    STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
57 59
   fi
58 60
   if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
59 61
     STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
60 62
   fi
61 63
   echo $STATUS
62
-}
63 64
\ No newline at end of file
65
+}
... ...
@@ -14,12 +14,23 @@ bindkey '^[[B' down-line-or-search
14 14
 
15 15
 bindkey "^[[H" beginning-of-line
16 16
 bindkey "^[[1~" beginning-of-line
17
+bindkey "^[OH" beginning-of-line
17 18
 bindkey "^[[F"  end-of-line
18 19
 bindkey "^[[4~" end-of-line
20
+bindkey "^[OF" end-of-line
19 21
 bindkey ' ' magic-space    # also do history expansion on space
20 22
 
23
+bindkey "^[[1;5C" forward-word
24
+bindkey "^[[1;5D" backward-word
25
+
21 26
 bindkey '^[[Z' reverse-menu-complete
22 27
 
28
+# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~
29
+bindkey '^?' backward-delete-char
30
+bindkey "^[[3~" delete-char
31
+bindkey "^[3;5~" delete-char
32
+bindkey "\e[3~" delete-char
33
+
23 34
 # consider emacs keybindings:
24 35
 
25 36
 #bindkey -e  ## emacs key bindings
... ...
@@ -10,4 +10,4 @@ setopt long_list_jobs
10 10
 
11 11
 ## pager
12 12
 export PAGER=less
13
-export LC_CTYPE=en_US.UTF-8
13
+export LC_CTYPE=$LANG
... ...
@@ -18,3 +18,11 @@ for color in {000..255}; do
18 18
     FG[$color]="%{[38;5;${color}m%}"
19 19
     BG[$color]="%{[48;5;${color}m%}"
20 20
 done
21
+
22
+# Show all 256 colors with color number
23
+function spectrum_ls() {
24
+  for code in {000..255}; do
25
+    print -P -- "$code: %F{$code}Test%f"
26
+  done
27
+}
28
+
... ...
@@ -1,7 +1,13 @@
1
+# Check for updates on initial load...
2
+if [ "$DISABLE_AUTO_UPDATE" != "true" ]
3
+then
4
+  /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh
5
+fi
6
+
1 7
 # Initializes Oh My Zsh
2 8
 
3 9
 # add a function path
4
-fpath=($ZSH/functions $fpath)
10
+fpath=($ZSH/functions $ZSH/completions $fpath)
5 11
 
6 12
 # Load all of the config files in ~/oh-my-zsh that end in .zsh
7 13
 # TIP: Add files you don't want in git to .gitignore
... ...
@@ -17,7 +23,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
... ...
@@ -26,24 +34,18 @@ done
26 26
 for config_file ($ZSH/custom/*.zsh) source $config_file
27 27
 
28 28
 # Load the theme
29
-# Check for updates on initial load...
30 29
 if [ "$ZSH_THEME" = "random" ]
31 30
 then
32 31
   themes=($ZSH/themes/*zsh-theme)
33 32
   N=${#themes[@]}
34
-  ((N=RANDOM%N))
33
+  ((N=(RANDOM%N)+1))
35 34
   RANDOM_THEME=${themes[$N]}
36 35
   source "$RANDOM_THEME"
37 36
   echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
38 37
 else
39
-  source "$ZSH/themes/$ZSH_THEME.zsh-theme"
38
+  if [ ! "$ZSH_THEME" = ""  ]
39
+  then
40
+    source "$ZSH/themes/$ZSH_THEME.zsh-theme"
41
+  fi
40 42
 fi
41 43
 
42
-
43
-# Check for updates on initial load...
44
-if [ "$DISABLE_AUTO_UPDATE" = "true" ]
45
-then
46
-  return
47
-else
48
-  /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh
49
-fi
50 44
new file mode 100644
... ...
@@ -0,0 +1,26 @@
0
+stat -f%m . > /dev/null 2>&1
1
+if [ "$?" = 0 ]; then
2
+	stat_cmd=(stat -f%m)
3
+else
4
+	stat_cmd=(stat -L --format=%Y)
5
+fi
6
+
7
+_ant_does_target_list_need_generating () {
8
+  if [ ! -f .ant_targets ]; then return 0;
9
+  else
10
+    accurate=$($stat_cmd .ant_targets)
11
+    changed=$($stat_cmd build.xml)
12
+    return $(expr $accurate '>=' $changed)
13
+  fi
14
+}
15
+
16
+_ant () {
17
+  if [ -f build.xml ]; then
18
+    if _ant_does_target_list_need_generating; then
19
+     sed -n '/<target/s/<target.*name="\([^"]*\).*$/\1/p' build.xml > .ant_targets
20
+    fi
21
+    compadd `cat .ant_targets`
22
+  fi
23
+}
24
+
25
+compdef _ant ant
0 26
new file mode 100644
... ...
@@ -0,0 +1,6 @@
0
+# commands to control local apache2 server installation
1
+# paths are for osx installation via macports
2
+
3
+alias apache2start='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start'
4
+alias apache2stop='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop'
5
+alias apache2restart='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart'
0 6
new file mode 100644
... ...
@@ -0,0 +1,76 @@
0
+# Archlinux zsh aliases and functions
1
+# Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins
2
+
3
+# Look for yaourt, and add some useful functions if we have it.
4
+if [[ -x `which yaourt` ]]; then
5
+  upgrade () {
6
+    yaourt -Syu
7
+  }
8
+  alias yaconf='yaourt -C'        # Fix all configuration files with vimdiff
9
+  # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
10
+  alias yaupg='yaourt -Syu'        # Synchronize with repositories before upgrading packages that are out of date on the local system.
11
+  alias yain='yaourt -S'           # Install specific package(s) from the repositories
12
+  alias yains='yaourt -U'          # Install specific package not from the repositories but from a file 
13
+  alias yare='yaourt -R'           # Remove the specified package(s), retaining its configuration(s) and required dependencies
14
+  alias yarem='yaourt -Rns'        # Remove the specified package(s), its configuration(s) and unneeded dependencies
15
+  alias yarep='yaourt -Si'         # Display information about a given package in the repositories
16
+  alias yareps='yaourt -Ss'        # Search for package(s) in the repositories
17
+  alias yaloc='yaourt -Qi'         # Display information about a given package in the local database
18
+  alias yalocs='yaourt -Qs'        # Search for package(s) in the local database
19
+  # Additional yaourt alias examples
20
+  if [[ -x `which abs` ]]; then
21
+    alias yaupd='yaourt -Sy && sudo abs'   # Update and refresh the local package and ABS databases against repositories
22
+  else
23
+    alias yaupd='yaourt -Sy'               # Update and refresh the local package and ABS databases against repositories
24
+  fi
25
+  alias yainsd='yaourt -S --asdeps'        # Install given package(s) as dependencies of another package
26
+  alias yamir='yaourt -Syy'                # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
27
+else
28
+ upgrade() {
29
+   sudo pacman -Syu
30
+ }
31
+fi
32
+
33
+# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
34
+alias pacupg='sudo pacman -Syu'        # Synchronize with repositories before upgrading packages that are out of date on the local system.
35
+alias pacin='sudo pacman -S'           # Install specific package(s) from the repositories
36
+alias pacins='sudo pacman -U'          # Install specific package not from the repositories but from a file 
37
+alias pacre='sudo pacman -R'           # Remove the specified package(s), retaining its configuration(s) and required dependencies
38
+alias pacrem='sudo pacman -Rns'        # Remove the specified package(s), its configuration(s) and unneeded dependencies
39
+alias pacrep='pacman -Si'              # Display information about a given package in the repositories
40
+alias pacreps='pacman -Ss'             # Search for package(s) in the repositories
41
+alias pacloc='pacman -Qi'              # Display information about a given package in the local database
42
+alias paclocs='pacman -Qs'             # Search for package(s) in the local database
43
+# Additional pacman alias examples
44
+if [[ -x `which abs` ]]; then
45
+  alias pacupd='sudo pacman -Sy && sudo abs'     # Update and refresh the local package and ABS databases against repositories
46
+else
47
+  alias pacupd='sudo pacman -Sy'     # Update and refresh the local package and ABS databases against repositories
48
+fi
49
+alias pacinsd='sudo pacman -S --asdeps'        # Install given package(s) as dependencies of another package
50
+alias pacmir='sudo pacman -Syy'                # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
51
+
52
+# https://bbs.archlinux.org/viewtopic.php?id=93683
53
+paclist() {
54
+  sudo pacman -Qei $(pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}'
55
+}
56
+
57
+alias paclsorphans='sudo pacman -Qdt'
58
+alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
59
+
60
+pacdisowned() {
61
+  tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
62
+  db=$tmp/db
63
+  fs=$tmp/fs
64
+
65
+  mkdir "$tmp"
66
+  trap  'rm -rf "$tmp"' EXIT
67
+
68
+  pacman -Qlq | sort -u > "$db"
69
+
70
+  find /bin /etc /lib /sbin /usr \
71
+      ! -name lost+found \
72
+        \( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
73
+
74
+  comm -23 "$fs" "$db"
75
+}
0 76
new file mode 100644
... ...
@@ -0,0 +1,3 @@
0
+if [ -f `brew --prefix`/etc/autojump ]; then
1
+  . `brew --prefix`/etc/autojump
2
+fi
... ...
@@ -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'
... ...
@@ -1,3 +1,37 @@
1 1
 alias be="bundle exec"
2 2
 alias bi="bundle install"
3
+alias bl="bundle list"
3 4
 alias bu="bundle update"
5
+alias bp="bundle package"
6
+
7
+# The following is based on https://github.com/gma/bundler-exec
8
+
9
+bundled_commands=(cap capify cucumber guard heroku rackup rails rake rspec ruby shotgun spec spork thin unicorn unicorn_rails)
10
+
11
+## Functions
12
+
13
+_bundler-installed() {
14
+  which bundle > /dev/null 2>&1
15
+}
16
+
17
+_within-bundled-project() {
18
+  local check_dir=$PWD
19
+  while [ "$(dirname $check_dir)" != "/" ]; do
20
+    [ -f "$check_dir/Gemfile" ] && return
21
+    check_dir="$(dirname $check_dir)"
22
+  done
23
+  false
24
+}
25
+
26
+_run-with-bundler() {
27
+  if _bundler-installed && _within-bundled-project; then
28
+    bundle exec $@
29
+  else
30
+    $@
31
+  fi
32
+}
33
+
34
+## Main program
35
+for cmd in $bundled_commands; do
36
+  alias $cmd="_run-with-bundler $cmd"
37
+done
4 38
new file mode 100644
... ...
@@ -0,0 +1,32 @@
0
+# Set this to 1 if you want to cache the tasks
1
+cache_task_list=1
2
+
3
+# Cache filename
4
+cache_file='.cake_task_cache'
5
+
6
+_cake_does_target_list_need_generating () {
7
+
8
+	if [ $cache_task_list -eq 0 ]; then
9
+		return 1;
10
+	fi
11
+
12
+	if [ ! -f $cache_file ]; then return 0;
13
+	else
14
+		accurate=$(stat -f%m $cache_file)
15
+		changed=$(stat -f%m Cakefile)
16
+		return $(expr $accurate '>=' $changed)
17
+	fi
18
+}
19
+
20
+_cake () {
21
+	if [ -f Cakefile ]; then
22
+		if _cake_does_target_list_need_generating; then
23
+			cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$' > $cache_file
24
+			compadd `cat $cache_file`
25
+		else
26
+			compadd `cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$'`
27
+		fi
28
+	fi
29
+}
30
+
31
+compdef _cake cake
... ...
@@ -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
23 23
new file mode 100644
... ...
@@ -0,0 +1,2 @@
0
+#!/bin/zsh
1
+alias cloudapp=$ZSH/plugins/cloudapp/cloudapp.rb
0 2
new file mode 100755
... ...
@@ -0,0 +1,60 @@
0
+#!/usr/bin/env ruby
1
+#
2
+# cloudapp
3
+# Zach Holman / @holman
4
+#
5
+# Uploads a file from the command line to CloudApp, drops it into your 
6
+# clipboard (on a Mac, at least).
7
+#
8
+# Example:
9
+#
10
+#   cloudapp drunk-blake.png
11
+#
12
+# This requires Aaron Russell's cloudapp_api gem:
13
+#
14
+#   gem install cloudapp_api
15
+#
16
+# Requires you set your CloudApp credentials in ~/.cloudapp as a simple file of:
17
+#
18
+#   email
19
+#   password
20
+
21
+require 'rubygems'
22
+begin
23
+  require 'cloudapp_api'
24
+rescue LoadError
25
+  puts "You need to install cloudapp_api: gem install cloudapp_api"
26
+  exit!(1)
27
+end
28
+
29
+config_file = "#{ENV['HOME']}/.cloudapp"
30
+unless File.exist?(config_file)
31
+  puts "You need to type your email and password (one per line) into "+
32
+       "`~/.cloudapp`"
33
+  exit!(1)
34
+end
35
+
36
+email,password = File.read(config_file).split("\n")
37
+
38
+class HTTParty::Response
39
+  # Apparently HTTPOK.ok? IS NOT OKAY WTFFFFFFFFFFUUUUUUUUUUUUUU
40
+  # LETS MONKEY PATCH IT I FEEL OKAY ABOUT IT
41
+  def ok? ; true end
42
+end
43
+
44
+if ARGV[0].nil?
45
+   puts "You need to specify a file to upload."
46
+   exit!(1)
47
+end
48
+
49
+CloudApp.authenticate(email,password)
50
+url = CloudApp::Item.create(:upload, {:file => ARGV[0]}).url
51
+
52
+# Say it for good measure.
53
+puts "Uploaded to #{url}."
54
+
55
+# Get the embed link.
56
+url = "#{url}/#{ARGV[0].split('/').last}"
57
+
58
+# Copy it to your (Mac's) clipboard.
59
+`echo '#{url}' | tr -d "\n" | pbcopy`
0 60
new file mode 100644
... ...
@@ -0,0 +1,20 @@
0
+# ------------------------------------------------------------------------------
1
+#          FILE:  compleat.plugin.zsh
2
+#   DESCRIPTION:  oh-my-zsh plugin file.
3
+#        AUTHOR:  Sorin Ionescu (sorin.ionescu@gmail.com)
4
+#       VERSION:  1.0.0
5
+# ------------------------------------------------------------------------------
6
+
7
+if (( ${+commands[compleat]} )); then
8
+  local prefix="${commands[compleat]:h:h}"
9
+  local setup="${prefix}/share/compleat-1.0/compleat_setup" 
10
+
11
+  if [[ -f "$setup" ]]; then
12
+    if ! bashcompinit >/dev/null 2>&1; then
13
+      autoload -U bashcompinit
14
+      bashcompinit -i
15
+    fi
16
+
17
+    source "$setup" 
18
+  fi
19
+fi
0 20
new file mode 100644
... ...
@@ -0,0 +1,222 @@
0
+#compdef manage.py
1
+
2
+typeset -ga nul_args
3
+nul_args=(
4
+  '--settings=-[the Python path to a settings module.]:file:_files'
5
+  '--pythonpath=-[a directory to add to the Python path.]::directory:_directories'
6
+  '--traceback[print traceback on exception.]'
7
+  "--version[show program's version number and exit.]"
8
+  {-h,--help}'[show this help message and exit.]'
9
+)
10
+
11
+_managepy-adminindex(){
12
+  _arguments -s : \
13
+    $nul_args \
14
+    '*::directory:_directories' && ret=0
15
+}
16
+
17
+_managepy-createcachetable(){
18
+  _arguments -s : \
19
+    $nul_args && ret=0
20
+}
21
+
22
+_managepy-dbshell(){
23
+  _arguments -s : \
24
+    $nul_args && ret=0
25
+}
26
+
27
+_managepy-diffsettings(){
28
+  _arguments -s : \
29
+    $nul_args && ret=0
30
+}
31
+
32
+_managepy-dumpdata(){
33
+  _arguments -s : \
34
+    '--format=-[specifies the output serialization format for fixtures.]:format:(json yaml xml)' \
35
+    '--indent=-[specifies the indent level to use when pretty-printing output.]:' \
36
+    $nul_args \
37
+    '*::appname:_applist' && ret=0
38
+}
39
+
40
+_managepy-flush(){
41
+  _arguments -s : \
42
+    '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
43
+    '--noinput[tells Django to NOT prompt the user for input of any kind.]' \
44
+    $nul_args && ret=0
45
+}
46
+
47
+_managepy-help(){
48
+  _arguments -s : \
49
+    '*:command:_managepy_cmds' \
50
+    $nul_args && ret=0
51
+}
52
+
53
+_managepy_cmds(){
54
+    local line
55
+    local -a cmd
56
+    _call_program help-command ./manage.py help \
57
+      |& sed -n '/^ /s/[(), ]/ /gp' \
58
+      | while read -A line; do cmd=($line $cmd) done
59
+    _describe -t managepy-command 'manage.py command' cmd
60
+}
61
+
62
+_managepy-inspectdb(){
63
+  _arguments -s : \
64
+    $nul_args && ret=0
65
+}
66
+
67
+_managepy-loaddata(){
68
+  _arguments -s : \
69
+    '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
70
+    '*::file:_files' \
71
+    $nul_args && ret=0
72
+}
73
+
74
+_managepy-reset(){
75
+  _arguments -s : \
76
+    '--noinput[tells Django to NOT prompt the user for input of any kind.]' \
77
+    '*::appname:_applist' \
78
+    $nul_args && ret=0
79
+}
80
+
81
+_managepy-runfcgi(){
82
+  local state
83
+  
84
+  local fcgi_opts
85
+  fcgi_opts=(
86
+    'protocol[fcgi, scgi, ajp, ... (default fcgi)]:protocol:(fcgi scgi ajp)'
87
+    'host[hostname to listen on..]:'
88
+    'port[port to listen on.]:'
89
+    'socket[UNIX socket to listen on.]::file:_files'
90
+    'method[prefork or threaded (default prefork)]:method:(prefork threaded)'
91
+    'maxrequests[number of requests a child handles before it is killed and a new child is forked (0 = no limit).]:'
92
+    'maxspare[max number of spare processes / threads.]:'
93
+    'minspare[min number of spare processes / threads.]:'
94
+    'maxchildren[hard limit number of processes / threads.]:'
95
+    'daemonize[whether to detach from terminal.]:boolean:(False True)'
96
+    'pidfile[write the spawned process-id to this file.]:file:_files'
97
+    'workdir[change to this directory when daemonizing.]:directory:_files'
98
+    'outlog[write stdout to this file.]:file:_files'
99
+    'errlog[write stderr to this file.]:file:_files'
100
+  )
101
+  
102
+  _arguments -s : \
103
+    $nul_args \
104
+    '*: :_values "FCGI Setting" $fcgi_opts' && ret=0
105
+}
106
+
107
+_managepy-runserver(){
108
+  _arguments -s : \
109
+    '--noreload[tells Django to NOT use the auto-reloader.]' \
110
+    '--adminmedia[specifies the directory from which to serve admin media.]:directory:_files' \
111
+    $nul_args && ret=0
112
+}
113
+
114
+_managepy-shell(){
115
+  _arguments -s : \
116
+    '--plain[tells Django to use plain Python, not IPython.]' \
117
+    $nul_args && ret=0
118
+}
119
+
120
+_managepy-sql(){}
121
+_managepy-sqlall(){}
122
+_managepy-sqlclear(){}
123
+_managepy-sqlcustom(){}
124
+_managepy-sqlflush(){}
125
+_managepy-sqlindexes(){}
126
+_managepy-sqlinitialdata(){}
127
+_managepy-sqlreset(){}
128
+_managepy-sqlsequencereset(){}
129
+_managepy-startapp(){}
130
+
131
+_managepy-syncdb() {
132
+  _arguments -s : \
133
+    '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
134
+    '--noinput[tells Django to NOT prompt the user for input of any kind.]' \
135
+    $nul_args && ret=0
136
+}
137
+
138
+_managepy-test() {
139
+  _arguments -s : \
140
+    '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
141
+    '--noinput[tells Django to NOT prompt the user for input of any kind.]' \
142
+    '*::appname:_applist' \
143
+    $nul_args && ret=0
144
+}
145
+
146
+_managepy-testserver() {
147
+  _arguments -s : \
148
+    '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
149
+    '--addrport=-[port number or ipaddr:port to run the server on.]' \
150
+    '*::fixture:_files' \
151
+    $nul_args && ret=0
152
+}
153
+
154
+_managepy-validate() {
155
+  _arguments -s : \
156
+    $nul_args && ret=0
157
+}
158
+
159
+_managepy-commands() {
160
+  local -a commands
161
+  
162
+  commands=(
163
+    'adminindex:prints the admin-index template snippet for the given app name(s).'
164
+    'createcachetable:creates the table needed to use the SQL cache backend.'
165
+    'dbshell:runs the command-line client for the current DATABASE_ENGINE.'
166
+    "diffsettings:displays differences between the current settings.py and Django's default settings."
167
+    'dumpdata:Output the contents of the database as a fixture of the given format.'
168
+    'flush:Executes ``sqlflush`` on the current database.'
169
+    'help:manage.py help.'
170
+    'inspectdb:Introspects the database tables in the given database and outputs a Django model module.'
171
+    'loaddata:Installs the named fixture(s) in the database.'
172
+    'reset:Executes ``sqlreset`` for the given app(s) in the current database.'
173
+    'runfcgi:Run this project as a fastcgi (or some other protocol supported by flup) application,'
174
+    'runserver:Starts a lightweight Web server for development.'
175
+    'shell:Runs a Python interactive interpreter.'
176
+    'sql:Prints the CREATE TABLE SQL statements for the given app name(s).'
177
+    'sqlall:Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s).'
178
+    'sqlclear:Prints the DROP TABLE SQL statements for the given app name(s).'
179
+    'sqlcustom:Prints the custom table modifying SQL statements for the given app name(s).'
180
+    'sqlflush:Returns a list of the SQL statements required to return all tables in the database to the state they were in just after they were installed.'
181
+    'sqlindexes:Prints the CREATE INDEX SQL statements for the given model module name(s).'
182
+    "sqlinitialdata:RENAMED: see 'sqlcustom'"
183
+    'sqlreset:Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s).'
184
+    'sqlsequencereset:Prints the SQL statements for resetting sequences for the given app name(s).'
185
+    "startapp:Creates a Django app directory structure for the given app name in this project's directory."
186
+    "syncdb:Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created."
187
+    'test:Runs the test suite for the specified applications, or the entire site if no apps are specified.'
188
+    'testserver:Runs a development server with data from the given fixture(s).'
189
+    'validate:Validates all installed models.'
190
+  )
191
+  
192
+  _describe -t commands 'manage.py command' commands && ret=0
193
+}
194
+
195
+_applist() {
196
+  local line
197
+  local -a apps
198
+  _call_program help-command "python -c \"import os.path as op, re, django.conf, sys;\\
199
+                                          bn=op.basename(op.abspath(op.curdir));[sys\\
200
+                                          .stdout.write(str(re.sub(r'^%s\.(.*?)$' %
201
+                                          bn, r'\1', i)) + '\n') for i in django.conf.settings.\\
202
+                                          INSTALLED_APPS if re.match(r'^%s' % bn, i)]\"" \
203
+                             | while read -A line; do apps=($line $apps) done
204
+  _values 'Application' $apps && ret=0
205
+}
206
+
207
+_managepy() {
208
+  local curcontext=$curcontext ret=1
209
+  
210
+  if ((CURRENT == 2)); then
211
+    _managepy-commands
212
+  else
213
+    shift words
214
+    (( CURRENT -- ))
215
+    curcontext="${curcontext%:*:*}:managepy-$words[1]:"
216
+    _call_function ret _managepy-$words[1]
217
+  fi
218
+}
219
+
220
+compdef _managepy manage.py
221
+compdef _managepy django
0 222
new file mode 100644
... ...
@@ -0,0 +1,8 @@
0
+#compdef extract
1
+#autoload
2
+
3
+_arguments \
4
+  '(-r --remove)'{-r,--remove}'[Remove archive.]' \
5
+  "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z|deb)(-.)'" && return 0
6
+
7
+
0 8
new file mode 100644
... ...
@@ -0,0 +1,85 @@
0
+# ------------------------------------------------------------------------------
1
+#          FILE:  extract.plugin.zsh
2
+#   DESCRIPTION:  oh-my-zsh plugin file.
3
+#        AUTHOR:  Sorin Ionescu (sorin.ionescu@gmail.com)
4
+#       VERSION:  1.0.1
5
+# ------------------------------------------------------------------------------
6
+
7
+
8
+function extract() {
9
+  local remove_archive
10
+  local success
11
+  local file_name
12
+  local extract_dir
13
+
14
+  if (( $# == 0 )); then
15
+    echo "Usage: extract [-option] [file ...]"
16
+    echo
17
+    echo Options:
18
+    echo "    -r, --remove    Remove archive."
19
+    echo
20
+    echo "Report bugs to <sorin.ionescu@gmail.com>."
21
+  fi
22
+
23
+  remove_archive=1
24
+  if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then
25
+    remove_archive=0 
26
+    shift
27
+  fi
28
+
29
+  while (( $# > 0 )); do
30
+    if [[ ! -f "$1" ]]; then
31
+      echo "extract: '$1' is not a valid file" 1>&2
32
+      shift
33
+      continue
34
+    fi
35
+
36
+    success=0
37
+    file_name="$( basename "$1" )"
38
+    extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )"
39
+    case "$1" in
40
+      (*.tar.gz|*.tgz) tar xvzf "$1" ;;
41
+      (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
42
+      (*.tar.xz|*.txz) tar --xz --help &> /dev/null \
43
+        && tar --xz -xvf "$1" \
44
+        || xzcat "$1" | tar xvf - ;;
45
+      (*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \
46
+        && tar --lzma -xvf "$1" \
47
+        || lzcat "$1" | tar xvf - ;;
48
+      (*.tar) tar xvf "$1" ;;
49
+      (*.gz) gunzip "$1" ;;
50
+      (*.bz2) bunzip2 "$1" ;;
51
+      (*.xz) unxz "$1" ;;
52
+      (*.lzma) unlzma "$1" ;;
53
+      (*.Z) uncompress "$1" ;;
54
+      (*.zip) unzip "$1" -d $extract_dir ;;
55
+      (*.rar) unrar e -ad "$1" ;;
56
+      (*.7z) 7za x "$1" ;;
57
+      (*.deb)
58
+        mkdir -p "$extract_dir/control"
59
+        mkdir -p "$extract_dir/data"
60
+        cd "$extract_dir"; ar vx "../${1}" > /dev/null
61
+        cd control; tar xzvf ../control.tar.gz
62
+        cd ../data; tar xzvf ../data.tar.gz
63
+        cd ..; rm *.tar.gz debian-binary
64
+        cd ..
65
+      ;;
66
+      (*) 
67
+        echo "extract: '$1' cannot be extracted" 1>&2
68
+        success=1 
69
+      ;; 
70
+    esac
71
+
72
+    (( success = $success > 0 ? $success : $? ))
73
+    (( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
74
+    shift
75
+  done
76
+}
77
+
78
+alias x=extract
79
+
80
+# add extract completion function to path
81
+fpath=($ZSH/plugins/extract $fpath)
82
+autoload -U compinit
83
+compinit -i
84
+
0 85
new file mode 100644
... ...
@@ -0,0 +1,34 @@
0
+#compdef gas
1
+
2
+local curcontext="$curcontext" state line cmds ret=1
3
+
4
+_arguments -C \
5
+	'(- 1 *)'{-v,--version}'[display version information]' \
6
+	'(-h|--help)'{-h,--help}'[show help information]' \
7
+	'1: :->cmds' \
8
+	'*: :->args' && ret=0
9
+
10
+case $state in
11
+	cmds)
12
+		cmds=(
13
+            "version:Prints Gas's version"
14
+            "use:Uses author"
15
+            "show:Shows your current user"
16
+            "list:Lists your authors"
17
+            "import:Imports current user to gasconfig"
18
+            "help:Describe available tasks or one specific task"
19
+            "delete:Deletes author"
20
+            "add:Adds author to gasconfig"
21
+        )
22
+		_describe -t commands 'gas command' cmds && ret=0
23
+		;;
24
+	args)
25
+		case $line[1] in
26
+			(use|delete)
27
+				_values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0
28
+				;;
29
+		esac
30
+		;;
31
+esac
32
+
33
+return ret
... ...
@@ -27,11 +27,19 @@ alias gcp='git cherry-pick'
27 27
 compdef _git gcp=git-cherry-pick
28 28
 alias glg='git log --stat --max-count=5'
29 29
 compdef _git glg=git-log
30
+alias glgg='git log --graph --max-count=5'
31
+compdef _git glgg=git-log
32
+alias gss='git status -s'
33
+compdef _git gss=git-status
34
+alias ga='git add'
35
+compdef _git ga=git-add
30 36
 
31 37
 # Git and svn mix
32 38
 alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
33 39
 compdef git-svn-dcommit-push=git
34 40
 
41
+alias gsr='git svn rebase'
42
+alias gsd='git svn dcommit'
35 43
 #
36 44
 # Will return the current branch name
37 45
 # Usage example: git pull origin $(current_branch)
... ...
@@ -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,26 @@
0
+# Based on ssh-agent code
1
+
2
+local GPG_ENV=$HOME/.gnupg/gpg-agent.env
3
+
4
+function start_agent {
5
+  /usr/bin/env gpg-agent --daemon --enable-ssh-support --write-env-file ${GPG_ENV} > /dev/null
6
+  chmod 600 ${GPG_ENV}
7
+  . ${GPG_ENV} > /dev/null
8
+}
9
+
10
+# Source GPG agent settings, if applicable
11
+if [ -f "${GPG_ENV}" ]; then
12
+  . ${GPG_ENV} > /dev/null
13
+  ps -ef | grep ${SSH_AGENT_PID} | grep gpg-agent > /dev/null || {
14
+    start_agent;
15
+  }
16
+else
17
+  start_agent;
18
+fi
19
+
20
+export GPG_AGENT_INFO
21
+export SSH_AUTH_SOCK
22
+export SSH_AGENT_PID
23
+
24
+GPG_TTY=$(tty)
25
+export GPG_TTY
0 26
new file mode 100644
... ...
@@ -0,0 +1,158 @@
0
+#compdef heroku
1
+
2
+# Heroku Autocomplete plugin for Oh-My-Zsh
3
+# Requires: The Heroku client gem (https://github.com/heroku/heroku)
4
+# Author: Ali B. (http://awhitebox.com)
5
+
6
+local -a _1st_arguments
7
+_1st_arguments=(
8
+  "account\:confirm_billing":"Confirm that your account can be billed at the end of the month"
9
+  "addons":"list installed addons"
10
+  "addons\:list":"list all available addons"
11
+  "addons\:add":"install an addon"
12
+  "addons\:upgrade":"upgrade an existing addon"
13
+  "addons\:downgrade":"downgrade an existing addon"
14
+  "addons\:remove":"uninstall an addon"
15
+  "addons\:open":"open an addon's dashboard in your browser"
16
+  "apps":"list your apps"
17
+  "apps\:info":"show detailed app information"
18
+  "apps\:create":"create a new app"
19
+  "apps\:rename":"rename the app"
20
+  "apps\:open":"open the app in a web browser"
21
+  "apps\:destroy":"permanently destroy an app"
22
+  "auth\:login":"log in with your heroku credentials"
23
+  "auth\:logout":"clear local authentication credentials"
24
+  "config":"display the config vars for an app"
25
+  "config\:add":"add one or more config vars"
26
+  "config\:remove":"remove a config var"
27
+  "db\:push":"push local data up to your app"
28
+  "db\:pull":"pull heroku data down into your local database"
29
+  "domains":"list custom domains for an app"
30
+  "domains\:add":"add a custom domain to an app"
31
+  "domains\:remove":"remove a custom domain from an app"
32
+  "domains\:clear":"remove all custom domains from an app"
33
+  "help":"list available commands or display help for a specific command"
34
+  "keys":"display keys for the current user"
35
+  "keys\:add":"add a key for the current user"
36
+  "keys\:remove":"remove a key from the current user"
37
+  "keys\:clear":"remove all authentication keys from the current user"
38
+  "logs":"display recent log output"
39
+  "logs\:cron":"DEPRECATED: display cron logs from legacy logging"
40
+  "logs\:drains":"manage syslog drains"
41
+  "maintenance\:on":"put the app into maintenance mode"
42
+  "maintenance\:off":"take the app out of maintenance mode"
43
+  "pg\:info":"display database information"
44
+  "pg\:ingress":"allow direct connections to the database from this IP for one minute"
45
+  "pg\:promote":"sets DATABASE as your DATABASE_URL"
46
+  "pg\:psql":"open a psql shell to the database"
47
+  "pg\:reset":"delete all data in DATABASE"
48
+  "pg\:unfollow":"stop a replica from following and make it a read/write database"
49
+  "pg\:wait":"monitor database creation, exit when complete"
50
+  "pgbackups":"list captured backups"
51
+  "pgbackups\:url":"get a temporary URL for a backup"
52
+  "pgbackups\:capture":"capture a backup from a database id"
53
+  "pgbackups\:restore":"restore a backup to a database"
54
+  "pgbackups\:destroy":"destroys a backup"
55
+  "plugins":"list installed plugins"
56
+  "plugins\:install":"install a plugin"
57
+  "plugins\:uninstall":"uninstall a plugin"
58
+  "ps\:dynos":"scale to QTY web processes"
59
+  "ps\:workers":"scale to QTY background processes"
60
+  "ps":"list processes for an app"
61
+  "ps\:restart":"restart an app process"
62
+  "ps\:scale":"scale processes by the given amount"
63
+  "releases":"list releases"
64
+  "releases\:info":"view detailed information for a release"
65
+  "rollback":"roll back to an older release"
66
+  "run":"run an attached process"
67
+  "run\:rake":"remotely execute a rake command"
68
+  "run\:console":"open a remote console session"
69
+  "sharing":"list collaborators on an app"
70
+  "sharing\:add":"add a collaborator to an app"
71
+  "sharing\:remove":"remove a collaborator from an app"
72
+  "sharing\:transfer":"transfer an app to a new owner"
73
+  "ssl":"list certificates for an app"
74
+  "ssl\:add":"add an ssl certificate to an app"
75
+  "ssl\:remove":"remove an ssl certificate from an app"
76
+  "ssl\:clear":"remove all ssl certificates from an app"
77
+  "stack":"show the list of available stacks"
78
+  "stack\:migrate":"prepare migration of this app to a new stack"
79
+  "version":"show heroku client version"
80
+)
81
+
82
+_arguments '*:: :->command'
83
+
84
+if (( CURRENT == 1 )); then
85
+  _describe -t commands "heroku command" _1st_arguments
86
+  return
87
+fi
88
+
89
+local -a _command_args
90
+case "$words[1]" in
91
+  apps:info)
92
+    _command_args=(
93
+      '(-r|--raw)'{-r,--raw}'[output info as raw key/value pairs]' \
94
+    )
95
+    ;;
96
+  apps:create)
97
+    _command_args=(
98
+      '(-a|--addons)'{-a,--addons}'[a list of addons to install]' \
99
+      '(-r|--remote)'{-r,--remote}'[the git remote to create, default "heroku"]' \
100
+      '(-s|--stack)'{-s,--stack}'[the stack on which to create the app]' \
101
+    )
102
+    ;;
103
+  config)
104
+    _command_args=(
105
+      '(-s|--shell)'{-s,--shell}'[output config vars in shell format]' \
106
+    )
107
+    ;;
108
+  db:push)
109
+    _command_args=(
110
+      '(-c|--chunksize)'{-c,--chunksize}'[specify the number of rows to send in each batch]' \
111
+      '(-d|--debug)'{-d,--debug}'[enable debugging output]' \
112
+      '(-e|--exclude)'{-e,--exclude}'[exclude the specified tables from the push]' \
113
+      '(-f|--filter)'{-f,--filter}'[only push certain tables]' \
114
+      '(-r|--resume)'{-r,--resume}'[resume transfer described by a .dat file]' \
115
+      '(-t|--tables)'{-t,--tables}'[only push the specified tables]' \
116
+    )
117
+    ;;
118
+  db:pull)
119
+    _command_args=(
120
+      '(-c|--chunksize)'{-c,--chunksize}'[specify the number of rows to send in each batch]' \
121
+      '(-d|--debug)'{-d,--debug}'[enable debugging output]' \
122
+      '(-e|--exclude)'{-e,--exclude}'[exclude the specified tables from the pull]' \
123
+      '(-f|--filter)'{-f,--filter}'[only pull certain tables]' \
124
+      '(-r|--resume)'{-r,--resume}'[resume transfer described by a .dat file]' \
125
+      '(-t|--tables)'{-t,--tables}'[only pull the specified tables]' \
126
+    )
127
+    ;;
128
+  keys)
129
+    _command_args=(
130
+      '(-l|--long)'{-l,--long}'[display extended information for each key]' \
131
+    )
132
+    ;;
133
+  logs)
134
+    _command_args=(
135
+      '(-n|--num)'{-n,--num}'[the number of lines to display]' \
136
+      '(-p|--ps)'{-p,--ps}'[only display logs from the given process]' \
137
+      '(-s|--source)'{-s,--source}'[only display logs from the given source]' \
138
+      '(-t|--tail)'{-t,--tail}'[continually stream logs]' \
139
+    )
140
+    ;;
141
+  pgbackups:capture)
142
+    _command_args=(
143
+      '(-e|--expire)'{-e,--expire}'[if no slots are available to capture, delete the oldest backup to make room]' \
144
+    )
145
+    ;;
146
+  stack)
147
+    _command_args=(
148
+      '(-a|--all)'{-a,--all}'[include deprecated stacks]' \
149
+    )
150
+    ;;
151
+  esac
152
+
153
+_arguments \
154
+  $_command_args \
155
+  '(--app)--app[the app name]' \
156
+  &&  return 0
157
+
0 158
new file mode 100644
... ...
@@ -0,0 +1,7 @@
0
+To activate this script, load it into an interactive ZSH session:
1
+
2
+  % source history-substring-search.zsh
3
+
4
+See the "history-substring-search.zsh" file for more information:
5
+
6
+  % sed -n '2,/^$/s/^#//p' history-substring-search.zsh | more
0 7
new file mode 100644
... ...
@@ -0,0 +1,12 @@
0
+# This file integrates the history-substring-search script into oh-my-zsh.
1
+
2
+source "$ZSH/plugins/history-substring-search/history-substring-search.zsh"
3
+
4
+if test "$CASE_SENSITIVE" = true; then
5
+  unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS
6
+fi
7
+
8
+if test "$DISABLE_COLOR" = true; then
9
+  unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
10
+  unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
11
+fi
0 12
new file mode 100644
... ...
@@ -0,0 +1,642 @@
0
+#!/usr/bin/env zsh
1
+#
2
+# This is a clean-room implementation of the Fish[1] shell's history search
3
+# feature, where you can type in any part of any previously entered command
4
+# and press the UP and DOWN arrow keys to cycle through the matching commands.
5
+#
6
+#-----------------------------------------------------------------------------
7
+# Usage
8
+#-----------------------------------------------------------------------------
9
+#
10
+# 1. Load this script into your interactive ZSH session:
11
+#
12
+#       % source history-substring-search.zsh
13
+#
14
+#    If you want to use the zsh-syntax-highlighting[6] script along with this
15
+#    script, then make sure that you load it *before* you load this script:
16
+#
17
+#       % source zsh-syntax-highlighting.zsh
18
+#       % source history-substring-search.zsh
19
+#
20
+# 2. Type any part of any previous command and then:
21
+#
22
+#     * Press the UP arrow key to select the nearest command that (1) contains
23
+#       your query and (2) is older than the current command in the command
24
+#       history.
25
+#
26
+#     * Press the DOWN arrow key to select the nearest command that (1)
27
+#       contains your query and (2) is newer than the current command in the
28
+#       command history.
29
+#
30
+#     * Press ^U (the Control and U keys simultaneously) to abort the search.
31
+#
32
+# 3. If a matching command spans more than one line of text, press the LEFT
33
+#    arrow key to move the cursor away from the end of the command, and then:
34
+#
35
+#     * Press the UP arrow key to move the cursor to the line above.  When the
36
+#       cursor reaches the first line of the command, pressing the UP arrow
37
+#       key again will cause this script to perform another search.
38
+#
39
+#     * Press the DOWN arrow key to move the cursor to the line below.  When
40
+#       the cursor reaches the last line of the command, pressing the DOWN
41
+#       arrow key again will cause this script to perform another search.
42
+#
43
+#-----------------------------------------------------------------------------
44
+# Configuration
45
+#-----------------------------------------------------------------------------
46
+#
47
+# This script defines the following global variables. You may override their
48
+# default values only after having loaded this script into your ZSH session.
49
+#
50
+# * HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND is a global variable that defines
51
+#   how the query should be highlighted inside a matching command. Its default
52
+#   value causes this script to highlight using bold, white text on a magenta
53
+#   background. See the "Character Highlighting" section in the zshzle(1) man
54
+#   page to learn about the kinds of values you may assign to this variable.
55
+#
56
+# * HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND is a global variable that
57
+#   defines how the query should be highlighted when no commands in the
58
+#   history match it. Its default value causes this script to highlight using
59
+#   bold, white text on a red background. See the "Character Highlighting"
60
+#   section in the zshzle(1) man page to learn about the kinds of values you
61
+#   may assign to this variable.
62
+#
63
+# * HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS is a global variable that defines
64
+#   how the command history will be searched for your query. Its default value
65
+#   causes this script to perform a case-insensitive search. See the "Globbing
66
+#   Flags" section in the zshexpn(1) man page to learn about the kinds of
67
+#   values you may assign to this variable.
68
+#
69
+#-----------------------------------------------------------------------------
70
+# History
71
+#-----------------------------------------------------------------------------
72
+#
73
+# This script was originally written by Peter Stephenson[2], who published it
74
+# to the ZSH users mailing list (thereby making it public domain) in September
75
+# 2009. It was later revised by Guido van Steen and released under the BSD
76
+# license (see below) as part of the fizsh[3] project in January 2011.
77
+#
78
+# It was later extracted from fizsh[3] release 1.0.1, refactored heavily, and
79
+# repackaged as both an oh-my-zsh plugin[4] and as an independently loadable
80
+# ZSH script[5] by Suraj N. Kurapati in 2011.
81
+#
82
+# It was further developed[4] by Guido van Steen, Suraj N. Kurapati, Sorin
83
+# Ionescu, and Vincent Guerci in 2011.
84
+#
85
+# [1]: http://fishshell.com
86
+# [2]: http://www.zsh.org/mla/users/2009/msg00818.html
87
+# [3]: http://sourceforge.net/projects/fizsh/
88
+# [4]: https://github.com/robbyrussell/oh-my-zsh/pull/215
89
+# [5]: https://github.com/sunaku/zsh-history-substring-search
90
+# [6]: https://github.com/nicoulaj/zsh-syntax-highlighting
91
+#
92
+##############################################################################
93
+#
94
+# Copyright (c) 2009 Peter Stephenson
95
+# Copyright (c) 2011 Guido van Steen
96
+# Copyright (c) 2011 Suraj N. Kurapati
97
+# Copyright (c) 2011 Sorin Ionescu
98
+# Copyright (c) 2011 Vincent Guerci
99
+# All rights reserved.
100
+#
101
+# Redistribution and use in source and binary forms, with or without
102
+# modification, are permitted provided that the following conditions are met:
103
+#
104
+#  * Redistributions of source code must retain the above copyright
105
+#    notice, this list of conditions and the following disclaimer.
106
+#
107
+#  * Redistributions in binary form must reproduce the above
108
+#    copyright notice, this list of conditions and the following
109
+#    disclaimer in the documentation and/or other materials provided
110
+#    with the distribution.
111
+#
112
+#  * Neither the name of the FIZSH nor the names of its contributors
113
+#    may be used to endorse or promote products derived from this
114
+#    software without specific prior written permission.
115
+#
116
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
117
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
118
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
119
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
120
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
121
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
122
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
123
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
124
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
125
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
126
+# POSSIBILITY OF SUCH DAMAGE.
127
+#
128
+##############################################################################
129
+
130
+#-----------------------------------------------------------------------------
131
+# configuration variables
132
+#-----------------------------------------------------------------------------
133
+
134
+HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold'
135
+HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'
136
+HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'
137
+
138
+#-----------------------------------------------------------------------------
139
+# the main ZLE widgets
140
+#-----------------------------------------------------------------------------
141
+
142
+function history-substring-search-up() {
143
+  _history-substring-search-begin
144
+
145
+  _history-substring-search-up-history ||
146
+  _history-substring-search-up-buffer ||
147
+  _history-substring-search-up-search
148
+
149
+  _history-substring-search-end
150
+}
151
+
152
+function history-substring-search-down() {
153
+  _history-substring-search-begin
154
+
155
+  _history-substring-search-down-history ||
156
+  _history-substring-search-down-buffer ||
157
+  _history-substring-search-down-search
158
+
159
+  _history-substring-search-end
160
+}
161
+
162
+zle -N history-substring-search-up
163
+zle -N history-substring-search-down
164
+
165
+bindkey '\e[A' history-substring-search-up
166
+bindkey '\e[B' history-substring-search-down
167
+
168
+#-----------------------------------------------------------------------------
169
+# implementation details
170
+#-----------------------------------------------------------------------------
171
+
172
+setopt extendedglob
173
+zmodload -F zsh/parameter
174
+
175
+#
176
+# We have to "override" some keys and widgets if the
177
+# zsh-syntax-highlighting plugin has not been loaded:
178
+#
179
+# https://github.com/nicoulaj/zsh-syntax-highlighting
180
+#
181
+if [[ $+functions[_zsh_highlight] -eq 0 ]]; then
182
+  #
183
+  # Dummy implementation of _zsh_highlight()
184
+  # that simply removes existing highlights
185
+  #
186
+  function _zsh_highlight() {
187
+    region_highlight=()
188
+  }
189
+
190
+  #
191
+  # Remove existing highlights when the user
192
+  # inserts printable characters into $BUFFER
193
+  #
194
+  function ordinary-key-press() {
195
+    if [[ $KEYS == [[:print:]] ]]; then
196
+      region_highlight=()
197
+    fi
198
+    zle .self-insert
199
+  }
200
+  zle -N self-insert ordinary-key-press
201
+
202
+  #
203
+  # Override ZLE widgets to invoke _zsh_highlight()
204
+  #
205
+  # https://github.com/nicoulaj/zsh-syntax-highlighting/blob/
206
+  # bb7fcb79fad797a40077bebaf6f4e4a93c9d8163/zsh-syntax-highlighting.zsh#L121
207
+  #
208
+  #--------------8<-------------------8<-------------------8<-----------------
209
+  #
210
+  # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors
211
+  # All rights reserved.
212
+  #
213
+  # Redistribution and use in source and binary forms, with or without
214
+  # modification, are permitted provided that the following conditions are
215
+  # met:
216
+  #
217
+  #  * Redistributions of source code must retain the above copyright
218
+  #    notice, this list of conditions and the following disclaimer.
219
+  #
220
+  #  * Redistributions in binary form must reproduce the above copyright
221
+  #    notice, this list of conditions and the following disclaimer in the
222
+  #    documentation and/or other materials provided with the distribution.
223
+  #
224
+  #  * Neither the name of the zsh-syntax-highlighting contributors nor the
225
+  #    names of its contributors may be used to endorse or promote products
226
+  #    derived from this software without specific prior written permission.
227
+  #
228
+  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
229
+  # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
230
+  # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
231
+  # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
232
+  # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
233
+  # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
234
+  # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
235
+  # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
236
+  # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
237
+  # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
238
+  # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
239
+
240
+  # Load ZSH module zsh/zleparameter, needed to override user defined widgets.
241
+  zmodload zsh/zleparameter 2>/dev/null || {
242
+    echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter, exiting.' >&2
243
+    return -1
244
+  }
245
+
246
+  # Override ZLE widgets to make them invoke _zsh_highlight.
247
+  for event in ${${(f)"$(zle -la)"}:#(_*|orig-*|.run-help|.which-command)}; do
248
+    if [[ "$widgets[$event]" == completion:* ]]; then
249
+      eval "zle -C orig-$event ${${${widgets[$event]}#*:}/:/ } ; $event() { builtin zle orig-$event && _zsh_highlight } ; zle -N $event"
250
+    else
251
+      case $event in
252
+        accept-and-menu-complete)
253
+          eval "$event() { builtin zle .$event && _zsh_highlight } ; zle -N $event"
254
+          ;;
255
+
256
+        # The following widgets should NOT remove any previously
257
+        # applied highlighting. Therefore we do not remap them.
258
+        .forward-char|.backward-char|.up-line-or-history|.down-line-or-history)
259
+          ;;
260
+
261
+        .*)
262
+          clean_event=$event[2,${#event}] # Remove the leading dot in the event name
263
+          case ${widgets[$clean_event]-} in
264
+            (completion|user):*)
265
+              ;;
266
+            *)
267
+              eval "$clean_event() { builtin zle $event && _zsh_highlight } ; zle -N $clean_event"
268
+              ;;
269
+          esac
270
+          ;;
271
+        *)
272
+          ;;
273
+      esac
274
+    fi
275
+  done
276
+  unset event clean_event
277
+  #-------------->8------------------->8------------------->8-----------------
278
+fi
279
+
280
+function _history-substring-search-begin() {
281
+  _history_substring_search_move_cursor_eol=false
282
+  _history_substring_search_query_highlight=
283
+
284
+  #
285
+  # Continue using the previous $_history_substring_search_result by default,
286
+  # unless the current query was cleared or a new/different query was entered.
287
+  #
288
+  if [[ -z $BUFFER || $BUFFER != $_history_substring_search_result ]]; then
289
+    #
290
+    # For the purpose of highlighting we will also keep
291
+    # a version without doubly-escaped meta characters.
292
+    #
293
+    _history_substring_search_query=$BUFFER
294
+
295
+    #
296
+    # $BUFFER contains the text that is in the command-line currently.
297
+    # we put an extra "\\" before meta characters such as "\(" and "\)",
298
+    # so that they become "\\\(" and "\\\)".
299
+    #
300
+    _history_substring_search_query_escaped=${BUFFER//(#m)[\][()|\\*?#<>~^]/\\$MATCH}
301
+
302
+    #
303
+    # Find all occurrences of the search query in the history file.
304
+    #
305
+    # (k) turns it an array of line numbers.
306
+    #
307
+    # (on) seems to remove duplicates, which are default
308
+    #      options. They can be turned off by (ON).
309
+    #
310
+    _history_substring_search_matches=(${(kon)history[(R)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)*${_history_substring_search_query_escaped}*]})
311
+
312
+    #
313
+    # Define the range of values that $_history_substring_search_match_index
314
+    # can take: [0, $_history_substring_search_matches_count_plus].
315
+    #
316
+    _history_substring_search_matches_count=$#_history_substring_search_matches
317
+    _history_substring_search_matches_count_plus=$(( _history_substring_search_matches_count + 1 ))
318
+    _history_substring_search_matches_count_sans=$(( _history_substring_search_matches_count - 1 ))
319
+
320
+    #
321
+    # If $_history_substring_search_match_index is equal to
322
+    # $_history_substring_search_matches_count_plus, this indicates that we
323
+    # are beyond the beginning of $_history_substring_search_matches.
324
+    #
325
+    # If $_history_substring_search_match_index is equal to 0, this indicates
326
+    # that we are beyond the end of $_history_substring_search_matches.
327
+    #
328
+    # If we have initially pressed "up" we have to initialize
329
+    # $_history_substring_search_match_index to
330
+    # $_history_substring_search_matches_count_plus so that it will be
331
+    # decreased to $_history_substring_search_matches_count.
332
+    #
333
+    # If we have initially pressed "down" we have to initialize
334
+    # $_history_substring_search_match_index to
335
+    # $_history_substring_search_matches_count so that it will be increased to
336
+    # $_history_substring_search_matches_count_plus.
337
+    #
338
+    if [[ $WIDGET == history-substring-search-down ]]; then
339
+       _history_substring_search_match_index=$_history_substring_search_matches_count
340
+    else
341
+      _history_substring_search_match_index=$_history_substring_search_matches_count_plus
342
+    fi
343
+  fi
344
+}
345
+
346
+function _history-substring-search-end() {
347
+  _history_substring_search_result=$BUFFER
348
+
349
+  # move the cursor to the end of the command line
350
+  if [[ $_history_substring_search_move_cursor_eol == true ]]; then
351
+    CURSOR=${#BUFFER}
352
+  fi
353
+
354
+  # highlight command line using zsh-syntax-highlighting
355
+  _zsh_highlight
356
+
357
+  # highlight the search query inside the command line
358
+  if [[ -n $_history_substring_search_query_highlight && -n $_history_substring_search_query ]]; then
359
+    #
360
+    # The following expression yields a variable $MBEGIN, which
361
+    # indicates the begin position + 1 of the first occurrence
362
+    # of _history_substring_search_query_escaped in $BUFFER.
363
+    #
364
+    : ${(S)BUFFER##(#m$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)($_history_substring_search_query##)}
365
+    local begin=$(( MBEGIN - 1 ))
366
+    local end=$(( begin + $#_history_substring_search_query ))
367
+    region_highlight+=("$begin $end $_history_substring_search_query_highlight")
368
+  fi
369
+
370
+  # For debugging purposes:
371
+  # zle -R "mn: "$_history_substring_search_match_index" m#: "${#_history_substring_search_matches}
372
+  # read -k -t 200 && zle -U $REPLY
373
+
374
+  # Exit successfully from the history-substring-search-* widgets.
375
+  true
376
+}
377
+
378
+function _history-substring-search-up-buffer() {
379
+  #
380
+  # Check if the UP arrow was pressed to move the cursor within a multi-line
381
+  # buffer. This amounts to three tests:
382
+  #
383
+  # 1. $#buflines -gt 1.
384
+  #
385
+  # 2. $CURSOR -ne $#BUFFER.
386
+  #
387
+  # 3. Check if we are on the first line of the current multi-line buffer.
388
+  #    If so, pressing UP would amount to leaving the multi-line buffer.
389
+  #
390
+  #    We check this by adding an extra "x" to $LBUFFER, which makes
391
+  #    sure that xlbuflines is always equal to the number of lines
392
+  #    until $CURSOR (including the line with the cursor on it).
393
+  #
394
+  local buflines XLBUFFER xlbuflines
395
+  buflines=(${(f)BUFFER})
396
+  XLBUFFER=$LBUFFER"x"
397
+  xlbuflines=(${(f)XLBUFFER})
398
+
399
+  if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xlbuflines -ne 1 ]]; then
400
+    zle up-line-or-history
401
+    return true
402
+  fi
403
+
404
+  false
405
+}
406
+
407
+function _history-substring-search-down-buffer() {
408
+  #
409
+  # Check if the DOWN arrow was pressed to move the cursor within a multi-line
410
+  # buffer. This amounts to three tests:
411
+  #
412
+  # 1. $#buflines -gt 1.
413
+  #
414
+  # 2. $CURSOR -ne $#BUFFER.
415
+  #
416
+  # 3. Check if we are on the last line of the current multi-line buffer.
417
+  #    If so, pressing DOWN would amount to leaving the multi-line buffer.
418
+  #
419
+  #    We check this by adding an extra "x" to $RBUFFER, which makes
420
+  #    sure that xrbuflines is always equal to the number of lines
421
+  #    from $CURSOR (including the line with the cursor on it).
422
+  #
423
+  local buflines XRBUFFER xrbuflines
424
+  buflines=(${(f)BUFFER})
425
+  XRBUFFER="x"$RBUFFER
426
+  xrbuflines=(${(f)XRBUFFER})
427
+
428
+  if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xrbuflines -ne 1 ]]; then
429
+    zle down-line-or-history
430
+    return true
431
+  fi
432
+
433
+  false
434
+}
435
+
436
+function _history-substring-search-up-history() {
437
+  #
438
+  # Behave like up in ZSH, except clear the $BUFFER
439
+  # when beginning of history is reached like in Fish.
440
+  #
441
+  if [[ -z $_history_substring_search_query ]]; then
442
+
443
+    # we have reached the absolute top of history
444
+    if [[ $HISTNO -eq 1 ]]; then
445
+      BUFFER=
446
+
447
+    # going up from somewhere below the top of history
448
+    else
449
+      zle up-history
450
+    fi
451
+
452
+    return true
453
+  fi
454
+
455
+  false
456
+}
457
+
458
+function _history-substring-search-down-history() {
459
+  #
460
+  # Behave like down-history in ZSH, except clear the
461
+  # $BUFFER when end of history is reached like in Fish.
462
+  #
463
+  if [[ -z $_history_substring_search_query ]]; then
464
+
465
+    # going down from the absolute top of history
466
+    if [[ $HISTNO -eq 1 && -z $BUFFER ]]; then
467
+      BUFFER=${history[1]}
468
+      _history_substring_search_move_cursor_eol=true
469
+
470
+    # going down from somewhere above the bottom of history
471
+    else
472
+      zle down-history
473
+    fi
474
+
475
+    return true
476
+  fi
477
+
478
+  false
479
+}
480
+
481
+function _history-substring-search-up-search() {
482
+  _history_substring_search_move_cursor_eol=true
483
+
484
+  #
485
+  # Highlight matches during history-substring-up-search:
486
+  #
487
+  # The following constants have been initialized in
488
+  # _history-substring-search-up/down-search():
489
+  #
490
+  # $_history_substring_search_matches is the current list of matches
491
+  # $_history_substring_search_matches_count is the current number of matches
492
+  # $_history_substring_search_matches_count_plus is the current number of matches + 1
493
+  # $_history_substring_search_matches_count_sans is the current number of matches - 1
494
+  # $_history_substring_search_match_index is the index of the current match
495
+  #
496
+  # The range of values that $_history_substring_search_match_index can take
497
+  # is: [0, $_history_substring_search_matches_count_plus].  A value of 0
498
+  # indicates that we are beyond the end of
499
+  # $_history_substring_search_matches. A value of
500
+  # $_history_substring_search_matches_count_plus indicates that we are beyond
501
+  # the beginning of $_history_substring_search_matches.
502
+  #
503
+  # In _history-substring-search-up-search() the initial value of
504
+  # $_history_substring_search_match_index is
505
+  # $_history_substring_search_matches_count_plus.  This value is set in
506
+  # _history-substring-search-begin().  _history-substring-search-up-search()
507
+  # will initially decrease it to $_history_substring_search_matches_count.
508
+  #
509
+  if [[ $_history_substring_search_match_index -ge 2 ]]; then
510
+    #
511
+    # Highlight the next match:
512
+    #
513
+    # 1. Decrease the value of $_history_substring_search_match_index.
514
+    #
515
+    # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
516
+    #    to highlight the current buffer.
517
+    #
518
+    (( _history_substring_search_match_index-- ))
519
+    BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]]
520
+    _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
521
+
522
+  elif [[ $_history_substring_search_match_index -eq 1 ]]; then
523
+    #
524
+    # We will move beyond the end of $_history_substring_search_matches:
525
+    #
526
+    # 1. Decrease the value of $_history_substring_search_match_index.
527
+    #
528
+    # 2. Save the current buffer in $_history_substring_search_old_buffer,
529
+    #    so that it can be retrieved by
530
+    #    _history-substring-search-down-search() later.
531
+    #
532
+    # 3. Make $BUFFER equal to $_history_substring_search_query.
533
+    #
534
+    # 4. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
535
+    #    to highlight the current buffer.
536
+    #
537
+    (( _history_substring_search_match_index-- ))
538
+    _history_substring_search_old_buffer=$BUFFER
539
+    BUFFER=$_history_substring_search_query
540
+    _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
541
+
542
+  elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count_plus ]]; then
543
+    #
544
+    # We were beyond the beginning of $_history_substring_search_matches but
545
+    # UP makes us move back to $_history_substring_search_matches:
546
+    #
547
+    # 1. Decrease the value of $_history_substring_search_match_index.
548
+    #
549
+    # 2. Restore $BUFFER from $_history_substring_search_old_buffer.
550
+    #
551
+    # 3. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
552
+    #    to highlight the current buffer.
553
+    #
554
+    (( _history_substring_search_match_index-- ))
555
+    BUFFER=$_history_substring_search_old_buffer
556
+    _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
557
+  fi
558
+}
559
+
560
+function _history-substring-search-down-search() {
561
+  _history_substring_search_move_cursor_eol=true
562
+
563
+  #
564
+  # Highlight matches during history-substring-up-search:
565
+  #
566
+  # The following constants have been initialized in
567
+  # _history-substring-search-up/down-search():
568
+  #
569
+  # $_history_substring_search_matches is the current list of matches
570
+  # $_history_substring_search_matches_count is the current number of matches
571
+  # $_history_substring_search_matches_count_plus is the current number of matches + 1
572
+  # $_history_substring_search_matches_count_sans is the current number of matches - 1
573
+  # $_history_substring_search_match_index is the index of the current match
574
+  #
575
+  # The range of values that $_history_substring_search_match_index can take
576
+  # is: [0, $_history_substring_search_matches_count_plus].  A value of 0
577
+  # indicates that we are beyond the end of
578
+  # $_history_substring_search_matches. A value of
579
+  # $_history_substring_search_matches_count_plus indicates that we are beyond
580
+  # the beginning of $_history_substring_search_matches.
581
+  #
582
+  # In _history-substring-search-down-search() the initial value of
583
+  # $_history_substring_search_match_index is
584
+  # $_history_substring_search_matches_count.  This value is set in
585
+  # _history-substring-search-begin().
586
+  # _history-substring-search-down-search() will initially increase it to
587
+  # $_history_substring_search_matches_count_plus.
588
+  #
589
+  if [[ $_history_substring_search_match_index -le $_history_substring_search_matches_count_sans ]]; then
590
+    #
591
+    # Highlight the next match:
592
+    #
593
+    # 1. Increase $_history_substring_search_match_index by 1.
594
+    #
595
+    # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
596
+    #    to highlight the current buffer.
597
+    #
598
+    (( _history_substring_search_match_index++ ))
599
+    BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]]
600
+    _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
601
+
602
+  elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count ]]; then
603
+    #
604
+    # We will move beyond the beginning of $_history_substring_search_matches:
605
+    #
606
+    # 1. Increase $_history_substring_search_match_index by 1.
607
+    #
608
+    # 2. Save the current buffer in $_history_substring_search_old_buffer, so
609
+    #    that it can be retrieved by _history-substring-search-up-search()
610
+    #    later.
611
+    #
612
+    # 3. Make $BUFFER equal to $_history_substring_search_query.
613
+    #
614
+    # 4. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
615
+    #    to highlight the current buffer.
616
+    #
617
+    (( _history_substring_search_match_index++ ))
618
+    _history_substring_search_old_buffer=$BUFFER
619
+    BUFFER=$_history_substring_search_query
620
+    _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
621
+
622
+  elif [[ $_history_substring_search_match_index -eq 0 ]]; then
623
+    #
624
+    # We were beyond the end of $_history_substring_search_matches but DOWN
625
+    # makes us move back to the $_history_substring_search_matches:
626
+    #
627
+    # 1. Increase $_history_substring_search_match_index by 1.
628
+    #
629
+    # 2. Restore $BUFFER from $_history_substring_search_old_buffer.
630
+    #
631
+    # 3. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
632
+    #    to highlight the current buffer.
633
+    #
634
+    (( _history_substring_search_match_index++ ))
635
+    BUFFER=$_history_substring_search_old_buffer
636
+    _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
637
+  fi
638
+}
639
+
640
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
641
+# vim: ft=zsh sw=2 ts=2 et
0 642
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+
1
+# Kate
2
+# Start kate always silent
3
+alias kate='kate >/dev/null 2>&1'
4
+
5
+function kt () {
6
+  cd $1
7
+  kate $1
8
+}
0 9
\ No newline at end of file
1 10
new file mode 100644
... ...
@@ -0,0 +1,174 @@
0
+#compdef knife
1
+
2
+# These flags should be available everywhere according to man knife
3
+knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes )
4
+
5
+# knife has a very special syntax, some example calls are:
6
+# knife status
7
+# knife cookbook list
8
+# knife role show ROLENAME
9
+# knife data bag show DATABAGNAME
10
+# knife role show ROLENAME --attribute ATTRIBUTENAME
11
+# knife cookbook show COOKBOOKNAME COOKBOOKVERSION recipes
12
+
13
+# The -Q switch in compadd allow for completions of things like "data bag" without having to go through two rounds of completion and avoids zsh inserting a \ for escaping spaces
14
+_knife() {
15
+  local curcontext="$curcontext" state line
16
+  typeset -A opt_args
17
+  cloudproviders=(bluebox ec2 rackspace slicehost terremark)
18
+  _arguments \
19
+    '1: :->knifecmd'\
20
+    '2: :->knifesubcmd'\
21
+    '3: :->knifesubcmd2' \
22
+    '4: :->knifesubcmd3' \
23
+    '5: :->knifesubcmd4' \
24
+    '6: :->knifesubcmd5'
25
+  
26
+  case $state in
27
+  knifecmd)
28
+    compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec index node recipe role search ssh status windows $cloudproviders
29
+  ;;
30
+  knifesubcmd)
31
+    case $words[2] in
32
+    (bluebox|ec2|rackspace|slicehost|terremark)
33
+      compadd "$@" server images
34
+    ;;
35
+    client)
36
+      compadd -Q "$@" "bulk delete" list create show delete edit reregister
37
+    ;;
38
+    configure)
39
+      compadd "$@" client
40
+    ;;
41
+    cookbook)
42
+      compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload
43
+    ;;
44
+    node)
45
+     compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete"
46
+    ;;
47
+    recipe)
48
+     compadd "$@" list
49
+    ;;
50
+    role)
51
+      compadd -Q "$@" "bulk delete" create delete edit "from file" list show
52
+    ;; 
53
+    windows)
54
+      compadd "$@" bootstrap
55
+    ;;
56
+    *)
57
+    _arguments '2:Subsubcommands:($(_knife_options1))'
58
+    esac
59
+   ;;
60
+   knifesubcmd2)
61
+    case $words[3] in
62
+     server)
63
+      compadd "$@" list create delete
64
+    ;;
65
+     images)
66
+      compadd "$@" list
67
+    ;;
68
+     site)
69
+      compadd "$@" vendor show share search download list unshare
70
+    ;;
71
+     (show|delete|edit)
72
+     _arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))'
73
+    ;;
74
+    (upload|test)
75
+     _arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)'
76
+    ;;
77
+    list)
78
+     compadd -a "$@" knife_general_flags
79
+    ;;
80
+    bag)
81
+      compadd -Q "$@" show edit list "from file" create delete
82
+    ;;
83
+    *)
84
+      _arguments '3:Subsubcommands:($(_knife_options2))'
85
+    esac
86
+   ;;
87
+   knifesubcmd3)
88
+     case $words[3] in
89
+      show)
90
+       case $words[2] in
91
+       cookbook)
92
+          versioncomp=1
93
+          _arguments '4:Cookbookversions:($(_cookbook_versions) latest)'
94
+       ;;
95
+       (node|client|role)
96
+         compadd "$@" --attribute
97
+       esac
98
+     esac
99
+     case $words[4] in
100
+     (show|edit)
101
+     _arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))'
102
+    ;;
103
+     file)
104
+     _arguments '*:file or directory:_files -g "*.(rb|json)"'
105
+    ;;
106
+      list)
107
+     compadd -a "$@" knife_general_flags
108
+    ;;
109
+        *)
110
+       _arguments '*:Subsubcommands:($(_knife_options3))'
111
+    esac
112
+    ;;
113
+    knifesubcmd4)
114
+      if (( versioncomp > 0 )); then
115
+        compadd "$@" attributes definitions files libraries providers recipes resources templates
116
+      else
117
+       _arguments '*:Subsubcommands:($(_knife_options2))'
118
+      fi
119
+    ;; 
120
+    knifesubcmd5) 
121
+      _arguments '*:Subsubcommands:($(_knife_options3))'
122
+   esac
123
+}
124
+
125
+# Helper functions to provide the argument completion for several depths of commands
126
+_knife_options1() {
127
+ ( for line in $( knife $words[2] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done )
128
+}
129
+
130
+_knife_options2() {
131
+ ( for line in $( knife $words[2] $words[3] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done )
132
+}
133
+
134
+_knife_options3() {
135
+ ( for line in $( knife $words[2] $words[3] $words[4] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done )
136
+}
137
+
138
+# The chef_x_remote functions use knife to get a list of objects of type x on the server
139
+_chef_roles_remote() {
140
+ (knife role list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
141
+}
142
+
143
+_chef_clients_remote() {
144
+ (knife client list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
145
+}
146
+
147
+_chef_nodes_remote() {
148
+ (knife node list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
149
+}
150
+
151
+_chef_cookbooks_remote() {
152
+ (knife cookbook list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
153
+}
154
+
155
+_chef_sitecookbooks_remote() {
156
+ (knife cookbook site list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
157
+}
158
+
159
+_chef_data_bags_remote() {
160
+ (knife data bag list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
161
+}
162
+
163
+# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
164
+_chef_cookbooks_local() {
165
+ (for i in $( grep cookbook_path $HOME/.chef/knife.rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done)
166
+}
167
+
168
+# This function extracts the available cookbook versions on the chef server
169
+_cookbook_versions() {
170
+  (knife cookbook show $words[4] | grep -v $words[4] | grep -v -E '\]|\[|\{|\}' | sed 's/ //g' | sed 's/"//g')
171
+}
172
+
173
+_knife "$@"
... ...
@@ -8,19 +8,30 @@ alias rtfm='man'
8 8
 alias visible='echo'
9 9
 alias invisible='cat'
10 10
 alias moar='more'
11
+alias tldr='less'
12
+alias alwayz='tail -f'
11 13
 
12 14
 alias icanhas='mkdir'
15
+alias gimmeh='touch'
13 16
 alias donotwant='rm'
14 17
 alias dowant='cp'
15 18
 alias gtfo='mv'
19
+alias nowai='chmod'
16 20
 
17 21
 alias hai='cd'
22
+alias iz='ls'
18 23
 alias plz='pwd'
24
+alias ihasbucket='df -h'
19 25
 
20 26
 alias inur='locate'
27
+alias iminurbase='finger'
28
+
29
+alias btw='nice'
30
+alias obtw='nohup'
21 31
 
22 32
 alias nomz='ps -aux'
23 33
 alias nomnom='killall'
24 34
 
35
+alias byes='exit'
25 36
 alias cya='reboot'
26 37
 alias kthxbai='halt'
27 38
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
+}
0 5
new file mode 100644
... ...
@@ -0,0 +1,5 @@
0
+#compdef man-preview
1
+#autoload
2
+
3
+_man
4
+
... ...
@@ -1,57 +1,99 @@
1
-function savepath() {
2
-  pwd > ~/.current_path~
3
-}
1
+# ------------------------------------------------------------------------------
2
+#          FILE:  osx.plugin.zsh
3
+#   DESCRIPTION:  oh-my-zsh plugin file.
4
+#        AUTHOR:  Sorin Ionescu (sorin.ionescu@gmail.com)
5
+#       VERSION:  1.0.1
6
+# ------------------------------------------------------------------------------
7
+
4 8
 
5 9
 function tab() {
6
-savepath
7
-osascript >/dev/null <<EOF
8
-on do_submenu(app_name, menu_name, menu_item, submenu_item)
9
-    -- bring the target application to the front
10
-    tell application app_name
11
-      activate
12
-    end tell
13
-    tell application "System Events"
14
-      tell process app_name
15
-        tell menu bar 1
16
-          tell menu bar item menu_name
17
-            tell menu menu_name
18
-              tell menu item menu_item
19
-                tell menu menu_item
20
-                  click menu item submenu_item
21
-                end tell
22
-              end tell
23
-            end tell
24
-          end tell
25
-        end tell
10
+  local command="cd \\\"$PWD\\\""
11
+  (( $# > 0 )) && command="${command}; $*"
12
+
13
+  the_app=$(
14
+    osascript 2>/dev/null <<EOF
15
+      tell application "System Events"
16
+        name of first item of (every process whose frontmost is true)
26 17
       end tell
27
-    end tell
28
-end do_submenu
18
+EOF
19
+  )
29 20
 
30
-do_submenu("Terminal", "Shell", "New Tab", 1)
21
+  [[ "$the_app" == 'Terminal' ]] && {
22
+    osascript 2>/dev/null <<EOF
23
+      tell application "System Events"
24
+        tell process "Terminal" to keystroke "t" using command down
25
+        tell application "Terminal" to do script "${command}" in front window
26
+      end tell
31 27
 EOF
32
-}
28
+  }
33 29
 
34
-function itab() {
35
-savepath
36
-osascript >/dev/null <<EOF
37
-on do_submenu(app_name, menu_name, menu_item)
38
-    -- bring the target application to the front
39
-    tell application app_name
40
-      activate
41
-    end tell
42
-    tell application "System Events"
43
-      tell process app_name
44
-        tell menu bar 1
45
-          tell menu bar item menu_name
46
-            tell menu menu_name
47
-              click menu item menu_item
48
-            end tell
30
+  [[ "$the_app" == 'iTerm' ]] && {
31
+    osascript 2>/dev/null <<EOF
32
+      tell application "iTerm"
33
+        set current_terminal to current terminal
34
+        tell current_terminal
35
+          launch session "Default Session"
36
+          set current_session to current session
37
+          tell current_session
38
+            write text "${command}"
49 39
           end tell
50 40
         end tell
51 41
       end tell
42
+EOF
43
+  }
44
+}
45
+
46
+function pfd() {
47
+  osascript 2>/dev/null <<EOF
48
+    tell application "Finder"
49
+      return POSIX path of (target of window 1 as alias)
52 50
     end tell
53
-end do_submenu
51
+EOF
52
+}
54 53
 
55
-do_submenu("iTerm", "Shell", "New Tab")
54
+function pfs() {
55
+  osascript 2>/dev/null <<EOF
56
+    set output to ""
57
+    tell application "Finder" to set the_selection to selection
58
+    set item_count to count the_selection
59
+    repeat with item_index from 1 to count the_selection
60
+      if item_index is less than item_count then set the_delimiter to "\n"
61
+      if item_index is item_count then set the_delimiter to ""
62
+      set output to output & ((item item_index of the_selection as alias)'s POSIX path) & the_delimiter
63
+    end repeat
56 64
 EOF
57 65
 }
66
+
67
+function cdf() {
68
+  cd "$(pfd)"
69
+}
70
+
71
+function pushdf() {
72
+  pushd "$(pfd)"
73
+}
74
+
75
+function quick-look() {
76
+  (( $# > 0 )) && qlmanage -p $* &>/dev/null &
77
+}
78
+
79
+function man-preview() {
80
+  man -t "$@" | open -f -a Preview
81
+}
82
+
83
+function trash() {
84
+  local trash_dir="${HOME}/.Trash"
85
+  local temp_ifs=$IFS
86
+  IFS=$'\n'
87
+  for item in "$@"; do
88
+    if [[ -e "$item" ]]; then
89
+      item_name="$(basename $item)"
90
+      if [[ -e "${trash_dir}/${item_name}" ]]; then
91
+        mv -f "$item" "${trash_dir}/${item_name} $(date "+%H-%M-%S")"
92
+      else
93
+        mv -f "$item" "${trash_dir}/"
94
+      fi
95
+    fi
96
+  done
97
+  IFS=$temp_ifs
98
+}
99
+
... ...
@@ -10,7 +10,6 @@ _phing_does_target_list_need_generating () {
10 10
 _phing () {
11 11
   if [ -f build.xml ]; then
12 12
     if _phing_does_target_list_need_generating; then
13
-      echo "\nGenerating .phing_targets..." > /dev/stderr
14 13
       phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets
15 14
     fi
16 15
     compadd `cat .phing_targets`
17 16
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
0 10
new file mode 100644
... ...
@@ -0,0 +1,4 @@
0
+#compdef powder
1
+#autoload
2
+
3
+compadd `powder help | grep powder | cut -d " " -f 4`
... ...
@@ -1,13 +1,5 @@
1 1
 # Rails 3 aliases, backwards-compatible with Rails 2.
2 2
 
3
-function _bundle_command {
4
-  if command -v bundle && [ -e "Gemfile" ]; then
5
-    bundle exec $@
6
-  else
7
-    $@
8
-  fi
9
-}
10
-
11 3
 function _rails_command () {
12 4
   if [ -e "script/server" ]; then
13 5
     ruby script/$@
... ...
@@ -25,6 +17,3 @@ alias rp='_rails_command plugin'
25 25
 alias rs='_rails_command server'
26 26
 alias rsd='_rails_command server --debugger'
27 27
 alias devlog='tail -f log/development.log'
28
-
29
-alias rspec='_bundle_command rspec'
30
-alias cuke='_bundle_command cucumber'
... ...
@@ -51,7 +51,7 @@ _1st_arguments=(
51 51
   'keys:find all keys matching the given pattern'
52 52
   'lastsave:get the UNIX timestamp of the last successful save to disk'
53 53
   'lindex:get an element from a list by its index'
54
-  'linset:insert an element before or after another element in a list'
54
+  'linsert:insert an element before or after another element in a list'
55 55
   'llen:get the length of a list'
56 56
   'lpop:remove and get the first element in a list'
57 57
   'lpush:prepend a value to a list'
... ...
@@ -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'
6 8
new file mode 100644
... ...
@@ -0,0 +1,147 @@
0
+#compdef rvm
1
+
2
+local curcontext="$curcontext" state line cmds ret=1
3
+
4
+_arguments -C \
5
+	'(- 1 *)'{-v,--version}'[display version information]' \
6
+	'(-l|--level)'{-l,--level}'+[patch level to use with rvm use / install]:number' \
7
+	'(--prefix)--prefix[path for all rvm files (~/.rvm/), with trailing slash!]:path:_files' \
8
+	'(--bin)--bin[path for binaries to be placed (~/.rvm/bin/)]:path:_files' \
9
+	'(--source)--source[src directory to use (~/.rvm/src/)]:path:_files' \
10
+	'(--archives)--archives[directory for downladed files (~/.rvm/archives/)]:path:_files' \
11
+	'-S[Specify a script file to attempt to load and run (rubydo)]:file:_files' \
12
+	'-e[Execute code from the command line]:code' \
13
+	'(-G)-G[root gem path to use]:path:_files' \
14
+	'(--gems)--gems[Used to set the gems_flag, use with remove to remove gems]' \
15
+	'(--archive)--archive[Used to set the archive_flag, use with remove to remove archive]' \
16
+	'(--patch)--patch[With MRI Rubies you may specify one or more full paths to patches]' \
17
+	'(-C|--configure)'{-C,--configure}'=[custom configure options]' \
18
+	'(--nice)--nice[process niceness (for slow computers, default 0)]:number' \
19
+	'(--ree)--ree-options[Options passed directly to ree ./installer on the command line]:options' \
20
+	'(--head)--head[with update, updates rvm to git head version]' \
21
+	'(--rubygems)--rubygems[with update, updates rubygems for selected ruby]' \
22
+	'(--default)--default[with ruby select, sets a default ruby for new shells]' \
23
+	'(--debug)--debug[Toggle debug mode on for very verbose output]' \
24
+	'(--trace)--trace[Toggle trace mode on to see EVERYTHING rvm is doing]' \
25
+	'(--force)--force[Force install, removes old install & source before install]' \
26
+	'(--summary)--summary[Used with rubydo to print out a summary of the commands run]' \
27
+	'(--latest)--latest[with gemset --dump skips version strings for latest gem]' \
28
+	'(--gems)--gems[with uninstall/remove removes gems with the interpreter]' \
29
+	'(--docs)--docs[with install, attempt to generate ri after installation]' \
30
+	'(--reconfigure)--reconfigure[Force ./configure on install even if Makefile already exists]' \
31
+	'1: :->cmds' \
32
+	'*: :->args' && ret=0
33
+
34
+case $state in
35
+	cmds)
36
+		cmds=( 
37
+            "version:show the rvm version installed in rvm_path"
38
+            "use:setup current shell to use a specific ruby version"
39
+            "reload:reload rvm source itself (useful after changing rvm source)"
40
+            "implode:(seppuku) removes the rvm installation completely. This means everything in $rvm_path (~/.rvm)."
41
+            "update:upgrades rvm to the latest version."
42
+            "reset:remove current and stored default & system settings."
43
+            "info :show the *current* environment information for current ruby"
44
+            "current:print the *current* ruby version and the name of any gemset being used."
45
+            "debug:show info plus additional information for common issues"
46
+            "install:install one or many ruby versions"
47
+            "uninstall:uninstall one or many ruby versions, leaves their sources"
48
+            "remove:uninstall one or many ruby versions and remove their sources"
49
+            "migrate:Lets you migrate all gemsets from one ruby to another."
50
+            "upgrade:Lets you upgrade from one version of a ruby to another, including migrating your gemsets semi-automatically."
51
+            "wrapper:generates a set of wrapper executables for a given ruby with the specified ruby and gemset combination. Used under the hood for passenger support and the like."
52
+            "cleanup:Lets you remove stale source folders / archives and other miscellaneous data associated with rvm."
53
+            "repair:Lets you repair parts of your environment e.g. wrappers, env files and and similar files (e.g. general maintenance)."
54
+            "snapshot:Lets your backup / restore an rvm installation in a lightweight manner."
55
+            "disk-usage:Tells you how much disk space rvm install is using."
56
+            "tools:Provides general information about the ruby environment, primarily useful when scripting rvm."
57
+            "docs:Tools to make installing ri and rdoc documentation easier."
58
+            "rvmrc:Tools related to managing rvmrc trust and loading."
59
+            "exec:runs an arbitrary command as a set operation."
60
+            "ruby:runs a named ruby file against specified and/or all rubies"
61
+            "gem:runs a gem command using selected ruby's 'gem'"
62
+            "rake:runs a rake task against specified and/or all rubies"
63
+            "tests:runs 'rake test' across selected ruby versions"
64
+            "specs:runs 'rake spec' across selected ruby versions"
65
+            "monitor:Monitor cwd for testing, run rake {spec,test} on changes."
66
+            "gemset:gemsets: http://rvm.beginrescueend.com/gemsets/"
67
+            "rubygems:Switches the installed version of rubygems for the current ruby."
68
+            "gemdir:display the path to the current gem directory (GEM_HOME)."
69
+            "srcdir:display the path to rvm source directory (may be yanked)"
70
+            "fetch:Performs an archive / src fetch only of the selected ruby."
71
+            "list:show currently installed rubies, interactive output."
72
+            "package:Install a dependency package {readline,iconv,zlib,openssl}"
73
+            "notes:Display notes, with operating system specifics."
74
+            "export:Temporarily set an environment variable in the current shell."
75
+            "unexport:Undo changes made to the environment by 'rvm export'."
76
+        )
77
+		_describe -t commands 'rvm command' cmds && ret=0
78
+		;;
79
+	args)
80
+		case $line[1] in
81
+			(use|uninstall|remove|list)
82
+				_values -S , 'rubies' $(rvm list strings | sed -e 's/ruby-\([^) ]*\)-\([^) ]*\)/ruby-\1-\2 \1-\2 \1/g') default system && ret=0
83
+				;;
84
+			(install|fetch)
85
+				_values -S , 'rubies' $(rvm list known_strings) && ret=0
86
+				;;
87
+			gemset)
88
+				if (( CURRENT == 3 )); then
89
+					_values 'gemset_commands' \
90
+                        'import' \
91
+                        'export' \
92
+                        'create' \
93
+                        'copy' \
94
+                        'rename' \
95
+                        'empty' \
96
+                        'delete' \
97
+                        'name' \
98
+                        'dir' \
99
+                        'list' \
100
+                        'list_all' \
101
+                        'gemdir' \
102
+                        'install' \
103
+                        'pristine' \
104
+                        'clear' \
105
+                        'use' \
106
+                        'update' \
107
+                        'unpack' \
108
+                        'globalcache'
109
+				else
110
+					_values -S , 'gemsets' $(rvm gemset list | grep -v gemset 2>/dev/null)
111
+				fi
112
+				ret=0
113
+				;;
114
+			package)
115
+				if (( CURRENT == 3 )); then
116
+					_values 'package_commands' \
117
+                        'install' \
118
+                        'uninstall'  
119
+				else
120
+					_values 'packages' \
121
+                        'readline' \
122
+                        'iconv' \
123
+                        'curl' \
124
+                        'openssl' \
125
+                        'zlib' \
126
+                        'autoconf' \
127
+                        'ncurses' \
128
+                        'pkgconfig' \
129
+                        'gettext' \
130
+                        'glib' \
131
+                        'mono' \
132
+                        'llvm' \
133
+                        'libxml2' \
134
+                        'libxslt' \
135
+                        'libyaml'
136
+				fi
137
+				ret=0
138
+				;;
139
+			*)
140
+				(( ret )) && _message 'no more arguments'
141
+				;;
142
+		esac
143
+		;;
144
+esac
145
+
146
+return ret
0 147
new file mode 100644
... ...
@@ -0,0 +1,44 @@
0
+alias rubies='rvm list rubies'
1
+alias gemsets='rvm gemset list'
2
+
3
+local ruby18='ruby-1.8.7-p334'
4
+local ruby19='ruby-1.9.2-p180'
5
+
6
+function rb18 {
7
+	if [ -z "$1" ]; then
8
+		rvm use "$ruby18"
9
+	else
10
+		rvm use "$ruby18@$1"
11
+	fi
12
+}
13
+
14
+_rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`}
15
+compdef _rb18 rb18
16
+
17
+function rb19 {
18
+	if [ -z "$1" ]; then
19
+		rvm use "$ruby19"
20
+	else
21
+		rvm use "$ruby19@$1"
22
+	fi
23
+}
24
+
25
+_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`}
26
+compdef _rb19 rb19
27
+
28
+function rvm-update {
29
+	rvm get head
30
+	rvm reload # TODO: Reload rvm completion?
31
+}
32
+
33
+# TODO: Make this usable w/o rvm.
34
+function gems {
35
+	local current_ruby=`rvm-prompt i v p`
36
+	local current_gemset=`rvm-prompt g`
37
+
38
+	gem list $@ | sed \
39
+		-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
40
+		-Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
41
+		-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
42
+		-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
43
+}
... ...
@@ -1,23 +1,62 @@
1
-# Based on code from Joseph M. Reagle
2
-# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
1
+#
2
+# INSTRUCTIONS
3
+#
4
+#   To enabled agent forwarding support add the following to
5
+#   your .zshrc file:
6
+#
7
+#     zstyle :omz:plugins:ssh-agent agent-forwarding on
8
+#
9
+#   To load multiple identies use the identities style, For
10
+#   example:
11
+#
12
+#     zstyle :omz:plugins:ssh-agent id_rsa id_rsa2 id_github
13
+#
14
+#
15
+# CREDITS
16
+#
17
+#   Based on code from Joseph M. Reagle
18
+#   http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
19
+#
20
+#   Agent forwarding support based on ideas from
21
+#   Florent Thoumie and Jonas Pfenniger
22
+#
3 23
 
4
-local SSH_ENV=$HOME/.ssh/environment-$HOST
24
+local _plugin__ssh_env=$HOME/.ssh/environment-$HOST
25
+local _plugin__forwarding
5 26
 
6
-function start_agent {
7
-  /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
8
-  chmod 600 ${SSH_ENV}
9
-  . ${SSH_ENV} > /dev/null
10
-  /usr/bin/ssh-add;
27
+function _plugin__start_agent()
28
+{
29
+  local -a identities
30
+
31
+  # start ssh-agent and setup environment
32
+  /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${_plugin__ssh_env}
33
+  chmod 600 ${_plugin__ssh_env}
34
+  . ${_plugin__ssh_env} > /dev/null
35
+
36
+  # load identies
37
+  zstyle -a :omz:plugins:ssh-agent identities identities 
38
+  echo starting...
39
+  /usr/bin/ssh-add $HOME/.ssh/${^identities}
11 40
 }
12 41
 
13
-# Source SSH settings, if applicable
42
+# test if agent-forwarding is enabled
43
+zstyle -b :omz:plugins:ssh-agent agent-forwarding _plugin__forwarding
44
+if [[ ${_plugin__forwarding} == "yes" && -n "$SSH_AUTH_SOCK" ]]; then
45
+  # Add a nifty symlink for screen/tmux if agent forwarding
46
+  [[ -L $SSH_AUTH_SOCK ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen
14 47
 
15
-if [ -f "${SSH_ENV}" ]; then
16
-  . ${SSH_ENV} > /dev/null
48
+elif [ -f "${_plugin__ssh_env}" ]; then
49
+  # Source SSH settings, if applicable
50
+  . ${_plugin__ssh_env} > /dev/null
17 51
   ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
18
-    start_agent;
52
+    _plugin__start_agent;
19 53
   }
20 54
 else
21
-  start_agent;
55
+  _plugin__start_agent;
22 56
 fi
23 57
 
58
+# tidy up after ourselves
59
+unfunction _plugin__start_agent
60
+unset _plugin__forwarding
61
+unset _plugin__ssh_env
62
+
... ...
@@ -1,5 +1,5 @@
1 1
 function svn_prompt_info {
2
-    if [[ -d .svn ]]; then
2
+    if [ in_svn ]; then
3 3
         echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\
4 4
 $ZSH_THEME_REPO_NAME_COLOR$(svn_get_repo_name)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR"
5 5
     fi
... ...
@@ -13,7 +13,7 @@ function in_svn() {
13 13
 }
14 14
 
15 15
 function svn_get_repo_name {
16
-    if [ is_svn ]; then
16
+    if [ in_svn ]; then
17 17
         svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT
18 18
     
19 19
         svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//"
... ...
@@ -21,14 +21,14 @@ function svn_get_repo_name {
21 21
 }
22 22
 
23 23
 function svn_get_rev_nr {
24
-    if [ is_svn ]; then
24
+    if [ in_svn ]; then
25 25
         svn info 2> /dev/null | sed -n s/Revision:\ //p
26 26
     fi
27 27
 }
28 28
 
29 29
 function svn_dirty_choose {
30
-    if [ is_svn ]; then
31
-        s=$(svn status 2>/dev/null)
30
+    if [ in_svn ]; then
31
+        s=$(svn status|grep -E '^\s*[ACDIM!?L]' 2>/dev/null)
32 32
         if [ $s ]; then 
33 33
             echo $1
34 34
         else 
... ...
@@ -39,4 +39,4 @@ function svn_dirty_choose {
39 39
 
40 40
 function svn_dirty {
41 41
     svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN
42
-}
43 42
\ No newline at end of file
43
+}
44 44
new file mode 100644
... ...
@@ -0,0 +1,280 @@
0
+#compdef task
1
+#
2
+# zsh completion for taskwarrior
3
+#
4
+# Copyright 2010 - 2011 Johannes Schlatow
5
+# Copyright 2009 P.C. Shyamshankar
6
+# All rights reserved.
7
+#
8
+# This script is part of the taskwarrior project.
9
+#
10
+# This program is free software; you can redistribute it and/or modify it under
11
+# the terms of the GNU General Public License as published by the Free Software
12
+# Foundation; either version 2 of the License, or (at your option) any later
13
+# version.
14
+#
15
+# This program is distributed in the hope that it will be useful, but WITHOUT
16
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17
+# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
18
+# details.
19
+#
20
+# You should have received a copy of the GNU General Public License along with
21
+# this program; if not, write to the
22
+#
23
+#     Free Software Foundation, Inc.,
24
+#     51 Franklin Street, Fifth Floor,
25
+#     Boston, MA
26
+#     02110-1301
27
+#     USA
28
+#
29
+typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers
30
+_task_projects=($(task _projects))
31
+_task_tags=($(task _tags))
32
+_task_ids=($(task _ids))
33
+_task_config=($(task _config))
34
+_task_modifiers=(
35
+	'before' \
36
+	'after' \
37
+	'none' \
38
+	'any' \
39
+	'is' \
40
+	'isnt' \
41
+	'has' \
42
+	'hasnt' \
43
+	'startswith' \
44
+	'endswith' \
45
+	'word' \
46
+	'noword'
47
+)
48
+_task_cmds=($(task _commands))
49
+_task_zshcmds=( ${(f)"$(task _zshcommands)"} )
50
+
51
+
52
+_task_idCmds=(
53
+	'append' \
54
+	'prepend' \
55
+	'annotate' \
56
+	'denotate' \
57
+	'edit' \
58
+	'duplicate' \
59
+	'info' \
60
+	'start' \
61
+	'stop' \
62
+	'done'
63
+)
64
+
65
+_task_idCmdsDesc=(
66
+	'append:Appends more description to an existing task.' \
67
+	'prepend:Prepends more description to an existing task.' \
68
+	'annotate:Adds an annotation to an existing task.' \
69
+	'denotate:Deletes an annotation of an existing task.' \
70
+	'edit:Launches an editor to let you modify a task directly.' \
71
+	'duplicate:Duplicates the specified task, and allows modifications.' \
72
+	'info:Shows all data, metadata for specified task.' \
73
+	'start:Marks specified task as started.' \
74
+	'stop:Removes the start time from a task.' \
75
+	'done:Marks the specified task as completed.'
76
+)
77
+
78
+_task() {
79
+    _arguments -s -S \
80
+        "*::task command:_task_commands"
81
+    return 0
82
+}
83
+
84
+local -a reply args word
85
+word=$'[^\0]#\0'
86
+
87
+# priorities
88
+local -a task_priorities
89
+_regex_words values 'task priorities' \
90
+	'H:High' \
91
+	'M:Middle' \
92
+	'L:Low'
93
+task_priorities=("$reply[@]")
94
+
95
+# projects
96
+local -a task_projects
97
+task_projects=(
98
+	/"$word"/
99
+	":values:task projects:compadd -a _task_projects"
100
+)
101
+
102
+local -a _task_dates
103
+_regex_words values 'task dates' \
104
+	'tod*ay:Today' \
105
+	'yes*terday:Yesterday' \
106
+	'tom*orrow:Tomorrow' \
107
+	'sow:Start of week' \
108
+	'soww:Start of work week' \
109
+	'socw:Start of calendar week' \
110
+	'som:Start of month' \
111
+	'soy:Start of year' \
112
+	'eow:End of week' \
113
+	'eoww:End of work week' \
114
+	'eocw:End of calendar week' \
115
+	'eom:End of month' \
116
+	'eoy:End of year' \
117
+	'mon:Monday' \
118
+	'tue:Tuesday'\
119
+	'wed:Wednesday' \
120
+	'thu:Thursday' \
121
+	'fri:Friday' \
122
+	'sat:Saturday' \
123
+	'sun:Sunday'
124
+_task_dates=("$reply[@]")
125
+
126
+local -a _task_reldates
127
+_regex_words values 'task reldates' \
128
+	'hrs:n hours' \
129
+	'day:n days' \
130
+	'1st:first' \
131
+	'2nd:second' \
132
+	'3rd:third' \
133
+	'th:4th, 5th, etc.' \
134
+	'wks:weeks'
135
+_task_reldates=("$reply[@]")
136
+
137
+task_dates=(
138
+	\( "$_task_dates[@]" \|
139
+    \( /$'[0-9][0-9]#'/- \( "$_task_reldates[@]" \) \)
140
+	\)
141
+)
142
+
143
+_regex_words values 'task frequencies' \
144
+	'daily:Every day' \
145
+	'day:Every day' \
146
+	'weekdays:Every day skipping weekend days' \
147
+	'weekly:Every week' \
148
+	'biweekly:Every two weeks' \
149
+	'fortnight:Every two weeks' \
150
+	'quarterly:Every three months' \
151
+	'semiannual:Every six months' \
152
+	'annual:Every year' \
153
+	'yearly:Every year' \
154
+	'biannual:Every two years' \
155
+	'biyearly:Every two years'
156
+_task_freqs=("$reply[@]")
157
+
158
+local -a _task_frequencies
159
+_regex_words values 'task frequencies' \
160
+	'd:days' \
161
+	'w:weeks' \
162
+	'q:quarters' \
163
+	'y:years'
164
+_task_frequencies=("$reply[@]")
165
+
166
+task_freqs=(
167
+	\( "$_task_freqs[@]" \|
168
+     \( /$'[0-9][0-9]#'/- \( "$_task_frequencies[@]" \) \)
169
+	\)
170
+)
171
+
172
+# attributes
173
+local -a task_attributes
174
+_regex_words -t ':' default 'task attributes' \
175
+	'pro*ject:Project name:$task_projects' \
176
+	'du*e:Due date:$task_dates' \
177
+	'wa*it:Date until task becomes pending:$task_dates' \
178
+	're*cur:Recurrence frequency:$task_freqs' \
179
+	'pri*ority:priority:$task_priorities' \
180
+	'un*til:Recurrence end date:$task_dates' \
181
+	'fg:Foreground color' \
182
+	'bg:Background color' \
183
+	'li*mit:Desired number of rows in report'
184
+task_attributes=("$reply[@]")
185
+
186
+args=(
187
+	\( "$task_attributes[@]" \|
188
+	\( /'(project|due|wait|recur|priority|until|fg|bg|limit).'/- \( /$'[^:]#:'/ ":default:modifiers:compadd -S ':' -a _task_modifiers" \) \) \|
189
+	\( /'(rc).'/- \( /$'[^:]#:'/ ":arguments:config:compadd -S ':' -a _task_config" \) \) \|
190
+	\( /'(+|-)'/- \( /"$word"/ ":values:remove tag:compadd -a _task_tags" \) \) \|
191
+	\( /"$word"/ \)
192
+	\) \#
193
+)
194
+_regex_arguments _task_attributes "${args[@]}"
195
+
196
+## task commands
197
+
198
+# default completion
199
+(( $+functions[_task_default] )) ||
200
+_task_default() {
201
+	_task_attributes "$@"
202
+}
203
+
204
+# commands expecting an ID
205
+(( $+functions[_task_id] )) ||
206
+_task_id() {
207
+	if (( CURRENT < 3 )); then
208
+		# update IDs
209
+		_task_zshids=( ${(f)"$(task _zshids)"} )
210
+		_describe -t values 'task IDs' _task_zshids
211
+	else
212
+		_task_attributes "$@"
213
+	fi
214
+}
215
+
216
+# merge completion
217
+(( $+functions[_task_merge] )) ||
218
+_task_merge() {
219
+	# TODO match URIs in .taskrc
220
+	_files
221
+}
222
+
223
+# push completion
224
+(( $+functions[_task_push] )) ||
225
+_task_push() {
226
+	# TODO match URIs in .taskrc
227
+	_files
228
+}
229
+
230
+# pull completion
231
+(( $+functions[_task_pull] )) ||
232
+_task_pull() {
233
+	# TODO match URIs in .taskrc
234
+	_files
235
+}
236
+
237
+
238
+# modify (task [0-9]* ...) completion
239
+(( $+functions[_task_modify] )) ||
240
+_task_modify() {
241
+	_describe -t commands 'task command' _task_idCmdsDesc
242
+	_task_attributes "$@"
243
+}
244
+
245
+## first level completion => task sub-command completion
246
+(( $+functions[_task_commands] )) ||
247
+_task_commands() {
248
+    local cmd ret=1
249
+	if (( CURRENT == 1 )); then
250
+		# update IDs
251
+		_task_zshids=( ${(f)"$(task _zshids)"} )
252
+
253
+		_describe -t commands 'task command' _task_zshcmds
254
+		_describe -t values 'task IDs' _task_zshids
255
+		# TODO match more than one ID
256
+	elif [[ $words[1] =~ ^[0-9]*$ ]] then
257
+		 _call_function ret _task_modify
258
+		 return ret
259
+	else
260
+#        local curcontext="${curcontext}"
261
+#        cmd="${_task_cmds[(r)$words[1]:*]%%:*}"
262
+		  cmd="${_task_cmds[(r)$words[1]]}"
263
+		  idCmd="${(M)_task_idCmds[@]:#$words[1]}"
264
+        if (( $#cmd )); then
265
+#            curcontext="${curcontext%:*:*}:task-${cmd}"
266
+
267
+				if (( $#idCmd )); then
268
+					_call_function ret _task_id
269
+				else
270
+					_call_function ret _task_${cmd} ||
271
+						_call_function ret _task_default ||
272
+							_message "No command remaining."
273
+				fi
274
+        else
275
+            _message "Unknown subcommand ${cmd}"
276
+        fi
277
+        return ret
278
+    fi
279
+}
0 280
new file mode 100644
... ...
@@ -0,0 +1,21 @@
0
+################################################################################
1
+# Author: Pete Clark
2
+# Email: pete[dot]clark[at]gmail[dot]com
3
+# Version: 0.1 (05/24/2011)
4
+# License: WTFPL<http://sam.zoy.org/wtfpl/>
5
+#
6
+# This oh-my-zsh plugin adds smart tab completion for
7
+# TaskWarrior<http://taskwarrior.org/>. It uses the zsh tab completion
8
+# script (_task) distributed with TaskWarrior for the completion definitions.
9
+#
10
+# Typing task[tabtab] will give you a list of current tasks, task 66[tabtab]
11
+# gives a list of available modifications for that task, etc.
12
+################################################################################
13
+
14
+zstyle ':completion:*:*:task:*' verbose yes
15
+zstyle ':completion:*:*:task:*:descriptions' format '%U%B%d%b%u'
16
+
17
+zstyle ':completion:*:*:task:*' group-name ''
18
+
19
+alias t=task
20
+compdef _task t=task
... ...
@@ -1,11 +1,9 @@
1
+alias et='mate .'
2
+alias ett='mate app config lib db public spec test Rakefile Capfile Todo'
3
+alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
4
+alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
1 5
 
2
-# TextMate
3
-alias et='mate . &'
4
-alias ett='mate app config lib db public spec test Rakefile Capfile Todo &'
5
-alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &'
6
-alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &'
7
-
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`
... ...
@@ -1,23 +1,26 @@
1 1
 # Path to your oh-my-zsh configuration.
2
-export ZSH=$HOME/.oh-my-zsh
2
+ZSH=$HOME/.oh-my-zsh
3 3
 
4 4
 # Set name of the theme to load.
5 5
 # Look in ~/.oh-my-zsh/themes/
6 6
 # Optionally, if you set this to "random", it'll load a random theme each
7 7
 # time that oh-my-zsh is loaded.
8
-export ZSH_THEME="robbyrussell"
8
+ZSH_THEME="robbyrussell"
9 9
 
10 10
 # Set to this to use case-sensitive completion
11
-# export CASE_SENSITIVE="true"
11
+# CASE_SENSITIVE="true"
12 12
 
13 13
 # Comment this out to disable weekly auto-update checks
14
-# export DISABLE_AUTO_UPDATE="true"
14
+# DISABLE_AUTO_UPDATE="true"
15 15
 
16 16
 # Uncomment following line if you want to disable colors in ls
17
-# export DISABLE_LS_COLORS="true"
17
+# DISABLE_LS_COLORS="true"
18 18
 
19 19
 # Uncomment following line if you want to disable autosetting terminal title.
20
-# export DISABLE_AUTO_TITLE="true"
20
+# DISABLE_AUTO_TITLE="true"
21
+
22
+# Uncomment following line if you want red dots to be displayed while waiting for completion
23
+# COMPLETION_WAITING_DOTS="true"
21 24
 
22 25
 # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
23 26
 # Example format: plugins=(rails git textmate ruby lighthouse)
24 27
new file mode 100644
... ...
@@ -0,0 +1,22 @@
0
+
1
+local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}'
2
+local pwd='%{$fg[blue]%}%~%{$reset_color%}'
3
+local rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
4
+local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})'
5
+local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}'
6
+
7
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
8
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
9
+ZSH_THEME_GIT_PROMPT_DIRTY=""
10
+ZSH_THEME_GIT_PROMPT_CLEAN=""
11
+
12
+ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚"
13
+ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹"
14
+ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖"
15
+ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜"
16
+ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
17
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
18
+
19
+PROMPT="${user} ${pwd}$ "
20
+RPROMPT="${return_code} ${git_branch} ${rvm}"
21
+
0 22
new file mode 100644
... ...
@@ -0,0 +1,20 @@
0
+# https://github.com/blinks zsh theme
1
+
2
+function _prompt_char() {
3
+  if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
4
+    echo "%{%F{blue}%}±%{%f%k%b%}"
5
+  else
6
+    echo ' '
7
+  fi
8
+}
9
+
10
+ZSH_THEME_GIT_PROMPT_PREFIX=" [%{%B%F{blue}%}"
11
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{%f%k%b%K{black}%B%F{green}%}]"
12
+ZSH_THEME_GIT_PROMPT_DIRTY=" %{%F{red}%}*%{%f%k%b%}"
13
+ZSH_THEME_GIT_PROMPT_CLEAN=""
14
+
15
+PROMPT='%{%f%k%b%}
16
+%{%K{black}%B%F{green}%}%n%{%B%F{blue}%}@%{%B%F{cyan}%}%m%{%B%F{green}%} %{%b%F{yellow}%K{black}%}%~%{%B%F{green}%}$(git_prompt_info)%E%{%f%k%b%}
17
+%{%K{black}%}$(_prompt_char)%{%K{black}%} %#%{%f%k%b%} '
18
+
19
+RPROMPT='!%{%B%F{cyan}%}%!%{%f%k%b%}'
0 20
new file mode 100644
... ...
@@ -0,0 +1,14 @@
0
+if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
1
+local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
2
+
3
+PROMPT='%{$fg[$NCOLOR]%}%n%{$reset_color%}@%{$fg[cyan]%}%m\
4
+%{$reset_color%}:%{$fg[magenta]%}%~\
5
+$(git_prompt_info) \
6
+%{$fg[red]%}%(!.#.»)%{$reset_color%} '
7
+PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
8
+RPS1='${return_code}'
9
+
10
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}("
11
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}○%{$reset_color%}"
12
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}⚡%{$reset_color%}"
13
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%})%{$reset_color%}"
... ...
@@ -3,7 +3,18 @@
3 3
 local user_color='green'; [ $UID -eq 0 ] && user_color='red'
4 4
 PROMPT='%n@%m %{$fg[$user_color]%}%~%{$reset_color%}%(!.#.>) '
5 5
 PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
6
-RPS1='%(?..%{$fg[red]%}%? ↵%{$reset_color%})$(git_prompt_info)'
7 6
 
8
-ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}"
9
-ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
7
+local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}"
8
+RPROMPT='${return_status}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}'
9
+
10
+ZSH_THEME_GIT_PROMPT_PREFIX=" "
11
+ZSH_THEME_GIT_PROMPT_SUFFIX=""
12
+ZSH_THEME_GIT_PROMPT_DIRTY=""
13
+ZSH_THEME_GIT_PROMPT_CLEAN=""
14
+
15
+ZSH_THEME_GIT_PROMPT_ADDED="%{$fg_bold[green]%}+"
16
+ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg_bold[blue]%}!"
17
+ZSH_THEME_GIT_PROMPT_DELETED="%{$fg_bold[red]%}-"
18
+ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg_bold[magenta]%}>"
19
+ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[yellow]%}#"
20
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[cyan]%}?"
10 21
new file mode 100644
... ...
@@ -0,0 +1,6 @@
0
+PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
1
+
2
+ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[red]%}"
3
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
4
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
5
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
0 6
new file mode 100644
... ...
@@ -0,0 +1,26 @@
0
+# ZSH THEME Preview: https://skitch.com/huyy/rk979/humza.zshtheme
1
+
2
+let TotalBytes=0
3
+for Bytes in $(ls -l | grep "^-" | awk '{ print $5 }')
4
+do
5
+   let TotalBytes=$TotalBytes+$Bytes
6
+done
7
+		# should it say b, kb, Mb, or Gb
8
+if [ $TotalBytes -lt 1024 ]; then
9
+   TotalSize=$(echo -e "scale=3 \n$TotalBytes \nquit" | bc)
10
+   suffix="b"
11
+elif [ $TotalBytes -lt 1048576 ]; then
12
+   TotalSize=$(echo -e "scale=3 \n$TotalBytes/1024 \nquit" | bc)
13
+   suffix="kb"
14
+elif [ $TotalBytes -lt 1073741824 ]; then
15
+   TotalSize=$(echo -e "scale=3 \n$TotalBytes/1048576 \nquit" | bc)
16
+   suffix="Mb"
17
+else
18
+   TotalSize=$(echo -e "scale=3 \n$TotalBytes/1073741824 \nquit" | bc)
19
+   suffix="Gb"
20
+fi
21
+
22
+PROMPT='%{$reset_color%}%n %{$fg[green]%}{%{$reset_color%}%~%{$fg[green]%}}%{$reset_color%}$(git_prompt_info) greetings, earthling %{$fg[green]%}[%{$reset_color%}%{$TotalSize%}%{$suffix%}%{$fg[green]%}]%{$fg[red]%}$%{$reset_color%} ☞ '
23
+
24
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}±("
25
+ZSH_THEME_GIT_PROMPT_SUFFIX=");%{$reset_color%}"
0 26
new file mode 100644
... ...
@@ -0,0 +1,4 @@
0
+PROMPT=$'%{$fg[green]%}%n@%m: %{$reset_color%}%{$fg[blue]%}%/%{$reset_color%}
1
+%{$fg_bold[red]%}➜ %{$reset_color%} '
2
+
3
+PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}"
... ...
@@ -1,6 +1,6 @@
1 1
 #PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
2 2
 PROMPT="%{$fg_bold[cyan]%}%T%{$fg_bold[green]%} %{$fg_bold[white]%}%n%{$fg[magenta]%}@%{$fg_bold[white]%}%m %{$fg_bold[green]%}%d
3
-%{$fg_bold[yellow]%}%% $(git_prompt_info)%{$reset_color%}"
3
+%{$fg_bold[yellow]%}%% %{$reset_color%}"
4 4
 
5 5
 #ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
6 6
 #ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
... ...
@@ -3,8 +3,22 @@
3 3
 
4 4
 local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})"
5 5
 
6
-PROMPT='%{$fg_bold[green]%}%n@%m%{$reset_color%} %{$fg_bold[blue]%}%2~%{$reset_color%} $(git_prompt_info)%{$reset_color%}%B»%b '
6
+function my_git_prompt_info() {
7
+  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
8
+  GIT_STATUS=$(git_prompt_status)
9
+  [[ -n $GIT_STATUS ]] && GIT_STATUS=" $GIT_STATUS"
10
+  echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$GIT_STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX"
11
+}
12
+
13
+PROMPT='%{$fg_bold[green]%}%n@%m%{$reset_color%} %{$fg_bold[blue]%}%2~%{$reset_color%} $(my_git_prompt_info)%{$reset_color%}%B»%b '
7 14
 RPS1="${return_code}"
8 15
 
9 16
 ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}("
10 17
 ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}"
18
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%%"
19
+ZSH_THEME_GIT_PROMPT_ADDED="+"
20
+ZSH_THEME_GIT_PROMPT_MODIFIED="*"
21
+ZSH_THEME_GIT_PROMPT_RENAMED="~"
22
+ZSH_THEME_GIT_PROMPT_DELETED="!"
23
+ZSH_THEME_GIT_PROMPT_UNMERGED="?"
24
+
11 25
new file mode 100644
... ...
@@ -0,0 +1,8 @@
0
+# Yay! High voltage and arrows!
1
+
2
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
3
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
4
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
5
+ZSH_THEME_GIT_PROMPT_CLEAN=""
6
+
7
+PROMPT='%{$fg[cyan]%}%1~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}$(git_prompt_info)%{$fg[cyan]%}⇒%{$reset_color%} '
0 8
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,17 @@
0
+# Based on robbyrussell's theme, with host and rvm indicators. Example:
1
+# @host ➜ currentdir rvm:(rubyversion@gemset) git:(branchname)
2
+
3
+# Get the current ruby version in use with RVM:
4
+if [ -e ~/.rvm/bin/rvm-prompt ]; then
5
+    RUBY_PROMPT_="%{$fg_bold[blue]%}rvm:(%{$fg[green]%}\$(~/.rvm/bin/rvm-prompt s i v g)%{$fg_bold[blue]%})%{$reset_color%} "
6
+fi
7
+
8
+# Get the host name (first 4 chars)
9
+HOST_PROMPT_="%{$fg_bold[red]%}@$HOST[0,4] ➜  %{$fg_bold[cyan]%}%c "
10
+GIT_PROMPT="%{$fg_bold[blue]%}\$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}"
11
+PROMPT="$HOST_PROMPT_$RUBY_PROMPT_$GIT_PROMPT"
12
+
13
+ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
14
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
15
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
16
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
0 17
new file mode 100644
... ...
@@ -0,0 +1,11 @@
0
+if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
1
+
2
+local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
3
+
4
+PROMPT='%{$fg[green]%}[%*]%{$reset_color%} %{$fg_no_bold[cyan]%}%n %{${fg_bold[blue]}%}::%{$reset_color%} %{$fg[yellow]%}%m%{$reset_color%} %{$fg_no_bold[magenta]%} ➜ %{$reset_color%} %{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} '
5
+
6
+RPS1="${return_code}"
7
+
8
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹"
9
+ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
10
+
... ...
@@ -7,8 +7,8 @@ RPROMPT='[%*]'
7 7
 ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[red]%}%B"
8 8
 ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%} "
9 9
 ZSH_THEME_GIT_PROMPT_CLEAN=""
10
-ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}"
10
+ZSH_THEME_GIT_PROMPT_DIRTY="*"
11 11
 
12 12
 # LS colors, made with http://geoff.greer.fm/lscolors/
13 13
 export LSCOLORS="Gxfxcxdxbxegedabagacad"
14
-export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:'
14
+export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:*.patch=00;34:*.o=00;32:*.so=01;35:*.ko=01;31:*.la=00;33'
15 15
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi
1
+
2
+local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})"
3
+
4
+PROMPT='
5
+%{$fg_bold[cyan]%}%n%{$reset_color%}%{$fg[yellow]%}@%{$reset_color%}%{$fg_bold[blue]%}%m%{$reset_color%}:%{${fg_bold[green]}%}%~%{$reset_color%}$(git_prompt_info)
6
+%{${fg[$CARETCOLOR]}%}%# %{${reset_color}%}'
7
+
8
+RPS1='${return_code} %D - %*'
9
+
10
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[magenta]%}^%{$reset_color%}%{$fg_bold[yellow]%}"
11
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
12
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} ±"
13
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ?"
14
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[red]%} ♥"
0 15
new file mode 100644
... ...
@@ -0,0 +1,6 @@
0
+PROMPT='%{$fg[green]%}%~%{$fg_bold[blue]%}$(git_prompt_info)%{$reset_color%} '
1
+
2
+ZSH_THEME_GIT_PROMPT_PREFIX="("
3
+ZSH_THEME_GIT_PROMPT_SUFFIX=")"
4
+ZSH_THEME_GIT_PROMPT_DIRTY=" ✗"
5
+ZSH_THEME_GIT_PROMPT_CLEAN=" ✔"
0 6
new file mode 100644
... ...
@@ -0,0 +1,91 @@
0
+# -----------------------------------------------------------------------------
1
+#          FILE: smt.zsh-theme
2
+#   DESCRIPTION: oh-my-zsh theme file, based on dogenpunk by Matthew Nelson.
3
+#        AUTHOR: Stephen Tudor (stephen@tudorstudio.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
+ZSH_THEME_GIT_PROMPT_PREFIX="|"
12
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
13
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}⚡%{$reset_color%}"
14
+ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[red]%}!%{$reset_color%}"
15
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓%{$reset_color%}"
16
+
17
+ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚"
18
+ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹"
19
+ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖"
20
+ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜"
21
+ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
22
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
23
+
24
+# Format for git_prompt_long_sha() and git_prompt_short_sha()
25
+ZSH_THEME_GIT_PROMPT_SHA_BEFORE="➤ %{$fg_bold[yellow]%}"
26
+ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}"
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
+}
85
+
86
+PROMPT='
87
+%{$fg[blue]%}%m%{$reset_color%} 福 %{$fg[cyan]%}%~ %{$reset_color%}$(git_prompt_short_sha)$(git_prompt_info)
88
+%{$fg[red]%}%!%{$reset_color%} $(prompt_char) : '
89
+
90
+RPROMPT='${return_status}$(git_time_since_commit)$(git_prompt_status)%{$reset_color%}'
0 91
new file mode 100644
... ...
@@ -0,0 +1,100 @@
0
+# prompt style and colors based on Steve Losh's Prose theme:
1
+# http://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme
2
+#
3
+# vcs_info modifications from Bart Trojanowski's zsh prompt:
4
+# http://www.jukie.net/bart/blog/pimping-out-zsh-prompt
5
+#
6
+# git untracked files modification from Brian Carper:
7
+# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt
8
+
9
+function virtualenv_info {
10
+    [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
11
+}
12
+PR_GIT_UPDATE=1
13
+
14
+setopt prompt_subst
15
+autoload colors
16
+colors
17
+
18
+autoload -U add-zsh-hook
19
+autoload -Uz vcs_info
20
+
21
+#use extended color pallete if available
22
+if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
23
+    turquoise="%F{81}"
24
+    orange="%F{166}"
25
+    purple="%F{135}"
26
+    hotpink="%F{161}"
27
+    limegreen="%F{118}"
28
+else
29
+    turquoise="$fg[cyan]"
30
+    orange="$fg[yellow]"
31
+    purple="$fg[magenta]"
32
+    hotpink="$fg[red]"
33
+    limegreen="$fg[green]"
34
+fi
35
+
36
+# enable VCS systems you use
37
+zstyle ':vcs_info:*' enable git svn
38
+
39
+# check-for-changes can be really slow.
40
+# you should disable it, if you work with large repositories
41
+zstyle ':vcs_info:*:prompt:*' check-for-changes true
42
+
43
+# set formats
44
+# %b - branchname
45
+# %u - unstagedstr (see below)
46
+# %c - stagedstr (see below)
47
+# %a - action (e.g. rebase-i)
48
+# %R - repository path
49
+# %S - path in the repository
50
+PR_RST="%{${reset_color}%}"
51
+FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})"
52
+FMT_ACTION="(%{$limegreen%}%a${PR_RST})"
53
+FMT_UNSTAGED="%{$orange%}●"
54
+FMT_STAGED="%{$limegreen%}●"
55
+
56
+zstyle ':vcs_info:*:prompt:*' unstagedstr   "${FMT_UNSTAGED}"
57
+zstyle ':vcs_info:*:prompt:*' stagedstr     "${FMT_STAGED}"
58
+zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}"
59
+zstyle ':vcs_info:*:prompt:*' formats       "${FMT_BRANCH}"
60
+zstyle ':vcs_info:*:prompt:*' nvcsformats   ""
61
+
62
+
63
+function steeef_preexec {
64
+    case "$(history $HISTCMD)" in
65
+        *git*)
66
+            PR_GIT_UPDATE=1
67
+            ;;
68
+        *svn*)
69
+            PR_GIT_UPDATE=1
70
+            ;;
71
+    esac
72
+}
73
+add-zsh-hook preexec steeef_preexec
74
+
75
+function steeef_chpwd {
76
+    PR_GIT_UPDATE=1
77
+}
78
+add-zsh-hook chpwd steeef_chpwd
79
+
80
+function steeef_precmd {
81
+    if [[ -n "$PR_GIT_UPDATE" ]] ; then
82
+        # check for untracked files or updated submodules, since vcs_info doesn't
83
+        if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
84
+            PR_GIT_UPDATE=1
85
+            FMT_BRANCH="(%{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST})"
86
+        else
87
+            FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})"
88
+        fi
89
+        zstyle ':vcs_info:*:prompt:*' formats       "${FMT_BRANCH}"
90
+
91
+        vcs_info 'prompt'
92
+        PR_GIT_UPDATE=
93
+    fi
94
+}
95
+add-zsh-hook precmd steeef_precmd
96
+
97
+PROMPT=$'
98
+%{$purple%}%n%{$reset_color%} at %{$orange%}%m%{$reset_color%} in %{$limegreen%}%~%{$reset_color%} $vcs_info_msg_0_
99
+$(virtualenv_info)$ '
0 100
new file mode 100644
... ...
@@ -0,0 +1,26 @@
0
+# Git-centric variation of the "fishy" theme.
1
+# See screenshot at http://ompldr.org/vOHcwZg
2
+
3
+ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}+"
4
+ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[magenta]%}!"
5
+ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}-"
6
+ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}>"
7
+ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}#"
8
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[yellow]%}?"
9
+
10
+ZSH_THEME_GIT_PROMPT_PREFIX=""
11
+ZSH_THEME_GIT_PROMPT_SUFFIX=" "
12
+ZSH_THEME_GIT_PROMPT_DIRTY=""
13
+ZSH_THEME_GIT_PROMPT_CLEAN=""
14
+
15
+local user_color='green'
16
+test $UID -eq 0 && user_color='red'
17
+
18
+PROMPT='%(?..%{$fg_bold[red]%}exit %?
19
+%{$reset_color%})'\
20
+'%{$bold_color%}$(git_prompt_status)%{$reset_color%}'\
21
+'$(git_prompt_info)'\
22
+'%{$fg[$user_color]%}%~%{$reset_color%}'\
23
+'%(!.#.>) '
24
+
25
+PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
0 26
new file mode 100644
... ...
@@ -0,0 +1,96 @@
0
+#-------------------------------------------------------------------------------
1
+# Sunrise theme for oh-my-zsh by Adam Lindberg (eproxus@gmail.com)
2
+# Intended to be used with Solarized: http://ethanschoonover.com/solarized
3
+# (Needs Git plugin for current_branch method)
4
+#-------------------------------------------------------------------------------
5
+
6
+# Color shortcuts
7
+R=$fg[red]
8
+G=$fg[green]
9
+M=$fg[magenta]
10
+RB=$fg_bold[red]
11
+YB=$fg_bold[yellow]
12
+BB=$fg_bold[blue]
13
+RESET=$reset_color
14
+
15
+if [ "$(whoami)" = "root" ]; then
16
+    PROMPTCOLOR="%{$RB%}" PREFIX="-!-";
17
+else
18
+    PROMPTCOLOR="" PREFIX="---";
19
+fi
20
+
21
+local return_code="%(?..%{$R%}%? ↵%{$RESET%})"
22
+
23
+# Get the status of the working tree (copied and modified from git.zsh)
24
+custom_git_prompt_status() {
25
+  INDEX=$(git status --porcelain 2> /dev/null)
26
+  STATUS=""
27
+  # Non-staged
28
+  if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then
29
+    STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
30
+  fi
31
+  if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
32
+    STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
33
+  fi
34
+  if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
35
+    STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
36
+  fi
37
+  if $(echo "$INDEX" | grep '^.M ' &> /dev/null); then
38
+    STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
39
+  elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then
40
+    STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
41
+  elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then
42
+    STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
43
+  fi
44
+  # Staged
45
+  if $(echo "$INDEX" | grep '^D  ' &> /dev/null); then
46
+    STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_DELETED$STATUS"
47
+  fi
48
+  if $(echo "$INDEX" | grep '^R' &> /dev/null); then
49
+    STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_RENAMED$STATUS"
50
+  fi
51
+  if $(echo "$INDEX" | grep '^M' &> /dev/null); then
52
+    STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_MODIFIED$STATUS"
53
+  fi
54
+  if $(echo "$INDEX" | grep '^A' &> /dev/null); then
55
+    STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_ADDED$STATUS"
56
+  fi
57
+
58
+  if $(echo -n "$STATUS" | grep '.*' &> /dev/null); then
59
+    STATUS="$ZSH_THEME_GIT_STATUS_PREFIX$STATUS"
60
+  fi
61
+
62
+  echo $STATUS
63
+}
64
+
65
+# get the name of the branch we are on (copied and modified from git.zsh)
66
+function custom_git_prompt() {
67
+  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
68
+  echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$(git_prompt_ahead)$(custom_git_prompt_status)$ZSH_THEME_GIT_PROMPT_SUFFIX"
69
+}
70
+
71
+# %B sets bold text
72
+PROMPT='%B$PREFIX %2~ $(custom_git_prompt)%{$M%}%B»%b%{$RESET%} '
73
+RPS1="${return_code}"
74
+
75
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$YB%}‹"
76
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$YB%}›%{$RESET%} "
77
+
78
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$R%}*"
79
+ZSH_THEME_GIT_PROMPT_CLEAN=""
80
+
81
+ZSH_THEME_GIT_PROMPT_AHEAD="%{$BB%}➔"
82
+
83
+ZSH_THEME_GIT_STATUS_PREFIX=" "
84
+
85
+# Staged
86
+ZSH_THEME_GIT_PROMPT_STAGED_ADDED="%{$G%}A"
87
+ZSH_THEME_GIT_PROMPT_STAGED_MODIFIED="%{$G%}M"
88
+ZSH_THEME_GIT_PROMPT_STAGED_RENAMED="%{$G%}R"
89
+ZSH_THEME_GIT_PROMPT_STAGED_DELETED="%{$G%}D"
90
+
91
+# Not-staged
92
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$R%}⁇"
93
+ZSH_THEME_GIT_PROMPT_MODIFIED="%{$R%}M"
94
+ZSH_THEME_GIT_PROMPT_DELETED="%{$R%}D"
95
+ZSH_THEME_GIT_PROMPT_UNMERGED="%{$R%}UU"
0 96
new file mode 100644
... ...
@@ -0,0 +1,18 @@
0
+# Grab the current version of ruby in use (via RVM): [ruby-1.8.7]
1
+JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
2
+
3
+# Grab the current filepath, use shortcuts: ~/Desktop
4
+# Append the current git branch, if in a git repository
5
+JARIN_CURRENT_LOCA_="%{$fg_bold[cyan]%}%~\$(git_prompt_info)%{$reset_color%}"
6
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%} <%{$fg[magenta]%}"
7
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
8
+
9
+# Do nothing if the branch is clean (no changes).
10
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%}>"
11
+
12
+# Add a yellow ✗ if the branch is dirty
13
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$reset_color%}> %{$fg[yellow]%}✗"
14
+
15
+# Put it all together!
16
+PROMPT="$JARIN_CURRENT_RUBY_ $JARIN_CURRENT_LOCA_ "
17
+
0 18
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+PROMPT='%{$fg[green]%} %% '
1
+# RPS1='%{$fg[blue]%}%~%{$reset_color%} '
2
+RPS1='%{$fg[white]%}%2~$(git_prompt_info) %{$fg_bold[blue]%}%m%{$reset_color%}'
3
+
4
+ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[yellow]%}"
5
+ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}"
6
+ZSH_THEME_GIT_PROMPT_CLEAN=""
7
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} ⚡%{$fg[yellow]%}"
8
+
0 9
deleted file mode 100644
... ...
@@ -1,29 +0,0 @@
1
-function prompt_char {
2
-    git branch >/dev/null 2>/dev/null && echo '±' && return
3
-    hg root >/dev/null 2>/dev/null && echo '☿' && return
4
-    echo '○'
5
-}
6
-
7
-function virtualenv_info {
8
-    [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
9
-}
10
-
11
-function hg_prompt_info {
12
-    hg prompt --angle-brackets "\
13
-< on %{$fg[magenta]%}<branch>%{$reset_color%}>\
14
-< at %{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\
15
-%{$fg[green]%}<status|modified|unknown><update>%{$reset_color%}<
16
-patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset_color%})|pre_unapplied(%{$fg_bold[black]%})|post_unapplied(%{$reset_color%})>>" 2>/dev/null
17
-}
18
-
19
-PROMPT='
20
-%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)
21
-$(virtualenv_info)$(prompt_char) '
22
-
23
-ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}"
24
-ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
25
-ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!"
26
-ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?"
27
-ZSH_THEME_GIT_PROMPT_CLEAN=""
28
-
29
-. ~/bin/dotfiles/zsh/aliases
30 1
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:
0 95
new file mode 100644
... ...
@@ -0,0 +1,107 @@
0
+# On a mac with snow leopard, for nicer terminal colours:
1
+
2
+# - Install SIMBL: http://www.culater.net/software/SIMBL/SIMBL.php
3
+# - Download'Terminal-Colours': http://bwaht.net/code/TerminalColours.bundle.zip
4
+# - Place that bundle in ~/Library/Application\ Support/SIMBL/Plugins (create that folder if it doesn't exist)
5
+# - Open Terminal preferences. Go to Settings -> Text -> More
6
+# - Change default colours to your liking.
7
+# 
8
+# Here are the colours from Textmate's Monokai theme:
9
+# 
10
+# Black: 0, 0, 0
11
+# Red: 229, 34, 34
12
+# Green: 166, 227, 45
13
+# Yellow: 252, 149, 30
14
+# Blue: 196, 141, 255
15
+# Magenta: 250, 37, 115
16
+# Cyan: 103, 217, 240
17
+# White: 242, 242, 242
18
+
19
+# Thanks to Steve Losh: http://stevelosh.com/blog/2009/03/candy-colored-terminal/
20
+
21
+# The prompt
22
+
23
+PROMPT='%{$fg[magenta]%}[%c] %{$reset_color%}'
24
+
25
+# The right-hand prompt
26
+
27
+RPROMPT='${time} %{$fg[magenta]%}$(git_prompt_info)%{$reset_color%}$(git_prompt_status)%{$reset_color%}'
28
+
29
+# Add this at the start of RPROMPT to include rvm info showing ruby-version@gemset-name
30
+# %{$fg[yellow]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%} 
31
+
32
+# local time, color coded by last return code
33
+time_enabled="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}"
34
+time_disabled="%{$fg[green]%}%*%{$reset_color%}"
35
+time=$time_enabled
36
+
37
+ZSH_THEME_GIT_PROMPT_PREFIX=" ☁  %{$fg[red]%}"
38
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
39
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%} ☂" # Ⓓ
40
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" # ⓣ
41
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ☀" # Ⓞ
42
+
43
+ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✚" # ⓐ ⑃
44
+ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ⚡"  # ⓜ ⑁
45
+ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" # ⓧ ⑂
46
+ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➜" # ⓡ ⑄
47
+ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ♒" # ⓤ ⑊
48
+
49
+# More symbols to choose from:
50
+# ☀ ✹ ☄ ♆ ♀ ♁ ♐ ♇ ♈ ♉ ♚ ♛ ♜ ♝ ♞ ♟ ♠ ♣ ⚢ ⚲ ⚳ ⚴ ⚥ ⚤ ⚦ ⚒ ⚑ ⚐ ♺ ♻ ♼ ☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷
51
+# ✡ ✔ ✖ ✚ ✱ ✤ ✦ ❤ ➜ ➟ ➼ ✂ ✎ ✐ ⨀ ⨁ ⨂ ⨍ ⨎ ⨏ ⨷ ⩚ ⩛ ⩡ ⩱ ⩲ ⩵  ⩶ ⨠ 
52
+# ⬅ ⬆ ⬇ ⬈ ⬉ ⬊ ⬋ ⬒ ⬓ ⬔ ⬕ ⬖ ⬗ ⬘ ⬙ ⬟  ⬤ 〒 ǀ ǁ ǂ ĭ Ť Ŧ
53
+
54
+# Determine if we are using a gemset.
55
+function rvm_gemset() {
56
+    GEMSET=`rvm gemset list | grep '=>' | cut -b4-`
57
+    if [[ -n $GEMSET ]]; then
58
+        echo "%{$fg[yellow]%}$GEMSET%{$reset_color%}|"
59
+    fi 
60
+}
61
+
62
+# Determine the time since last commit. If branch is clean,
63
+# use a neutral color, otherwise colors will vary according to time.
64
+function git_time_since_commit() {
65
+    if git rev-parse --git-dir > /dev/null 2>&1; then
66
+        # Only proceed if there is actually a commit.
67
+        if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then
68
+            # Get the last commit.
69
+            last_commit=`git log --pretty=format:'%at' -1 2> /dev/null`
70
+            now=`date +%s`
71
+            seconds_since_last_commit=$((now-last_commit))
72
+
73
+            # Totals
74
+            MINUTES=$((seconds_since_last_commit / 60))
75
+            HOURS=$((seconds_since_last_commit/3600))
76
+           
77
+            # Sub-hours and sub-minutes
78
+            DAYS=$((seconds_since_last_commit / 86400))
79
+            SUB_HOURS=$((HOURS % 24))
80
+            SUB_MINUTES=$((MINUTES % 60))
81
+            
82
+            if [[ -n $(git status -s 2> /dev/null) ]]; then
83
+                if [ "$MINUTES" -gt 30 ]; then
84
+                    COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
85
+                elif [ "$MINUTES" -gt 10 ]; then
86
+                    COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM"
87
+                else
88
+                    COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT"
89
+                fi
90
+            else
91
+                COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
92
+            fi
93
+
94
+            if [ "$HOURS" -gt 24 ]; then
95
+                echo "($(rvm_gemset)$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
96
+            elif [ "$MINUTES" -gt 60 ]; then
97
+                echo "($(rvm_gemset)$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
98
+            else
99
+                echo "($(rvm_gemset)$COLOR${MINUTES}m%{$reset_color%}|"
100
+            fi
101
+        else
102
+            COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
103
+            echo "($(rvm_gemset)$COLOR~|"
104
+        fi
105
+    fi
106
+}
0 107
\ No newline at end of file
... ...
@@ -1,36 +1,36 @@
1 1
 if [ -d ~/.oh-my-zsh ]
2 2
 then
3
-  echo "You already have Oh My Zsh installed. You'll need to remove ~/.oh-my-zsh if you want to install"
3
+  echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove ~/.oh-my-zsh if you want to install"
4 4
   exit
5 5
 fi
6 6
 
7
-echo "Cloning Oh My Zsh..."
7
+echo "\033[0;34mCloning Oh My Zsh...\033[0m"
8 8
 /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
9 9
 
10
-echo "Looking for an existing zsh config..."
10
+echo "\033[0;34mLooking for an existing zsh config...\033[0m"
11 11
 if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]
12 12
 then
13
-  echo "Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh";
13
+  echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32]Backing up to ~/.zshrc.pre-oh-my-zsh\033[0m";
14 14
   cp ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
15 15
   rm ~/.zshrc;
16 16
 fi
17 17
 
18
-echo "Using the Oh My Zsh template file and adding it to ~/.zshrc"
18
+echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m"
19 19
 cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
20 20
 
21
-echo "Copying your current PATH and adding it to the end of ~/.zshrc for you."
21
+echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"
22 22
 echo "export PATH=$PATH" >> ~/.zshrc
23 23
 
24
-echo "Time to change your default shell to zsh!"
24
+echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
25 25
 chsh -s `which zsh`
26 26
 
27
-echo '         __                                     __  '
28
-echo '  ____  / /_     ____ ___  __  __   ____  _____/ /_ '
29
-echo ' / __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \ '
30
-echo '/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / / '
31
-echo '\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/  '
32
-echo '                        /____/'
27
+echo "\033[0;32m"'         __                                     __   '"\033[0m"
28
+echo "\033[0;32m"'  ____  / /_     ____ ___  __  __   ____  _____/ /_  '"\033[0m"
29
+echo "\033[0;32m"' / __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \ '"\033[0m"
30
+echo "\033[0;32m"'/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / / '"\033[0m"
31
+echo "\033[0;32m"'\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/  '"\033[0m"
32
+echo "\033[0;32m"'                        /____/                       '"\033[0m"
33 33
 
34
-echo "\n\n ....is now installed."
34
+echo "\n\n \033[0;32m....is now installed.\033[0m"
35 35
 /usr/bin/env zsh
36 36
 source ~/.zshrc
... ...
@@ -1,12 +1,12 @@
1 1
 current_path=`pwd`
2
-echo "Upgrading Oh My Zsh"
2
+echo -e "\033[0;34mUpgrading Oh My Zsh\033[0m"
3 3
 ( cd $ZSH && git pull origin master )
4
-echo '         __                                     __  '
5
-echo '  ____  / /_     ____ ___  __  __   ____  _____/ /_ '
6
-echo ' / __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \ '
7
-echo '/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / / '
8
-echo '\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/  '
9
-echo '                        /____/'
10
-echo "Hooray! Oh My Zsh has been updated and/or is at the current version. \nAny new updates will be reflected when you start your next terminal session."
11
-echo "To keep up on the latest, be sure to follow Oh My Zsh on twitter: http://twitter.com/ohmyzsh"
12
-cd $current_path
13 4
\ No newline at end of file
5
+echo -e "\033[0;32m"'         __                                     __   '"\033[0m"
6
+echo -e "\033[0;32m"'  ____  / /_     ____ ___  __  __   ____  _____/ /_  '"\033[0m"
7
+echo -e "\033[0;32m"' / __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \ '"\033[0m"
8
+echo -e "\033[0;32m"'/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / / '"\033[0m"
9
+echo -e "\033[0;32m"'\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/  '"\033[0m"
10
+echo -e "\033[0;32m"'                        /____/                       '"\033[0m"
11
+echo -e "\033[0;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m"
12
+echo -e "\033[0;34mTo keep up on the latest, be sure to follow Oh My Zsh on twitter: \033[1mhttp://twitter.com/ohmyzsh\033[0m"
13
+cd "$current_path"