63deae380cece1abe4634e68a3e0df817b152da4

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

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

Diff

  1diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh
  2index de8d1052952acd5fc4934e290730a4813f6c590e..b91f93c9565620f53094880cef5bc0469ab3250f 100644
  3--- a/plugins/jira/jira.plugin.zsh
  4+++ b/plugins/jira/jira.plugin.zsh
  5@@ -1,20 +1,36 @@
  6 # To use: add a .jira-url file in the base of your project
  7+#         You can also set JIRA_URL in your .zshrc or put .jira-url in your home directory
  8+#         .jira-url in the current directory takes precedence
  9+#
 10+# If you use Rapid Board, set:
 11+#JIRA_RAPID_BOARD="yes"
 12+# in you .zshrc
 13+#
 14 # Setup: cd to/my/project
 15 #        echo "https://name.jira.com" >> .jira-url
 16 # Usage: jira           # opens a new issue
 17 #        jira ABC-123   # Opens an existing issue
 18 open_jira_issue () {
 19-  if [ ! -f .jira-url ]; then
 20-    echo "There is no .jira-url file in the current directory..."
 21-    return 0;
 22+  if [ -f .jira-url ]; then
 23+    jira_url=$(cat .jira-url)
 24+  elif [ -f ~/.jira-url ]; then
 25+    jira_url=$(cat ~/.jira-url)
 26+  elif [[ "x$JIRA_URL" != "x" ]]; then
 27+    jira_url=$JIRA_URL
 28   else
 29-    jira_url=$(cat .jira-url);
 30-    if [ -z "$1" ]; then
 31-      echo "Opening new issue";
 32-      `open $jira_url/secure/CreateIssue!default.jspa`;
 33+    echo "JIRA url is not specified anywhere."
 34+    return 0
 35+  fi
 36+
 37+  if [ -z "$1" ]; then
 38+    echo "Opening new issue"
 39+    `open $jira_url/secure/CreateIssue!default.jspa`
 40+  else
 41+    echo "Opening issue #$1"
 42+    if [[ "x$JIRA_RAPID_BOARD" = "yes" ]]; then
 43+      `open $jira_url/issues/$1`
 44     else
 45-      echo "Opening issue #$1";
 46-      `open $jira_url/browse/$1`;
 47+      `open $jira_url/browse/$1`
 48     fi
 49   fi
 50 }
 51diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh
 52index 5b3121d11d1992b2377cdf111f1d931a0b570bc1..190bc279d505cc9c985023f10a12ee694dbd3067 100644
 53--- a/plugins/last-working-dir/last-working-dir.plugin.zsh
 54+++ b/plugins/last-working-dir/last-working-dir.plugin.zsh
 55@@ -4,6 +4,7 @@
 56 
 57 # Flag indicating if we've previously jumped to last directory.
 58 typeset -g ZSH_LAST_WORKING_DIRECTORY
 59+mkdir -p "$ZSH/cache"
 60 local cache_file="$ZSH/cache/last-working-dir"
 61 
 62 # Updates the last directory once directory is changed.
 63diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh
 64index 9af70e7de8381b18615123b47b6117cfe5033935..1b2cbcdce16ce101454ea8a931f4416926c90efc 100755
 65--- a/plugins/sublime/sublime.plugin.zsh
 66+++ b/plugins/sublime/sublime.plugin.zsh
 67@@ -5,10 +5,11 @@ local _sublime_darwin_subl=/Applications/Sublime\ Text\ 2.app/Contents/SharedSup
 68 
 69 if [[ $('uname') == 'Linux' ]]; then
 70 	if [ -f '/usr/bin/sublime_text' ]; then
 71-		alias st='/usr/bin/sublime_text&'
 72+		st_run() { nohup /usr/bin/sublime_text $@ > /dev/null & }
 73 	else
 74-		alias st='/usr/bin/sublime-text&'
 75+		st_run() { nohup /usr/bin/sublime-text $@ > /dev/null & }
 76 	fi
 77+alias st=st_run
 78 elif  [[ $('uname') == 'Darwin' ]]; then
 79 	# Check if Sublime is installed in user's home application directory
 80 	if [[ -a $HOME/${_sublime_darwin_subl} ]]; then
 81diff --git a/plugins/urltools/urltools.plugin.zsh b/plugins/urltools/urltools.plugin.zsh
 82index 3de74ae3da10b5acb240e05a4a74f34fd1070447..4ddfff8ce23b6b0e5d0f6ab6c16ce5ada14389dd 100644
 83--- a/plugins/urltools/urltools.plugin.zsh
 84+++ b/plugins/urltools/urltools.plugin.zsh
 85@@ -4,6 +4,33 @@
 86 # Taken from:
 87 # http://ruslanspivak.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/
 88 
 89-alias urlencode='node -e "console.log(encodeURIComponent(process.argv[1]))"'
 90+if [[ $(whence $URLTOOLS_METHOD) = "" ]]; then
 91+    URLTOOLS_METHOD=""
 92+fi
 93 
 94-alias urldecode='node -e "console.log(decodeURIComponent(process.argv[1]))"'
 95+if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x"  || "x$URLTOOLS_METHOD" = "xnode" ) ]]; then
 96+    alias urlencode='node -e "console.log(encodeURIComponent(process.argv[1]))"'
 97+    alias urldecode='node -e "console.log(decodeURIComponent(process.argv[1]))"'
 98+elif [[ $(whence python) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then
 99+    alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
100+    alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'
101+elif [[ $(whence ruby) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xruby" ) ]]; then
102+    alias urlencode='ruby -r cgi -e "puts CGI.escape(ARGV[0])"'
103+    alias urldecode='ruby -r cgi -e "puts CGI.unescape(ARGV[0])"'
104+elif [[ $(whence php) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xphp" ) ]]; then
105+    alias urlencode='php -r "echo rawurlencode(\$argv[1]); echo \"\n\";"'
106+    alias urldecode='php -r "echo rawurldecode(\$argv[1]); echo \"\\n\";"'
107+elif [[ $(whence perl) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xperl" ) ]]; then
108+    if perl -MURI::Encode -e 1&> /dev/null; then
109+        alias urlencode='perl -MURI::Encode -ep "uri_encode($ARGV[0]);"'
110+        alias urldecode='perl -MURI::Encode -ep "uri_decode($ARGV[0]);"'
111+    elif perl -MURI::Escape -e 1 &> /dev/null; then
112+        alias urlencode='perl -MURI::Escape -ep "uri_escape($ARGV[0]);"'
113+        alias urldecode='perl -MURI::Escape -ep "uri_unescape($ARGV[0]);"'
114+    else
115+        alias urlencode="perl -e '\$new=\$ARGV[0]; \$new =~ s/([^A-Za-z0-9])/sprintf(\"%%%02X\", ord(\$1))/seg; print \"\$new\n\";'"
116+        alias urldecode="perl -e '\$new=\$ARGV[0]; \$new =~ s/\%([A-Fa-f0-9]{2})/pack(\"C\", hex(\$1))/seg; print \"\$new\n\";'"
117+    fi
118+fi
119+
120+unset URLTOOLS_METHOD
121diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh
122index c47ab72114562251e4ca75f1395dcaea1abe2002..f91be70e4c5316856b93f7a18134a3e62b66aabc 100644
123--- a/plugins/vi-mode/vi-mode.plugin.zsh
124+++ b/plugins/vi-mode/vi-mode.plugin.zsh
125@@ -1,8 +1,26 @@
126-function zle-line-init zle-keymap-select {
127+# Ensures that $terminfo values are valid and updates editor information when
128+# the keymap changes.
129+function zle-keymap-select zle-line-init zle-line-finish {
130+  # The terminal must be in application mode when ZLE is active for $terminfo
131+  # values to be valid.
132+  if (( $+terminfo[smkx] && $+terminfo[rmkx] )); then
133+    case "$0" in
134+      (zle-line-init)
135+        # Enable terminal application mode.
136+        echoti smkx
137+      ;;
138+      (zle-line-finish)
139+        # Disable terminal application mode.
140+        echoti rmkx
141+      ;;
142+    esac
143+  fi
144   zle reset-prompt
145+  zle -R
146 }
147 
148 zle -N zle-line-init
149+zle -N zle-line-finish
150 zle -N zle-keymap-select
151 
152 bindkey -v
153diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
154index a5abb77c3f26a9e0ac6b664f483471090be602e9..0ed2565b4fcd1bc2c0ced33cd18ebf71500c65d9 100644
155--- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
156+++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
157@@ -1,4 +1,4 @@
158-wrapsource=`which virtualenvwrapper.sh`
159+wrapsource=`which virtualenvwrapper_lazy.sh`
160 
161 if [[ -f "$wrapsource" ]]; then
162   source $wrapsource
163@@ -36,5 +36,5 @@ if [[ -f "$wrapsource" ]]; then
164     }
165   fi
166 else
167-  print "zsh virtualenvwrapper plugin: Cannot find virtualenvwrapper.sh. Please install with \`pip install virtualenvwrapper\`."
168+  print "zsh virtualenvwrapper plugin: Cannot find virtualenvwrapper_lazy.sh. Please install with \`pip install virtualenvwrapper\`."
169 fi
170diff --git a/themes/mortalscumbag.zsh-theme b/themes/mortalscumbag.zsh-theme
171index 7e25b149f8627231e0581d2ea531c76591dc987d..5dbf2e4f69417aa99423cad14509dce9579ee6dd 100644
172--- a/themes/mortalscumbag.zsh-theme
173+++ b/themes/mortalscumbag.zsh-theme
174@@ -46,7 +46,8 @@ function ssh_connection() {
175   fi
176 }
177 
178-PROMPT=$'\n$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_prompt) : %~\n%# '
179+local ret_status="%(?:%{$fg_bold[green]%}:%{$fg_bold[red]%})%?%{$reset_color%}"
180+PROMPT=$'\n$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_prompt) : %~\n[${ret_status}] %# '
181 
182 ZSH_THEME_PROMPT_RETURNCODE_PREFIX="%{$fg_bold[red]%}"
183 ZSH_THEME_GIT_PROMPT_PREFIX=" $fg[white]‹ %{$fg_bold[yellow]%}"