Browse code

Merge remote-tracking branch 'main/master'

Nicolas Viennot authored on 12/10/2011 at 03:46:45
Showing 73 changed files
... ...
@@ -5,3 +5,4 @@ custom/*
5 5
 !custom/example
6 6
 !custom/example.zsh
7 7
 cache
8
+*.swp
... ...
@@ -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 x $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
-
... ...
@@ -57,7 +57,9 @@ git_prompt_status() {
57 57
   if $(echo "$INDEX" | grep '^R  ' &> /dev/null); then
58 58
     STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS"
59 59
   fi
60
-  if $(echo "$INDEX" | grep '^D ' &> /dev/null); then
60
+  if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
61
+    STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
62
+  elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then
61 63
     STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
62 64
   fi
63 65
   if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
... ...
@@ -14,13 +14,19 @@ 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
 
23 28
 # Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~
29
+bindkey '^?' backward-delete-char
24 30
 bindkey "^[[3~" delete-char
25 31
 bindkey "^[3;5~" delete-char
26 32
 bindkey "\e[3~" delete-char
... ...
@@ -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,7 @@
1 1
 # Check for updates on initial load...
2 2
 if [ "$DISABLE_AUTO_UPDATE" != "true" ]
3 3
 then
4
-  /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh
4
+  /usr/bin/env ZSH=$ZSH zsh $ZSH/tools/check_for_upgrade.sh
5 5
 fi
6 6
 
7 7
 # Initializes Oh My Zsh
... ...
@@ -21,17 +21,24 @@ for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath)
21 21
 autoload -U compinit
22 22
 compinit -i
23 23
 
24
+# Set ZSH_CUSTOM to the path where your custom config files
25
+# and plugins exists, or else we will use the default custom/
26
+if [ "$ZSH_CUSTOM" = ""  ]
27
+then
28
+    ZSH_CUSTOM="$ZSH/custom"
29
+fi
30
+
24 31
 # Load all of the plugins that were defined in ~/.zshrc
25 32
 for plugin ($plugins); do
26
-  if [ -f $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh ]; then
27
-    source $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh
33
+  if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then
34
+    source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh
28 35
   elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
29 36
     source $ZSH/plugins/$plugin/$plugin.plugin.zsh
30 37
   fi
31 38
 done
32 39
 
33 40
 # Load all of your custom configurations from custom/
34
-for config_file ($ZSH/custom/*.zsh) source $config_file
41
+for config_file ($ZSH_CUSTOM/*.zsh) source $config_file
35 42
 
36 43
 # Load the theme
37 44
 if [ "$ZSH_THEME" = "random" ]
... ...
@@ -43,6 +50,9 @@ then
43 43
   source "$RANDOM_THEME"
44 44
   echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
45 45
 else
46
-  source "$ZSH/themes/$ZSH_THEME.zsh-theme"
46
+  if [ ! "$ZSH_THEME" = ""  ]
47
+  then
48
+    source "$ZSH/themes/$ZSH_THEME.zsh-theme"
49
+  fi
47 50
 fi
48 51
 
49 52
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,82 @@
0
+#compdef bundle
1
+
2
+local curcontext="$curcontext" state line _gems _opts ret=1
3
+
4
+_arguments -C -A "-v" -A "--version" \
5
+	'(- 1 *)'{-v,--version}'[display version information]' \
6
+	'1: :->cmds' \
7
+	'*:: :->args' && ret=0
8
+
9
+case $state in
10
+	cmds)
11
+		_values "bundle command" \
12
+			"install[Install the gems specified by the Gemfile or Gemfile.lock]" \
13
+			"update[Update dependencies to their latest versions]" \
14
+			"package[Package the .gem files required by your application]" \
15
+			"exec[Execute a script in the context of the current bundle]" \
16
+			"config[Specify and read configuration options for bundler]" \
17
+			"check[Determine whether the requirements for your application are installed]" \
18
+			"list[Show all of the gems in the current bundle]" \
19
+			"show[Show the source location of a particular gem in the bundle]" \
20
+			"console[Start an IRB session in the context of the current bundle]" \
21
+			"open[Open an installed gem in the editor]" \
22
+			"viz[Generate a visual representation of your dependencies]" \
23
+			"init[Generate a simple Gemfile, placed in the current directory]" \
24
+			"gem[Create a simple gem, suitable for development with bundler]" \
25
+			"help[Describe available tasks or one specific task]"
26
+		ret=0
27
+		;;
28
+	args)
29
+		case $line[1] in
30
+			help)
31
+				_values 'commands' \
32
+                    'install' \
33
+                    'update' \
34
+                    'package' \
35
+                    'exec' \
36
+                    'config' \
37
+                    'check' \
38
+                    'list' \
39
+                    'show' \
40
+                    'console' \
41
+                    'open' \
42
+                    'viz' \
43
+                    'init' \
44
+                    'gem' \
45
+                    'help' && ret=0
46
+				;;
47
+			install)
48
+				_arguments \
49
+					'(--no-color)--no-color[disable colorization in output]' \
50
+					'(--local)--local[do not attempt to connect to rubygems.org]' \
51
+					'(--quiet)--quiet[only output warnings and errors]' \
52
+					'(--gemfile)--gemfile=-[use the specified gemfile instead of Gemfile]:gemfile' \
53
+					'(--system)--system[install to the system location]' \
54
+					'(--deployment)--deployment[install using defaults tuned for deployment environments]' \
55
+					'(--frozen)--frozen[do not allow the Gemfile.lock to be updated after this install]' \
56
+					'(--path)--path=-[specify a different path than the system default]:path:_files' \
57
+					'(--binstubs)--binstubs=-[generate bin stubs for bundled gems to ./bin]:directory:_files' \
58
+					'(--without)--without=-[exclude gems that are part of the specified named group]:groups'
59
+				ret=0
60
+				;;
61
+			exec)
62
+				_normal && ret=0
63
+				;;
64
+			(open|show)
65
+				_gems=( $(bundle show 2> /dev/null | sed -e '/^  \*/!d; s/^  \* \([^ ]*\) .*/\1/') )
66
+				if [[ $_gems != "" ]]; then
67
+					_values 'gems' $_gems && ret=0
68
+				fi
69
+				;;
70
+			*)
71
+				_opts=(  $(bundle help $line[1] | sed -e '/^  \[-/!d; s/^  \[\(-[^=]*\)=.*/\1/') )
72
+				_opts+=( $(bundle help $line[1] | sed -e '/^  -/!d; s/^  \(-.\), \[\(-[^=]*\)=.*/\1 \2/') )
73
+				if [[ $_opts != "" ]]; then
74
+					_values 'options' $_opts && ret=0
75
+				fi
76
+				;;
77
+		esac
78
+		;;
79
+esac
80
+
81
+return ret
... ...
@@ -1,3 +1,46 @@
1
+fpath=($ZSH/plugins/bundler $fpath)
2
+autoload -U compinit
3
+compinit -i
4
+
1 5
 alias be="bundle exec"
2 6
 alias bi="bundle install"
7
+alias bl="bundle list"
8
+alias bp="bundle package"
3 9
 alias bu="bundle update"
