27d048aa5729dfb9fa8119bc8ed4abb61619d7ea

Author
Amila Perera <perera.amila@gmail.com>
Committer
Amila Perera <perera.amila@gmail.com>
Date

Message

Merge remote-tracking branch 'upstream/master'

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
  2index 2e657e5a820b83463b4af463d76f035b6404c58f..e390f8620bb1252e7b0f14072bf90c7d92fef36e 100644
  3--- a/plugins/bundler/bundler.plugin.zsh
  4+++ b/plugins/bundler/bundler.plugin.zsh
  5@@ -4,18 +4,6 @@ alias bp="bundle package"
  6 alias bo="bundle open"
  7 alias bu="bundle update"
  8 
  9-bundler_version=`bundle version | cut -d' ' -f3`
 10-if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
 11-  if [[ "$(uname)" == 'Darwin' ]]
 12-  then
 13-    local cores_num="$(sysctl hw.ncpu | awk '{print $2}')"
 14-  else
 15-    local cores_num="$(nproc)"
 16-  fi
 17-  eval "alias bi='bundle install --jobs=$cores_num'"
 18-else
 19-  alias bi='bundle install' 
 20-fi
 21 
 22 # The following is based on https://github.com/gma/bundler-exec
 23 
 24@@ -44,14 +32,28 @@ _run-with-bundler() {
 25   fi
 26 }
 27 
 28-## Main program
 29-for cmd in $bundled_commands; do
 30-  eval "function unbundled_$cmd () { $cmd \$@ }"
 31-  eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}"
 32-  alias $cmd=bundled_$cmd
 33-
 34-  if which _$cmd > /dev/null 2>&1; then
 35-        compdef _$cmd bundled_$cmd=$cmd
 36-  fi
 37-done
 38-
 39+if _bundler-installed; then
 40+	bundler_version=`bundle version | cut -d' ' -f3`
 41+	if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
 42+		if [[ "$(uname)" == 'Darwin' ]]
 43+		then
 44+			local cores_num="$(sysctl hw.ncpu | awk '{print $2}')"
 45+		else
 46+			local cores_num="$(nproc)"
 47+		fi
 48+		eval "alias bi='bundle install --jobs=$cores_num'"
 49+	else
 50+		alias bi='bundle install' 
 51+	fi
 52+
 53+	## Main program
 54+	for cmd in $bundled_commands; do
 55+		eval "function unbundled_$cmd () { $cmd \$@ }"
 56+		eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}"
 57+		alias $cmd=bundled_$cmd
 58+
 59+		if which _$cmd > /dev/null 2>&1; then
 60+			compdef _$cmd bundled_$cmd=$cmd
 61+		fi
 62+	done
 63+fi
 64diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh
 65index 9aa192c1e6a0119c39b1373f6764429faa7f49a1..739ee7142f69b7e794f8e2a3633cb8e96000735a 100644
 66--- a/plugins/jira/jira.plugin.zsh
 67+++ b/plugins/jira/jira.plugin.zsh
 68@@ -31,7 +31,7 @@ open_jira_issue () {
 69 
 70   if [ -z "$1" ]; then
 71     echo "Opening new issue"
 72-    `open $jira_url/secure/CreateIssue!default.jspa`
 73+    $open_cmd "$jira_url/secure/CreateIssue!default.jspa"
 74   else
 75     echo "Opening issue #$1"
 76     if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then
 77diff --git a/plugins/pip/_pip b/plugins/pip/_pip
 78index fb8765c7e5d488adde84481d260e06b18279f7be..967da48cad713ffd9bb15bb34968626dd0c072bd 100644
 79--- a/plugins/pip/_pip
 80+++ b/plugins/pip/_pip
 81@@ -6,8 +6,8 @@
 82 _pip_all() {
 83   # we cache the list of packages (originally from the macports plugin)
 84   if (( ! $+piplist )); then
 85-      echo -n " (caching package index...)"
 86-      piplist=($(pip search * | cut -d ' ' -f 1 | tr '[A-Z]' '[a-z]'))
 87+      zsh-pip-cache-packages
 88+      piplist=($(cat $ZSH_PIP_CACHE_FILE))
 89   fi
 90 }
 91 
 92diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh
 93new file mode 100644
 94index 0000000000000000000000000000000000000000..71f977bbfcc810306adf7e04438424e191b3c9e1
 95--- /dev/null
 96+++ b/plugins/pip/pip.plugin.zsh
 97@@ -0,0 +1,78 @@
 98+# Usage:
 99+# Just add pip to your installed plugins.
100+
101+# If you would like to change the cheeseshops used for autocomplete set
102+# ZSH_PIP_INDEXES in your zshrc. If one of your indexes are bogus you won't get
103+# any kind of error message, pip will just not autocomplete from them. Double
104+# check!
105+#
106+# If you would like to clear your cache, go ahead and do a
107+# "zsh-pip-clear-cache".
108+
109+ZSH_PIP_CACHE_FILE=~/.pip/zsh-cache
110+ZSH_PIP_INDEXES=(https://pypi.python.org/simple/)
111+
112+zsh-pip-clear-cache() {
113+  rm $ZSH_PIP_CACHE_FILE
114+  unset piplist
115+}
116+
117+zsh-pip-clean-packages() {
118+    sed -nr '/<a href/ s/.*>([^<]+).*/\1/p'
119+}
120+
121+zsh-pip-cache-packages() {
122+  if [[ ! -d ${PIP_CACHE_FILE:h} ]]; then
123+      mkdir -p ${PIP_CACHE_FILE:h}
124+  fi
125+
126+  if [[ ! -f $ZSH_PIP_CACHE_FILE ]]; then
127+      echo -n "(...caching package index...)"
128+      tmp_cache=/tmp/zsh_tmp_cache
129+      for index in $ZSH_PIP_INDEXES ; do
130+          # well... I've already got two problems
131+          curl $index 2>/dev/null | \
132+              zsh-pip-clean-packages \
133+               >> $tmp_cache
134+      done
135+      sort $tmp_cache | uniq | tr '\n' ' ' > $ZSH_PIP_CACHE_FILE
136+      rm $tmp_cache
137+  fi
138+}
139+
140+# A test function that validates the regex against known forms of the simple
141+# index. If you modify the regex to make it work for you, you should add a test
142+# case in here and make sure that your changes don't break things for someone
143+# else.
144+zsh-pip-test-clean-packages() {
145+    local expected
146+    local actual
147+    expected="0x10c-asm
148+1009558_nester"
149+
150+    actual=$(echo -n "<html><head><title>Simple Index</title><meta name=\"api-version\" value=\"2\" /></head><body>
151+<a href='0x10c-asm'>0x10c-asm</a><br/>
152+<a href='1009558_nester'>1009558_nester</a><br/>
153+</body></html>" | zsh-pip-clean-packages)
154+
155+    if [[ $actual != $expected ]] ; then
156+        echo -e "python's simple index is broken:\n$actual\n  !=\n$expected"
157+    else
158+        echo "python's simple index is fine"
159+    fi
160+
161+    actual=$(echo -n '<html>
162+  <head>
163+    <title>Simple Package Index</title>
164+  </head>
165+  <body>
166+    <a href="0x10c-asm">0x10c-asm</a><br/>
167+    <a href="1009558_nester">1009558_nester</a><br/>
168+</body></html>' | zsh-pip-clean-packages)
169+
170+    if [[ $actual != $expected ]] ; then
171+        echo -e "the djangopypi2 index is broken:\n$actual\n  !=\n$expected"
172+    else
173+        echo "the djangopypi2 index is fine"
174+    fi
175+}
176diff --git a/plugins/pod/_pod b/plugins/pod/_pod
177index 563fa5e666459bee4c92bb588cbc8681be404c07..8c0f4460f7321f21202e16b9716deadf2d486b87 100644
178--- a/plugins/pod/_pod
179+++ b/plugins/pod/_pod
180@@ -3,18 +3,19 @@
181 
182 # -----------------------------------------------------------------------------
183 #          FILE:  _pod
184-#   DESCRIPTION:  Cocoapods autocomplete plugin for Oh-My-Zsh
185+#   DESCRIPTION:  Cocoapods (0.27.1) autocomplete plugin for Oh-My-Zsh
186 #                 http://cocoapods.org
187 #        AUTHOR:  Alexandre Joly (alexandre.joly@mekanics.ch)
188 #        GITHUB:  https://github.com/mekanics
189 #       TWITTER:  @jolyAlexandre
190-#       VERSION:  0.0.1
191+#       VERSION:  0.0.3
192 #       LICENSE:  MIT
193 # -----------------------------------------------------------------------------
194 
195 local -a _1st_arguments
196 _1st_arguments=(
197-    'help:Show help for the given command.'
198+    'help:Show help for the given command'
199+    'init:Generate a Podfile for the current directory'
200     'install:Install project dependencies'
201     'ipc:Inter-process communication'
202     'list:List pods'
203@@ -32,6 +33,7 @@ local -a _repo_arguments
204 _repo_arguments=(
205     'add:Add a spec repo'
206     'lint:Validates all specs in a repo'
207+    'remove:Remove a spec repo.'
208     'update:Update a spec repo'
209 )
210 
211@@ -158,7 +160,7 @@ __first_command_list ()
212 }
213 
214 __repo_list() {
215-    _wanted application expl 'repo' compadd $(command ls -1 ~/.cocoapods 2>/dev/null | sed -e 's/ /\\ /g')
216+    _wanted application expl 'repo' compadd $(command ls -1 ~/.cocoapods/repos 2>/dev/null | sed -e 's/ /\\ /g')
217 }
218 
219 __pod-repo() {
220@@ -193,6 +195,12 @@ __pod-repo() {
221                 (add)
222                     _arguments \
223                         $_inherited_options
224+
225+                (remove)
226+                    _arguments \
227+                        $_inherited_options \
228+                        ':feature:__repo_list'
229+                ;;
230             esac
231         ;;
232     esac
233diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh
234index 852c8b919ed77a45d68b0a57535b9b8995a8f8dd..a8f9760ad786490870cc038a35af21464cba33d7 100644
235--- a/plugins/python/python.plugin.zsh
236+++ b/plugins/python/python.plugin.zsh
237@@ -6,6 +6,7 @@ alias pyfind='find . -name "*.py"'
238 function pyclean() {
239     ZSH_PYCLEAN_PLACES=${*:-'.'}
240     find ${ZSH_PYCLEAN_PLACES} -type f -name "*.py[co]" -delete
241+    find ${ZSH_PYCLEAN_PLACES} -type d -name "__pycache__" -delete
242 }
243 
244 # Grep among .py files
245diff --git a/plugins/wd2/wd2/wd.plugin.zsh b/plugins/wd2/wd2/wd.plugin.zsh
246new file mode 100755
247index 0000000000000000000000000000000000000000..e0846ffd9037c95969453445002d2e52ca278eba
248--- /dev/null
249+++ b/plugins/wd2/wd2/wd.plugin.zsh
250@@ -0,0 +1,9 @@
251+#!/bin/zsh
252+
253+# WARP
254+# ====
255+# oh-my-zsh plugin
256+#
257+# @github.com/mfaerevaag/wd
258+
259+alias wd='. ~/.oh-my-zsh/plugins/wd/wd.sh'
260diff --git a/plugins/wd2/wd2/wd.sh b/plugins/wd2/wd2/wd.sh
261new file mode 100755
262index 0000000000000000000000000000000000000000..7852028c061c8a96f411ecf286afa01b82e5e6aa
263--- /dev/null
264+++ b/plugins/wd2/wd2/wd.sh
265@@ -0,0 +1,201 @@
266+#!/bin/zsh
267+
268+# WARP
269+# ====
270+# Jump to custom directories in terminal
271+# because `cd` takes too long...
272+#
273+# @github.com/mfaerevaag/wd
274+
275+
276+## variables
277+CONFIG=$HOME/.warprc
278+
279+## colors
280+BLUE="\033[96m"
281+GREEN="\033[92m"
282+YELLOW="\033[93m"
283+RED="\033[91m"
284+NOC="\033[m"
285+
286+
287+## load warp points
288+typeset -A points
289+while read line
290+do
291+    arr=(${(s,:,)line})
292+    key=${arr[1]}
293+    val=${arr[2]}
294+
295+    points[$key]=$val
296+done < $CONFIG
297+
298+
299+## functions
300+# prepended wd_ to not conflict with your environment (no sub shell)
301+
302+wd_warp()
303+{
304+    if [[ $1 =~ "^\.+$" ]]
305+    then
306+        if [[ $#1 < 2 ]]
307+        then
308+            wd_print_msg $YELLOW "Warping to current directory?"
309+        else
310+            (( n = $#1 - 1 ))
311+            wd_print_msg $BLUE "Warping..."
312+            cd -$n > /dev/null
313+        fi
314+    elif [[ ${points[$1]} != "" ]]
315+    then
316+        wd_print_msg $BLUE "Warping..."
317+        cd ${points[$1]}
318+    else
319+        wd_print_msg $RED "Unkown warp point '$1'"
320+    fi
321+}
322+
323+wd_add()
324+{
325+    if [[ $1 =~ "^\.+$" ]]
326+    then
327+        wd_print_msg $RED "Illeagal warp point (see README)."
328+    elif [[ ${points[$1]} == "" ]] || $2
329+    then
330+        wd_remove $1 > /dev/null
331+        print "$1:$PWD" >> $CONFIG
332+        wd_print_msg $GREEN "Warp point added"
333+    else
334+        wd_print_msg $YELLOW "Warp point '$1' alredy exists. Use 'add!' to overwrite."
335+    fi
336+}
337+
338+wd_remove()
339+{
340+    if [[ ${points[$1]} != "" ]]
341+    then
342+        if wd_tmp=`sed "/^$1:/d" $CONFIG`
343+        then
344+            echo $wd_tmp > $CONFIG
345+            wd_print_msg $GREEN "Warp point removed"
346+        else
347+            wd_print_msg $RED "Warp point unsuccessfully removed. Sorry!"
348+        fi
349+    else
350+        wd_print_msg $RED "Warp point was not found"
351+    fi
352+}
353+
354+wd_show()
355+{
356+    wd_print_msg $BLUE "Warp points to current directory:"
357+    wd_list_all | grep $PWD$
358+}
359+
360+wd_list_all()
361+{
362+    wd_print_msg $BLUE "All warp points:"
363+    while read line
364+    do
365diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
366index 2db565266834e6fc01c1f4827ffb6868a37077dd..01cdc80e50364478c59274acd4925f4084ce611b 100644
367--- a/themes/agnoster.zsh-theme
368+++ b/themes/agnoster.zsh-theme
369@@ -95,38 +95,38 @@ prompt_git() {
370 }
371 
372 prompt_hg() {
373-	local rev status
374-	if $(hg id >/dev/null 2>&1); then
375-		if $(hg prompt >/dev/null 2>&1); then
376-			if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
377-				# if files are not added
378-				prompt_segment red white
379-				st='±'
380-			elif [[ -n $(hg prompt "{status|modified}") ]]; then
381-				# if any modification
382-				prompt_segment yellow black
383-				st='±'
384-			else
385-				# if working copy is clean
386-				prompt_segment green black
387-			fi
388-			echo -n $(hg prompt "☿ {rev}@{branch}") $st
389-		else
390-			st=""
391-			rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
392-			branch=$(hg id -b 2>/dev/null)
393-			if `hg st | grep -Eq "^\?"`; then
394-				prompt_segment red black
395-				st='±'
396-			elif `hg st | grep -Eq "^(M|A)"`; then
397-				prompt_segment yellow black
398-				st='±'
399-			else
400-				prompt_segment green black
401-			fi
402-			echo -n " $rev@$branch" $st
403-		fi
404-	fi
405+  local rev status
406+  if $(hg id >/dev/null 2>&1); then
407+    if $(hg prompt >/dev/null 2>&1); then
408+      if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
409+        # if files are not added
410+        prompt_segment red white
411+        st='±'
412+      elif [[ -n $(hg prompt "{status|modified}") ]]; then
413+        # if any modification
414+        prompt_segment yellow black
415+        st='±'
416+      else
417+        # if working copy is clean
418+        prompt_segment green black
419+      fi
420+      echo -n $(hg prompt "☿ {rev}@{branch}") $st
421+    else
422+      st=""
423+      rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
424+      branch=$(hg id -b 2>/dev/null)
425+      if `hg st | grep -Eq "^\?"`; then
426+        prompt_segment red black
427+        st='±'
428+      elif `hg st | grep -Eq "^(M|A)"`; then
429+        prompt_segment yellow black
430+        st='±'
431+      else
432+        prompt_segment green black
433+      fi
434+      echo -n "☿ $rev@$branch" $st
435+    fi
436+  fi
437 }
438 
439 # Dir: current working directory
440@@ -137,7 +137,7 @@ prompt_dir() {
441 # Virtualenv: current working virtualenv
442 prompt_virtualenv() {
443   local virtualenv_path="$VIRTUAL_ENV"
444-  if [[ -n $virtualenv_path && -z $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
445+  if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
446     prompt_segment blue black "(`basename $virtualenv_path`)"
447   fi
448 }
449diff --git a/themes/linuxonly b/themes/linuxonly.zsh-theme
450rename from themes/linuxonly
451rename to themes/linuxonly.zsh-theme