10
+
11
+# The following is based on https://github.com/gma/bundler-exec
12
+
13
+bundled_commands=(cap capify cucumber foreman guard heroku nanoc rackup rails rainbows rake rspec ruby shotgun spec spork thin unicorn unicorn_rails)
14
+
15
+## Functions
16
+
17
+_bundler-installed() {
18
+  which bundle > /dev/null 2>&1
19
+}
20
+
21
+_within-bundled-project() {
22
+  local check_dir=$PWD
23
+  while [ "$(dirname $check_dir)" != "/" ]; do
24
+    [ -f "$check_dir/Gemfile" ] && return
25
+    check_dir="$(dirname $check_dir)"
26
+  done
27
+  false
28
+}
29
+
30
+_run-with-bundler() {
31
+  if _bundler-installed && _within-bundled-project; then
32
+    bundle exec $@
33
+  else
34
+    $@
35
+  fi
36
+}
37
+
38
+## Main program
39
+for cmd in $bundled_commands; do
40
+  eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}"
41
+  alias $cmd=bundled_$cmd
42
+
43
+  if which _$cmd > /dev/null 2>&1; then
44
+        compdef _$cmd bundled_$cmd
45
+  fi
46
+done
4 47
new file mode 100644
... ...
@@ -0,0 +1,36 @@
0
+# Set this to 1 if you want to cache the tasks
1
+_cake_cache_task_list=1
2
+
3
+# Cache filename
4
+_cake_task_cache_file='.cake_task_cache'
5
+
6
+_cake_get_target_list () {
7
+	cake | grep '^cake ' | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$'
8
+}
9
+
10
+_cake_does_target_list_need_generating () {
11
+
12
+	if [ ${_cake_cache_task_list} -eq 0 ]; then
13
+		return 1;
14
+	fi
15
+
16
+	if [ ! -f ${_cake_task_cache_file} ]; then return 0;
17
+	else
18
+		accurate=$(stat -f%m $_cake_task_cache_file)
19
+		changed=$(stat -f%m Cakefile)
20
+		return $(expr $accurate '>=' $changed)
21
+	fi
22
+}
23
+
24
+_cake () {
25
+	if [ -f Cakefile ]; then
26
+		if _cake_does_target_list_need_generating; then
27
+			_cake_get_target_list > ${_cake_task_cache_file}
28
+			compadd `cat ${_cake_task_cache_file}`
29
+		else
30
+			compadd `_cake_get_target_list`
31
+		fi
32
+	fi
33
+}
34
+
35
+compdef _cake cake
0 36
\ No newline at end of file
1 37
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
deleted file mode 100644
... ...
@@ -1,13 +0,0 @@
1
-# Aliases
2
-alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \
3
-		--no-gui --disable-columns search"	# search package
4
-alias ad="sudo apt-get update"				# update packages lists
5
-alias au="sudo apt-get update && \
6
-		sudo apt-get dselect-upgrade"		# upgrade packages
7
-alias ai="sudo apt-get install"				# install package
8
-alias ar="sudo apt-get remove --purge && \
9
-		sudo apt-get autoremove --purge"	# remove package
10
-alias ap="apt-cache policy"				# apt policy
11
-alias av="apt-cache show"				# show package info
12
-alias acs="apt-cache search"                            # search package
13
-alias ac="sudo apt-get clean && sudo apt-get autoclean" # clean apt cache
... ...
@@ -1,53 +1,143 @@
1
-# https://github.com/dbbolton/
1
+# Authors:
2
+# https://github.com/AlexBio
3
+# https://github.com/dbb
2 4
 #
3 5
 # Debian-related zsh aliases and functions for zsh
4 6
 
7
+# Use aptitude if installed, or apt-get if not.
8
+# You can just set apt_pref='apt-get' to override it.
9
+if [[ -e $( which aptitude ) ]]; then
10
+    apt_pref='aptitude'
11
+else
12
+    apt_pref='apt-get'
13
+fi
14
+
15
+# Use sudo by default if it's installed
16
+if [[ -e $( which sudo ) ]]; then
17
+    use_sudo=1
18
+fi
5 19
 
6 20
 # Aliases ###################################################################
21
+# These are for more obscure uses of apt-get and aptitude that aren't covered
22
+# below.
23
+alias ag='apt-get'
24
+alias at='aptitude'
7 25
 
8 26
 # Some self-explanatory aliases
9
-alias afs='apt-file search --regexp'
27
+alias acs="apt-cache search"
10 28
 alias aps='aptitude search'
11
-alias apsrc='apt-get source'
12
-alias apv='apt-cache policy'
29
+alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \
30
+		--no-gui --disable-columns search"	# search package
13 31
 
14
-alias apdg='su -c "aptitude update && aptitude safe-upgrade"'
15
-alias apud='su -c "aptitude update"'
16
-alias apug='su -c "aptitude safe-upgrade"'
32
+# apt-file
33
+alias afs='apt-file search --regexp'
17 34
 
35
+
36
+# These are apt-get only
37
+alias asrc='apt-get source'
38
+alias ap='apt-cache policy'
39
+
40
+# superuser operations ######################################################
41
+if [[ $use_sudo -eq 1 ]]; then
42
+# commands using sudo #######
43
+    alias aac="sudo $apt_pref autoclean"
44
+    alias abd="sudo $apt_pref build-dep"
45
+    alias ac="sudo $apt_pref clean"
46
+    alias ad="sudo $apt_pref update"
47
+    alias adg="sudo $apt_pref update && sudo $apt_pref upgrade"
48
+    alias adu="sudo $apt_pref update && sudo $apt_pref dist-upgrade"
49
+    alias afu='sudo apt-file update'
50
+    alias ag="sudo $apt_pref upgrade"
51
+    alias ai="sudo $apt_pref install"
52
+    alias ap="sudo $apt_pref purge"
53
+    alias ar="sudo $apt_pref remove"
54
+
55
+    # apt-get only
56
+    alias ads="sudo $apt_pref dselect-upgrade"
57
+    
58
+    # Install all .deb files in the current directory.
59
+    # Warning: you will need to put the glob in single quotes if you use:
60
+    # glob_subst
61
+    alias di='sudo dpkg -i ./*.deb'
62
+
63
+    # Remove ALL kernel images and headers EXCEPT the one in use
64
+    alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \
65
+        ?not(~n`uname -r`))'
66
+
67
+
68
+# commands using su #########
69
+else
70
+    alias aac='su -ls "'"$apt_pref"' autoclean" root'
71
+    abd() {
72
+        cmd="su -lc '$apt_pref build-dep $@' root"
73
+        print "$cmd"
74
+        eval "$cmd"
75
+    }
76
+    alias ac='su -ls "'"$apt_pref"' clean" root'
77
+    alias ad='su -lc "'"$apt_pref"' update" root'
78
+    alias adg='su -lc "'"$apt_pref"' update && aptitude safe-upgrade" root'
79
+    alias adu='su -lc "'"$apt_pref"' update && aptitude dist-upgrade" root'
80
+    alias afu='su -lc "apt-file update"'
81
+    alias ag='su -lc "'"$apt_pref"' safe-upgrade" root'
82
+    ai() {
83
+        cmd="su -lc 'aptitude -P install $@' root"
84
+        print "$cmd"
85
+        eval "$cmd"
86
+    }
87
+    ap() {
88
+        cmd="su -lc '$apt_pref -P purge $@' root"
89
+        print "$cmd"
90
+        eval "$cmd"
91
+    }
92
+    ar() {
93
+        cmd="su -lc '$apt_pref -P remove $@' root"
94
+        print "$cmd"
95
+        eval "$cmd"
96
+    }
97
+
98
+    # Install all .deb files in the current directory
99
+    # Assumes glob_subst is off
100
+    alias di='su -lc "dpkg -i ./*.deb" root'
101
+
102
+    # Remove ALL kernel images and headers EXCEPT the one in use
103
+    alias kclean='su -lc '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) \
104
+        ?not(~n`uname -r`))'\'' root'
105
+fi
106
+
107
+
108
+# Misc. #####################################################################
18 109
 # print all installed packages
19 110
 alias allpkgs='aptitude search -F "%p" --disable-columns ~i'
20 111
 
21
-# Install all .deb files in the current directory.
22
-# Warning: you will need to put the glob in single quotes if you use:
23
-# glob_subst
24
-alias di='su -c "dpkg -i ./*.deb"'
25
-
26 112
 # Create a basic .deb package
27 113
 alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
28 114
 
29
-# Remove ALL kernel images and headers EXCEPT the one in use
30
-alias kclean='su -c '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))'\'' root'
31 115
 
32 116
 
33 117
 
34
-# Functions #################################################################
35 118
 
119
+# Functions #################################################################
36 120
 # create a simple script that can be used to 'duplicate' a system
37 121
 apt-copy() {
38
-	print '#!/bin/sh'"\n" > apt-copy.sh
122
+    print '#!/bin/sh'"\n" > apt-copy.sh
39 123
 
40
-	list=$(perl -m'AptPkg::Cache' -e '$c=AptPkg::Cache->new; for (keys %$c){ push @a, $_ if $c->{$_}->{'CurrentState'} eq 'Installed';} print "$_ " for sort @a;')
124
+    cmd="$apt_pref install "
41 125
 
42
-	print 'aptitude install '"$list\n" >> apt-copy.sh
126
+    for p in ${(f)"$(aptitude search -F "%p" --disable-columns \~i)"}; {
127
+        cmd="${cmd} ${p}"
128
+    }
43 129
 
44
-	chmod +x apt-copy.sh
130
+    print $cmd "\n" >> apt-copy.sh
131
+
132
+    chmod +x apt-copy.sh
45 133
 }
46 134
 
47 135
 
48 136
 # Kernel-package building shortcut
49
-dbb-build () {
50
-	MAKEFLAGS=''		# temporarily unset MAKEFLAGS ( '-j3' will fail )
137
+kerndeb () {
138
+    # temporarily unset MAKEFLAGS ( '-j3' will fail )
139
+    MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' )		
140
+    print '$MAKEFLAGS set to '"'$MAKEFLAGS'"
51 141
 	appendage='-custom' # this shows up in $ (uname -r )
52 142
     revision=$(date +"%Y%m%d") # this shows up in the .deb file name
53 143
 
... ...
@@ -57,4 +147,3 @@ dbb-build () {
57 57
         "$revision" kernel_image kernel_headers
58 58
 }
59 59
 
60
-
61 60
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,21 @@ 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
36
+alias gm='git merge'
37
+compdef _git gm=git-merge
30 38
 
31 39
 # Git and svn mix
32 40
 alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
33 41
 compdef git-svn-dcommit-push=git
34 42
 
43
+alias gsr='git svn rebase'
44
+alias gsd='git svn dcommit'
35 45
 #
36 46
 # Will return the current branch name
37 47
 # Usage example: git pull origin $(current_branch)
... ...
@@ -1,6 +1,60 @@
1
-# hub alias from defunkt
2
-# https://github.com/defunkt/hub
3
-if [ "$commands[(I)hub]" ]; then
1
+# Setup hub function for git, if it is available; http://github.com/defunkt/hub
2
+if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then
4 3
     # eval `hub alias -s zsh`
5 4
     function git(){hub "$@"}
6 5
 fi
6
+
7
+# Functions #################################################################
8
+
9
+# https://github.com/dbb 
10
+
11
+
12
+# empty_gh [NAME_OF_REPO]
13
+#
14
+# Use this when creating a new repo from scratch.
15
+empty_gh() { # [NAME_OF_REPO]
16
+    repo = $1
17
+    ghuser=$(  git config github.user )
18
+
19
+    mkdir "$repo"
20
+    cd "$repo"
21
+    git init
22
+    touch README
23
+    git add README
24
+    git commit -m 'Initial commit.'
25
+    git remote add origin git@github.com:${ghuser}/${repo}.git
26
+    git push -u origin master
27
+}
28
+
29
+# new_gh [DIRECTORY]
30
+#
31
+# Use this when you have a directory that is not yet set up for git.
32
+# This function will add all non-hidden files to git.
33
+new_gh() { # [DIRECTORY]
34
+    cd "$1"
35
+    ghuser=$( git config github.user )
36
+
37
+    git init
38
+    # add all non-dot files
39
+    print '.*'"\n"'*~' >> .gitignore
40
+    git add ^.*
41
+    git commit -m 'Initial commit.'
42
+    git remote add origin git@github.com:${ghuser}/${repo}.git
43
+    git push -u origin master
44
+}
45
+
46
+# exist_gh [DIRECTORY]
47
+#
48
+# Use this when you have a git repo that's ready to go and you want to add it
49
+# to your GitHub.
50
+exist_gh() { # [DIRECTORY]
51
+    cd "$1"
52
+    name=$( git config user.name )
53
+    ghuser=$( git config github.user )
54
+
55
+    git remote add origin git@github.com:${ghuser}/${repo}.git
56
+    git push -u origin master
57
+}
58
+
59
+# End Functions #############################################################
60
+
7 61
new file mode 100644
... ...
@@ -0,0 +1,80 @@
0
+# ------------------------------------------------------------------------------
1
+#          FILE:  gnu-utils.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
+
8
+if [[ -x "${commands[gwhoami]}" ]]; then 
9
+  __gnu_utils() {
10
+    emulate -L zsh
11
+    local gcmds
12
+    local gcmd
13
+    local cmd
14
+    local prefix
15
+
16
+    # coreutils 
17
+    gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
18
+    'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
19
+    'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
20
+    'gexpr' 'gfactor' 'gfalse' 'gfmt' 'gfold' 'ggroups' 'ghead' 'ghostid'
21
+    'gid' 'ginstall' 'gjoin' 'gkill' 'glink' 'gln' 'glogname' 'gls' 'gmd5sum'
22
+    'gmkdir' 'gmkfifo' 'gmknod' 'gmktemp' 'gmv' 'gnice' 'gnl' 'gnohup' 'gnproc'
23
+    'god' 'gpaste' 'gpathchk' 'gpinky' 'gpr' 'gprintenv' 'gprintf' 'gptx' 'gpwd'
24
+    'greadlink' 'grm' 'grmdir' 'gruncon' 'gseq' 'gsha1sum' 'gsha224sum'
25
+    'gsha256sum' 'gsha384sum' 'gsha512sum' 'gshred' 'gshuf' 'gsleep' 'gsort'
26
+    'gsplit' 'gstat' 'gstty' 'gsum' 'gsync' 'gtac' 'gtail' 'gtee' 'gtest'
27
+    'gtimeout' 'gtouch' 'gtr' 'gtrue' 'gtruncate' 'gtsort' 'gtty' 'guname'
28
+    'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho'
29
+    'gwhoami' 'gyes')
30
+
31
+    # Not part of coreutils, installed separately.
32
+    gcmds+=('gsed' 'gtar' 'gtime')
33
+
34
+    for gcmd in "${gcmds[@]}"; do
35
+      #
36
+      # This method allows for builtin commands to be primary but it's
37
+      # lost if hash -r or rehash -f is executed. Thus, those two 
38
+      # functions have to be wrapped.
39
+      #
40
+      (( ${+commands[$gcmd]} )) && hash ${gcmd[2,-1]}=${commands[$gcmd]}
41
+
42
+      #
43
+      # This method generates wrapper functions.
44
+      # It will override shell builtins.
45
+      #
46
+      # (( ${+commands[$gcmd]} )) && \
47
+      # eval "function $gcmd[2,-1]() { \"${prefix}/${gcmd//"["/"\\["}\" \"\$@\"; }"
48
+
49
+      #
50
+      # This method is inflexible since the aliases are at risk of being
51
+      # overriden resulting in the BSD coreutils being called.
52
+      #
53
+      # (( ${+commands[$gcmd]} )) && \
54
+      # alias "$gcmd[2,-1]"="${prefix}/${gcmd//"["/"\\["}"
55
+    done
56
+
57
+    return 0
58
+  }
59
+  __gnu_utils;
60
+
61
+  function hash() {
62
+    if [[ "$*" =~ "-(r|f)" ]]; then
63
+      builtin hash "$@"
64
+      __gnu_utils
65
+    else
66
+      builtin hash "$@"
67
+    fi
68
+  }
69
+
70
+  function rehash() {
71
+    if [[ "$*" =~ "-f" ]]; then
72
+      builtin rehash "$@"
73
+      __gnu_utils
74
+    else
75
+      builtin rehash "$@"
76
+    fi
77
+  }
78
+fi
79
+
0 80
new file mode 100644
... ...
@@ -0,0 +1,119 @@
0
+#!zsh
1
+##############################################################################
2
+# A descriptive listing of core Gradle commands 
3
+############################################################################
4
+function _gradle_core_commands() {
5
+    local ret=1 state
6
+    _arguments ':subcommand:->subcommand' && ret=0
7
+
8
+    case $state in
9
+      subcommand)
10
+        subcommands=(
11
+          "properties:Display all project properties"
12
+          "tasks:Calculate and display all tasks"
13
+          "dependencies:Calculate and display all dependencies"
14
+          "projects:Discover and display all sub-projects"
15
+          "build:Build the project"
16
+          "help:Display help"
17
+        )
18
+        _describe -t subcommands 'gradle subcommands' subcommands && ret=0
19
+    esac
20
+
21
+    return ret
22
+}
23
+
24
+function _gradle_arguments() {
25
+    _arguments -C \
26
+    '-a[Do not rebuild project dependencies]' \
27
+    '-h[Help]' \
28
+    '-D[System property]' \
29
+    '-d[Log at the debug level]' \
30
+    '--gui[Launches the Gradle GUI app]' \
31
+    '--stop[Stop the Gradle daemon]' \
32
+    '--daemon[Use the Gradle daemon]' \
33
+    '--no-daemon[Do not use the Gradle daemon]' \
34
+    '--no-opt[Do not perform any task optimization]' \
35
+    '-i[Log at the info level]' \
36
+    '-m[Dry run]' \
37
+    '-P[Set a project property]' \
38
+    '--profile[Profile the build time]' \
39
+    '-q[Log at the quiet level (only show errors)]' \
40
+    '-v[Print the Gradle version info]' \
41
+    '-x[Specify a task to be excluded]' \
42
+    '*::command:->command' \
43
+    && return 0
44
+}
45
+
46
+
47
+##############################################################################
48
+# Are we in a directory containing a build.gradle file?
49
+############################################################################
50
+function in_gradle() {
51
+    if [[ -f build.gradle ]]; then
52
+        echo 1
53
+    fi
54
+}
55
+
56
+############################################################################
57
+# Define the stat_cmd command based on platform behavior
58
+##########################################################################
59
+stat -f%m . > /dev/null 2>&1
60
+if [ "$?" = 0 ]; then
61
+	stat_cmd=(stat -f%m)
62
+else
63
+	stat_cmd=(stat -L --format=%Y)
64
+fi
65
+
66
+############################################################################## Examine the build.gradle file to see if its
67
+# timestamp has changed, and if so, regen
68
+# the .gradle_tasks cache file
69
+############################################################################
70
+_gradle_does_task_list_need_generating () {
71
+  if [ ! -f .gradletasknamecache ]; then return 0;
72
+  else
73
+    accurate=$($stat_cmd .gradletasknamecache)
74
+    changed=$($stat_cmd build.gradle)
75
+    return $(expr $accurate '>=' $changed)
76
+  fi
77
+}
78
+
79
+
80
+##############################################################################
81
+# Discover the gradle tasks by running "gradle tasks --all"
82
+############################################################################
83
+_gradle_tasks () {
84
+  if [ in_gradle ]; then
85
+    _gradle_arguments
86
+    if _gradle_does_task_list_need_generating; then
87
+     gradle tasks --all | grep "^[ ]*[a-zA-Z0-9]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
88
+    fi
89
+    compadd -X "==== Gradle Tasks ====" `cat .gradletasknamecache`
90
+  fi
91
+}
92
+
93
+_gradlew_tasks () {
94
+  if [ in_gradle ]; then
95
+    _gradle_arguments
96
+    if _gradle_does_task_list_need_generating; then
97
+     gradlew tasks --all | grep "^[ ]*[a-zA-Z0-9]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
98
+    fi
99
+    compadd -X "==== Gradlew Tasks ====" `cat .gradletasknamecache`
100
+  fi
101
+}
102
+
103
+
104
+##############################################################################
105
+# Register the completions against the gradle and gradlew commands
106
+############################################################################
107
+compdef _gradle_tasks gradle
108
+compdef _gradlew_tasks gradlew
109
+
110
+
111
+##############################################################################
112
+# Open questions for future improvements:
113
+# 1) Should 'gradle tasks' use --all or just the regular set?
114
+# 2) Should gradlew use the same approach as gradle?
115
+# 3) Should only the " - " be replaced with a colon so it can work
116
+#     with the richer descriptive method of _arguments?
117
+#     gradle tasks | grep "^[a-zA-Z0-9]*\ -\ " | sed "s/ - /\:/"
118
+#############################################################################
0 119
new file mode 100755
... ...
@@ -0,0 +1,54 @@
0
+_enumerateGrailsScripts() {
1
+    # Default directoryies
2
+    directories=($GRAILS_HOME/scripts ~/.grails/scripts ./scripts)
3
+
4
+    # Check all of the plugins directories, if they exist
5
+    if [ -d plugins ]
6
+    then
7
+        directories+=(plugins/*/scripts)
8
+    fi
9
+    
10
+    # Enumerate all of the Groovy files
11
+    files=()
12
+    for dir in $directories;
13
+    do
14
+        if [ -d $dir ]
15
+        then
16
+            files+=($dir/[^_]*.groovy)
17
+        fi
18
+    done
19
+    
20
+    # Don't try to basename ()
21
+    if [ ${#files} -eq 0 ];
22
+    then
23
+        return
24
+    fi
25
+    
26
+    # - Strip the path
27
+    # - Remove all scripts with a leading '_'
28
+    # - PackagePlugin_.groovy -> PackagePlugin
29
+    # - PackagePlugin         -> Package-Plugin
30
+    # - Package-Plugin        -> package-plugin
31
+    basename $files                             \
32
+        | sed -E  -e 's/^_?([^_]+)_?.groovy/\1/'\
33
+                  -e 's/([a-z])([A-Z])/\1-\2/g' \
34
+        | tr "[:upper:]" "[:lower:]"            \
35
+        | sort                                  \
36
+        | uniq
37
+}
38
+ 
39
+_grails() {
40
+    if (( CURRENT == 2 )); then
41
+        scripts=( $(_enumerateGrailsScripts) )
42
+        
43
+        if [ ${#scripts} -ne 0 ];
44
+        then
45
+            _multi_parts / scripts
46
+            return
47
+        fi
48
+    fi
49
+    
50
+    _files
51
+}
52
+ 
53
+compdef _grails grails
0 54
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,14 @@
0
+
1
+# Mercurial
2
+alias hgc='hg commit -v'
3
+alias hgb='hg branch -v'
4
+alias hgba='hg branches'
5
+alias hgco='hg checkout'
6
+alias hgd='hg diff'
7
+alias hged='hg diffmerge'
8
+# pull and update
9
+alias hgl='hg pull -u -v'
10
+alias hgp='hg push -v'
11
+alias hgs='hg status -v'
12
+# this is the 'git commit --amend' equivalent
13
+alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
0 14
deleted file mode 100644
... ...
@@ -1,19 +0,0 @@
1
-#compdef npm
2
-
3
-# Node Package Manager 0.3.15 completion, letting npm do all the completion work
4
-
5
-_npm() {
6
-  compadd -- $(_npm_complete $words)
7
-}
8
-
9
-# We want to show all errors of any substance, but never the "npm (not )ok" one.
10
-# (Also doesn't consider "ERR! no match found" worth breaking the terminal for.)
11
-_npm_complete() {
12
-  local ask_npm
13
-  ask_npm=(npm completion --color false --loglevel error -- $@)
14
-  { _call_program npm $ask_npm 2>&1 >&3 \
15
-  | egrep -v '^(npm (not |)ok|ERR! no match found)$' >&2; \
16
-  } 3>&1
17
-}
18
-
19
-_npm "$@"
20 1
new file mode 100644
... ...
@@ -0,0 +1 @@
0
+eval "$(npm completion 2>/dev/null)"
0 1
new file mode 100644
... ...
@@ -0,0 +1,5 @@
0
+#compdef man-preview
1
+#autoload
2
+
3
+_man
4
+
... ...
@@ -1,63 +1,99 @@
1
-alias showfiles='defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder'
2
-alias hidefiles='defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder'
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
+# ------------------------------------------------------------------------------
3 7
 
4
-# Recursively delete .DS_Store files
5
-alias rm-dsstore="find . -name '*.DS_Store' -type f -delete"
6
-
7
-function savepath() {
8
-  pwd > ~/.current_path~
9
-}
10 8
 
11 9
 function tab() {
12
-savepath
13
-osascript >/dev/null <<EOF
14
-on do_submenu(app_name, menu_name, menu_item, submenu_item)
15
-    -- bring the target application to the front
16
-    tell application app_name
17
-      activate
18
-    end tell
19
-    tell application "System Events"
20
-      tell process app_name
21
-        tell menu bar 1
22
-          tell menu bar item menu_name
23
-            tell menu menu_name
24
-              tell menu item menu_item
25
-                tell menu menu_item
26
-                  click menu item submenu_item
27
-                end tell
28
-              end tell
29
-            end tell
30
-          end tell
31
-        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)
32 17
       end tell
33
-    end tell
34
-end do_submenu
18
+EOF
19
+  )
35 20
 
36
-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
37 27
 EOF
38
-}
28
+  }
39 29
 
40
-function itab() {
41
-savepath
42
-osascript >/dev/null <<EOF
43
-on do_submenu(app_name, menu_name, menu_item)
44
-    -- bring the target application to the front
45
-    tell application app_name
46
-      activate
47
-    end tell
48
-    tell application "System Events"
49
-      tell process app_name
50
-        tell menu bar 1
51
-          tell menu bar item menu_name
52
-            tell menu menu_name
53
-              click menu item menu_item
54
-            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}"
55 39
           end tell
56 40
         end tell
57 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)
58 50
     end tell
59
-end do_submenu
51
+EOF
52
+}
60 53
 
61
-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
62 64
 EOF
63 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
+
64 100
new file mode 100644
... ...
@@ -0,0 +1,4 @@
0
+#compdef powder
1
+#autoload
2
+
3
+compadd `powder help | grep powder | cut -d " " -f 4`
0 4
new file mode 100644
... ...
@@ -0,0 +1,5 @@
0
+# Find python file
1
+alias pyfind='find . -name "*.py"'
2
+
3
+# Remove python compiled byte-code
4
+alias pyclean='find . -type f -name "*.py[co]" -exec rm -f \{\} \;'
... ...
@@ -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,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 [ in_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 [ in_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 [ in_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 
35 35
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
0 21
new file mode 100644
... ...
@@ -0,0 +1,38 @@
0
+#compdef terminitor
1
+#autoload
2
+
3
+# terminitor zsh completion
4
+
5
+_terminitor_available_scripts() {
6
+  scripts=(`for SCRIPT in ~/.config/terminitor/*.term ; do basename $SCRIPT .term ; done`)
7
+}
8
+
9
+local -a _1st_arguments
10
+_1st_arguments=(
11
+    'create:create a Termfile in directory'
12
+    'delete:delete terminitor script'
13
+    'edit:open termitor script'
14
+    'fetch:clone the designated repo and run setup'
15
+    'help:Describe available tasks or one specific task'
16
+    'init:create initial root terminitor folder'
17
+    'list:lists all terminitor scripts'
18
+    'setup:execute setup in the terminitor script'
19
+    'start:runs the terminitor script'
20
+    'update:update Terminitor to new global path(.config/.terminitor)'
21
+)
22
+
23
+local expl
24
+
25
+_arguments \
26
+  '*:: :->subcmds' && return 0
27
+
28
+if (( CURRENT == 1 )); then
29
+  _describe -t commands "terminitor task" _1st_arguments
30
+  return
31
+fi
32
+
33
+case "$words[1]" in
34
+  start|edit|delete|setup)
35
+    _terminitor_available_scripts
36
+    _wanted scripts expl 'installed scripts' compadd -a scripts ;;
37
+esac
... ...
@@ -1,5 +1,5 @@
1 1
 alias et='mate .'
2
-alias ett='mate app config lib db public spec test Rakefile Capfile Todo'
2
+alias ett='mate Gemfile app config features lib db public spec test Rakefile Capfile Todo'
3 3
 alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
4 4
 alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
5 5
 
6 6
new file mode 100644
... ...
@@ -0,0 +1,23 @@
0
+function vundle-init () {
1
+  if [ ! -d ~/.vim/bundle/vundle/ ]
2
+  then
3
+    mkdir -p ~/.vim/bundle/vundle/
4
+  fi
5
+
6
+  if [ ! -d ~/.vim/bundle/vundle/.git/ ]
7
+  then
8
+    git clone http://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
9
+    echo "\n\tRead about vim configuration for vundle at https://github.com/gmarik/vundle\n"
10
+  fi
11
+}
12
+
13
+function vundle () {
14
+  vundle-init
15
+  vim -c "execute \"BundleInstall\" | q | q"
16
+}
17
+
18
+
19
+function vundle-update () {
20
+  vundle-init
21
+  vim -c "execute \"BundleInstall!\" | q | q"
22
+}
... ...
@@ -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,26 @@
0
+function toon {
1
+  echo -n ""
2
+}
3
+
4
+get_git_dirty() { 
5
+  git diff --quiet || echo '*'
6
+}
7
+
8
+autoload -Uz vcs_info
9
+autoload -U colors && colors
10
+zstyle ':vcs_info:*' check-for-changes true
11
+zstyle ':vcs_info:*' unstagedstr '%F{red}*'   # display this when there are unstaged changes
12
+zstyle ':vcs_info:*' stagedstr '%F{yellow}+'  # display this when there are staged changes
13
+zstyle ':vcs_info:*' actionformats \
14
+    '%F{5}%F{5}[%F{2}%b%F{3}|%F{1}%a%c%u%F{5}]%f '
15
+zstyle ':vcs_info:*' formats       \
16
+    '%F{5}%F{5}[%F{2}%b%c%u%F{5}]%f '
17
+zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
18
+zstyle ':vcs_info:*' enable git cvs svn
19
+
20
+precmd () {
21
+    vcs_info
22
+}
23
+
24
+setopt prompt_subst
25
+PROMPT='%{$fg[magenta]%}$(toon)%{$reset_color%} %~/ %{$reset_color%}${vcs_info_msg_0_}%{$reset_color%}'
0 26
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,37 @@
0
+# CRUNCH - created from Steve Eley's cat waxing.
1
+# Initially hacked from the Dallas theme. Thanks, Dallas Reedy.
2
+#
3
+# This theme assumes you do most of your oh-my-zsh'ed "colorful" work at a single machine, 
4
+# and eschews the standard space-consuming user and hostname info.  Instead, only the 
5
+# things that vary in my own workflow are shown:
6
+#
7
+# * The time (not the date)
8
+# * The RVM version and gemset (omitting the 'ruby' name if it's MRI)
9
+# * The current directory
10
+# * The Git branch and its 'dirty' state
11
+# 
12
+# Colors are at the top so you can mess with those separately if you like.
13
+# For the most part I stuck with Dallas's.
14
+
15
+CRUNCH_BRACKET_COLOR="%{$fg[white]%}"
16
+CRUNCH_TIME_COLOR="%{$fg[yellow]%}"
17
+CRUNCH_RVM_COLOR="%{$fg[magenta]%}"
18
+CRUNCH_DIR_COLOR="%{$fg[cyan]%}"
19
+CRUNCH_GIT_BRANCH_COLOR="%{$fg[green]%}"
20
+CRUNCH_GIT_CLEAN_COLOR="%{$fg[green]%}"
21
+CRUNCH_GIT_DIRTY_COLOR="%{$fg[red]%}"
22
+
23
+# These Git variables are used by the oh-my-zsh git_prompt_info helper:
24
+ZSH_THEME_GIT_PROMPT_PREFIX="$CRUNCH_BRACKET_COLOR:$CRUNCH_GIT_BRANCH_COLOR"
25
+ZSH_THEME_GIT_PROMPT_SUFFIX=""
26
+ZSH_THEME_GIT_PROMPT_CLEAN=" $CRUNCH_GIT_CLEAN_COLOR✓"
27
+ZSH_THEME_GIT_PROMPT_DIRTY=" $CRUNCH_GIT_DIRTY_COLOR✗"
28
+
29
+# Our elements:
30
+CRUNCH_TIME_="$CRUNCH_BRACKET_COLOR{$CRUNCH_TIME_COLOR%T$CRUNCH_BRACKET_COLOR}%{$reset_color%}"
31
+CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(~/.rvm/bin/rvm-prompt i v g)#ruby-}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}"
32
+CRUNCH_DIR_="$CRUNCH_DIR_COLOR%~\$(git_prompt_info) "
33
+CRUNCH_PROMPT="$CRUNCH_BRACKET_COLOR➭ "
34
+
35
+# Put it all together!
36
+PROMPT="$CRUNCH_TIME_$CRUNCH_RVM_$CRUNCH_DIR_$CRUNCH_PROMPT%{$reset_color%}"
0 37
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%}"
0 14
new file mode 100644
... ...
@@ -0,0 +1,39 @@
0
+# Fino theme by Max Masnick (http://max.masnick.me)
1
+
2
+# Use with a dark background and 256-color terminal!
3
+# Meant for people with RVM and git. Tested only on OS X 10.7.
4
+
5
+# You can set your computer name in the ~/.box-name file if you want.
6
+
7
+# Borrowing shamelessly from these oh-my-zsh themes:
8
+#   bira
9
+#   robbyrussell
10
+#
11
+# Also borrowing from http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
12
+
13
+function virtualenv_info {
14
+    [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
15
+}
16
+
17
+function prompt_char {
18
+    git branch >/dev/null 2>/dev/null && echo '±' && return
19
+    echo '○'
20
+}
21
+
22
+function box_name {
23
+    [ -f ~/.box-name ] && cat ~/.box-name || hostname -s
24
+}
25
+
26
+
27
+local rvm_ruby='‹$(rvm-prompt i v g)›%{$reset_color%}'
28
+local current_dir='${PWD/#$HOME/~}'
29
+local git_info='$(git_prompt_info)'
30
+
31
+
32
+PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} %{$FG[239]%}using%{$FG[243]%} ${rvm_ruby}
33
+╰─$(virtualenv_info)$(prompt_char) "
34
+
35
+ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}"
36
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
37
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$FG[202]%}✘✘✘"
38
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$FG[040]%}✔"
0 39
\ No newline at end of file
1 40
new file mode 100644
... ...
@@ -0,0 +1,8 @@
0
+#fox theme
1
+PROMPT='%{$fg[cyan]%}┌[%{$fg_bold[white]%}%n%{$reset_color%}%{$fg[cyan]%}☮%{$fg_bold[white]%}%M%{$reset_color%}%{$fg[cyan]%}]%{$fg[white]%}-%{$fg[cyan]%}(%{$fg_bold[white]%}%~%{$reset_color%}%{$fg[cyan]%})$(git_prompt_info)
2
+└> % %{$reset_color%}'
3
+
4
+ZSH_THEME_GIT_PROMPT_PREFIX="-[%{$reset_color%}%{$fg[white]%}git://%{$fg_bold[white]%}"
5
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}%{$fg[cyan]%}]-"
6
+ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}✗%{$reset_color%}"
7
+ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%{$reset_color%}"
0 8
new file mode 100644
... ...
@@ -0,0 +1,54 @@
0
+# ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png
1
+# Based on bira theme
2
+
3
+# load some modules
4
+autoload -U colors zsh/terminfo # Used in the colour alias below
5
+colors
6
+setopt prompt_subst
7
+
8
+# make some aliases for the colours: (coud use normal escap.seq's too)
9
+for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
10
+  eval PR_$color='%{$fg[${(L)color}]%}'
11
+done
12
+eval PR_NO_COLOR="%{$terminfo[sgr0]%}"
13
+eval PR_BOLD="%{$terminfo[bold]%}"
14
+
15
+# Check the UID
16
+if [[ $UID -ge 1000 ]]; then # normal user
17
+  eval PR_USER='${PR_GREEN}%n${PR_NO_COLOR}'
18
+  eval PR_USER_OP='${PR_GREEN}%#${PR_NO_COLOR}'
19
+  local PR_PROMPT='$PR_NO_COLOR➤ $PR_NO_COLOR'
20
+elif [[ $UID -eq 0 ]]; then # root
21
+  eval PR_USER='${PR_RED}%n${PR_NO_COLOR}'
22
+  eval PR_USER_OP='${PR_RED}%#${PR_NO_COLOR}'
23
+  local PR_PROMPT='$PR_RED➤ $PR_NO_COLOR'
24
+fi
25
+
26
+# Check if we are on SSH or not
27
+if [[ -n "$SSH_CLIENT"  ||  -n "$SSH2_CLIENT" ]]; then 
28
+  eval PR_HOST='${PR_YELLOW}%M${PR_NO_COLOR}' #SSH
29
+else
30
+  eval PR_HOST='${PR_GREEN}%M${PR_NO_COLOR}' # no SSH
31
+fi
32
+
33
+local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
34
+
35
+local user_host='${PR_USER}${PR_CYAN}@${PR_HOST}'
36
+local current_dir='%{$PR_BOLD$PR_BLUE%}%~%{$PR_NO_COLOR%}'
37
+local rvm_ruby=''
38
+if which rvm-prompt &> /dev/null; then
39
+  rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}'
40
+else
41
+  if which rbenv &> /dev/null; then
42
+    rvm_ruby='%{$PR_RED%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$PR_NO_COLOR%}'
43
+  fi
44
+fi
45
+local git_branch='$(git_prompt_info)%{$PR_NO_COLOR%}'
46
+
47
+#PROMPT="${user_host} ${current_dir} ${rvm_ruby} ${git_branch}$PR_PROMPT "
48
+PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
49
+╰─$PR_PROMPT "
50
+RPS1="${return_code}"
51
+
52
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$PR_YELLOW%}‹"
53
+ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$PR_NO_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,4 @@
0
+PROMPT='%{$fg[yellow]%}λ %{$fg[green]%}%c %{$fg[yellow]%}→ $(git_prompt_info)%{$reset_color%}'
1
+
2
+ZSH_THEME_GIT_PROMPT_PREFIX="λ %{$fg[blue]%}git %{$fg[red]%}"
3
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%} → %{$reset_color%}"
... ...
@@ -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,29 @@
0
+# user, host, full path, and time/date
1
+# on two lines for easier vgrepping
2
+# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888
3
+
4
+function hg_prompt_info {
5
+    hg prompt --angle-brackets "\
6
+<hg:%{$fg[magenta]%}<branch>%{$reset_color%}>\
7
+</%{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\
8
+%{$fg[red]%}<status|modified|unknown><update>%{$reset_color%}<
9
+patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset_color%})|pre_unapplied(%{$fg_bold[black]%})|post_unapplied(%{$reset_color%})>>" 2>/dev/null
10
+}
11
+
12
+ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}+"
13
+ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}✱"
14
+ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✗"
15
+ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}➦"
16
+ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%}✂"
17
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%}✈"
18
+
19
+function mygit() {
20
+  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
21
+  echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$( git_prompt_status )%{$reset_color%}$ZSH_THEME_GIT_PROMPT_SUFFIX"
22
+}
23
+
24
+# alternate prompt with git & hg
25
+PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%}
26
+%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(mygit)$(hg_prompt_info)>%{\e[0m%}%b '
27
+PS2=$' \e[0;34m%}%B>%{\e[0m%}%b '
28
+
0 29
new file mode 100644
... ...
@@ -0,0 +1,8 @@
0
+# user, host, full path, and time/date
1
+# on two lines for easier vgrepping
2
+# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888
3
+
4
+PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%}
5
+%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]%{\e[0m%}%b '
6
+
7
+
0 8
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,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
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 108
new file mode 100644
... ...
@@ -0,0 +1,5 @@
0
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}["
1
+ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} "
2
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} x%{$fg_bold[blue]%}"
3
+
4
+PROMPT='%{$(git_prompt_info)%}%{$fg_bold[green]%}{%{$(rvm current)%}}%{$reset_color%} %{$fg[cyan]%}%c%{$reset_color%} '
... ...
@@ -24,7 +24,7 @@ then
24 24
     read line
25 25
     if [ "$line" = Y ] || [ "$line" = y ]
26 26
     then
27
-      /bin/sh $ZSH/tools/upgrade.sh
27
+      /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
28 28
       # update the zsh file
29 29
       _update_zsh_update
30 30
     fi
31 31
new file mode 100755
... ...
@@ -0,0 +1,161 @@
0
+__require_tool_version_compare ()
1
+{
2
+  (
3
+    # Locally ignore failures, otherwise we'll exit whenever $1 and $2
4
+    # are not equal!
5
+    set +e
6
+
7
+awk_strverscmp='
8
+  # Use only awk features that work with 7th edition Unix awk (1978).
9
+  # My, what an old awk you have, Mr. Solaris!
10
+  END {
11
+    while (length(v1) || length(v2)) {
12
+      # Set d1 to be the next thing to compare from v1, and likewise for d2.
13
+      # Normally this is a single character, but if v1 and v2 contain digits,
14
+      # compare them as integers and fractions as strverscmp does.
15
+      if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) {
16
+	# Split v1 and v2 into their leading digit string components d1 and d2,
17
+	# and advance v1 and v2 past the leading digit strings.
18
+	for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue
19
+	for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue
20
+	d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1)
21
+	d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1)
22
+	if (d1 ~ /^0/) {
23
+	  if (d2 ~ /^0/) {
24
+	    # Compare two fractions.
25
+	    while (d1 ~ /^0/ && d2 ~ /^0/) {
26
+	      d1 = substr(d1, 2); len1--
27
+	      d2 = substr(d2, 2); len2--
28
+	    }
29
+	    if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) {
30
+	      # The two components differ in length, and the common prefix
31
+	      # contains only leading zeros.  Consider the longer to be less.
32
+	      d1 = -len1
33
+	      d2 = -len2
34
+	    } else {
35
+	      # Otherwise, compare as strings.
36
+	      d1 = "x" d1
37
+	      d2 = "x" d2
38
+	    }
39
+	  } else {
40
+	    # A fraction is less than an integer.
41
+	    exit 1
42
+	  }
43
+	} else {
44
+	  if (d2 ~ /^0/) {
45
+	    # An integer is greater than a fraction.
46
+	    exit 2
47
+	  } else {
48
+	    # Compare two integers.
49
+	    d1 += 0
50
+	    d2 += 0
51
+	  }
52
+	}
53
+      } else {
54
+	# The normal case, without worrying about digits.
55
+	if (v1 == "") d1 = v1; else { d1 = substr(v1, 1, 1); v1 = substr(v1,2) }
56
+	if (v2 == "") d2 = v2; else { d2 = substr(v2, 1, 1); v2 = substr(v2,2) }
57
+      }
58
+      if (d1 < d2) exit 1
59
+      if (d1 > d2) exit 2
60
+    }
61
+  }
62
+'
63
+    awk "$awk_strverscmp" v1="$1" v2="$2" /dev/null
64
+    case $? in
65
+      1)  echo '<';;
66
+      0)  echo '=';;
67
+      2)  echo '>';;
68
+    esac
69
+  )
70
+}
71
+
72
+
73
+__require_tool_fatal ()
74
+{
75
+    echo $@ >/dev/stderr
76
+    return 1
77
+}
78
+
79
+# Usage: require_tool program version
80
+# Returns: 0 if $1 version if greater equals than $2, 1 otherwise.
81
+# In case of error, message is written on error output.
82
+#
83
+# Example: require_tool gcc 4.6
84
+# Use GCC environment variable if defined instead of lookup for the tool
85
+# in the environment.
86
+require_tool ()
87
+{
88
+  envvar_name=$(echo $1 | tr '[:lower:]' '[:upper:]')
89
+  tool=$(printenv $envvar_name || echo $1)
90
+  local version=$($tool --version 2>/dev/null| \
91
+    sed -n 's/.*[^0-9.]\([0-9]*\.[0-9.]*\).*/\1/p;q')
92
+  if test x"$version" = x ; then
93
+      echo "$tool is required" >/dev/stderr
94
+      return 1
95
+  fi
96
+  case $(__require_tool_version_compare "$2" "$version") in
97
+    '>')
98
+	  echo "$1 $2 or better is required: this is $tool $version" >/dev/stderr
99
+	  return 1
100
+	  ;;
101
+  esac
102
+}
103
+
104
+usage() {
105
+    cat <<EOF
106
+NAME
107
+    require_tool.sh - Ensure version of a tool is greater than the one expected
108
+
109
+SYNOPSYS
110
+    require_tool.sh [ -h ]
111
+                    [ --help ]
112
+                    [ TOOL MIN_VERSION ]
113
+
114
+DESCRIPTION
115
+    TOOL is the name or path of the program to check. If the name is specified, its
116
+    path is deduced from PATH environment variable. If environment variable TOOL
117
+    (in upper-case characters) is defined, considers its value as path to the tool.
118
+
119
+    MIN_VERSION is a string representing the minimum required version.
120
+
121
+BEHAVIOR
122
+    * locate path to the program.
123
+    * execute $ TOOL_PATH --version
124
+    * extract version from standard output.
125
+    * compare this version to the expected one.
126
+
127
+OPTIONS
128
+    -h --help
129
+        Display this message and exit 0
130
+
131
+ERRORS
132
+    if program is not found or its version is prior to expected version,
133
+    a message is written to error output.
134
+
135
+EXIT VALUE
136
+    returns 0 if program version if greater equals than expected version,
137
+    returns 1 otherwise.
138
+
139
+EXAMPLE
140
+    $ require_tool.sh emacs 23
141
+    $ CC=g++ require_tool.sh cc 4.6
142
+    $ require_tool.sh zsh 4.5
143
+
144
+EOF
145
+}
146
+
147
+for arg in $@; do
148
+    case $arg in
149
+        -h|--help)
150
+            usage
151
+            exit 0
152
+            ;;
153
+    esac
154
+done
155
+if [ $# -gt 2 ] ; then
156
+    echo "ERROR: expecting 2 parameters. Please see option --help"
157
+    exit 1
158
+fi
159
+
160
+require_tool $@
0 161
new file mode 100755
... ...
@@ -0,0 +1,96 @@
0
+#!/bin/zsh
1
+
2
+# Zsh Theme Chooser by fox (fox91 at anche dot no)
3
+# This program is free software. It comes without any warranty, to
4
+# the extent permitted by applicable law. You can redistribute it
5
+# and/or modify it under the terms of the Do What The Fuck You Want
6
+# To Public License, Version 2, as published by Sam Hocevar. See
7
+# http://sam.zoy.org/wtfpl/COPYING for more details.
8
+
9
+THEMES_DIR="$ZSH/themes"
10
+FAVLIST="${HOME}/.zsh_favlist"
11
+source $ZSH/oh-my-zsh.sh
12
+
13
+function noyes() {
14
+    read "a?$1 [y/N] "
15
+    if [[ $a == "N" || $a == "n" || $a = "" ]]; then
16
+        return 0
17
+    fi
18
+    return 1
19
+}
20
+
21
+function theme_preview() {
22
+    THEME=$1
23
+    THEME_NAME=`echo $THEME | sed s/\.zsh-theme$//`
24
+    print "$fg[blue]${(l.((${COLUMNS}-${#THEME_NAME}-5))..─.)}$reset_color $THEME_NAME $fg[blue]───$reset_color"
25
+    source "$THEMES_DIR/$THEME"
26
+    print -P $PROMPT
27
+}
28
+
29
+function banner() {
30
+    echo
31
+    echo "╺━┓┏━┓╻ ╻   ╺┳╸╻ ╻┏━╸┏┳┓┏━╸   ┏━╸╻ ╻┏━┓┏━┓┏━┓┏━╸┏━┓"
32
+    echo "┏━┛┗━┓┣━┫    ┃ ┣━┫┣╸ ┃┃┃┣╸    ┃  ┣━┫┃ ┃┃ ┃┗━┓┣╸ ┣┳┛"
33
+    echo "┗━╸┗━┛╹ ╹    ╹ ╹ ╹┗━╸╹ ╹┗━╸   ┗━╸╹ ╹┗━┛┗━┛┗━┛┗━╸╹┗╸"
34
+    echo
35
+}
36
+
37
+function usage() {
38
+    echo "Usage: $0 [options] [theme]"
39
+    echo
40
+    echo "Options"
41
+    echo "  -l   List available themes"
42
+    echo "  -s   Show all themes"
43
+    echo "  -h   Get this help message"
44
+    exit 1
45
+}
46
+
47
+function list_themes() {
48
+    for THEME in $(ls $THEMES_DIR); do
49
+        THEME_NAME=`echo $THEME | sed s/\.zsh-theme$//`
50
+        echo $THEME_NAME
51
+    done
52
+}
53
+
54
+function insert_favlist() {
55
+    if grep -q "$THEME_NAME" $FAVLIST 2> /dev/null ; then
56
+        echo "Already in favlist"
57
+    else
58
+        echo $THEME_NAME >> $FAVLIST
59
+        echo "Saved to favlist"
60
+    fi
61
+
62
+}
63
+
64
+function theme_chooser() {
65
+    for THEME in $(ls $THEMES_DIR); do
66
+        echo
67
+        theme_preview $THEME
68
+        echo
69
+        if [[ -z $1 ]]; then
70
+            noyes "Do you want to add it to your favourite list ($FAVLIST)?" || \
71
+                  insert_favlist $THEME_NAME
72
+            echo
73
+        fi
74
+    done
75
+}
76
+
77
+while getopts ":lhs" Option
78
+do
79
+  case $Option in
80
+    l ) list_themes ;;
81
+    s ) theme_chooser 0 ;;
82
+    h ) usage ;;
83
+    * ) usage ;; # Default.
84
+  esac
85
+done
86
+
87
+if [[ -z $Option ]]; then
88
+    if [[ -z $1 ]]; then
89
+        banner
90
+        echo
91
+        theme_chooser
92
+    else
93
+        theme_preview $1".zsh-theme"
94
+    fi
95
+fi
... ...
@@ -1,12 +1,12 @@
1 1
 current_path=`pwd`
2
-echo "\033[0;34mUpgrading Oh My Zsh\033[0m"
2
+echo -e "\033[0;34mUpgrading Oh My Zsh\033[0m"
3 3
 ( cd $ZSH && git pull origin master )
4
-echo "\033[0;32m"'         __                                     __   '"\033[0m"
5
-echo "\033[0;32m"'  ____  / /_     ____ ___  __  __   ____  _____/ /_  '"\033[0m"
6
-echo "\033[0;32m"' / __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \ '"\033[0m"
7
-echo "\033[0;32m"'/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / / '"\033[0m"
8
-echo "\033[0;32m"'\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/  '"\033[0m"
9
-echo "\033[0;32m"'                        /____/                       '"\033[0m"
10
-echo "\033[0;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m"
11
-echo "\033[0;34mTo keep up on the latest, be sure to follow Oh My Zsh on twitter: \033[1mhttp://twitter.com/ohmyzsh\033[0m"
12
-cd $current_path
4
+echo -e "\033[0;32m"'         __                                     __   '"\033[0m"
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;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m"
11
+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"
12
+cd "$current_path"