a21d57a17070ca21561fdb64deb29821c4cc6f30

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

This diff is truncated to protect this page.

  1diff --git a/lib/completion.zsh b/lib/completion.zsh
  2index f5b29247127543f4aec6ffec6bdb4b29bcdd9de1..bbd02165659dec1032d8f6ef98f0c276e6ab9677 100644
  3--- a/lib/completion.zsh
  4+++ b/lib/completion.zsh
  5@@ -1,4 +1,7 @@
  6 # fixme - the load process here seems a bit bizarre
  7+zmodload -i zsh/complist
  8+
  9+WORDCHARS=''
 10 
 11 unsetopt menu_complete   # do not autoselect the first completion entry
 12 unsetopt flowcontrol
 13@@ -6,32 +9,26 @@ setopt auto_menu         # show completion menu on succesive tab press
 14 setopt complete_in_word
 15 setopt always_to_end
 16 
 17-WORDCHARS=''
 18-
 19-zmodload -i zsh/complist
 20+# should this be in keybindings?
 21+bindkey -M menuselect '^o' accept-and-infer-next-history
 22+zstyle ':completion:*:*:*:*:*' menu select
 23 
 24-## case-insensitive (all),partial-word and then substring completion
 25-if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
 26-  zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
 27-  unset CASE_SENSITIVE
 28+# case insensitive (all), partial-word and substring completion
 29+if [[ "$CASE_SENSITIVE" = true ]]; then
 30+  zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*'
 31 else
 32-  if [ "x$HYPHEN_INSENSITIVE" = "xtrue" ]; then
 33-    zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
 34-    unset HYPHEN_INSENSITIVE
 35+  if [[ "$HYPHEN_INSENSITIVE" = true ]]; then
 36+    zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*'
 37   else
 38-    zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
 39+    zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
 40   fi
 41 fi
 42+unset CASE_SENSITIVE HYPHEN_INSENSITIVE
 43 
 44 zstyle ':completion:*' list-colors ''
 45-
 46-# should this be in keybindings?
 47-bindkey -M menuselect '^o' accept-and-infer-next-history
 48-
 49-zstyle ':completion:*:*:*:*:*' menu select
 50 zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
 51-if [ "$OSTYPE[0,7]" = "solaris" ]
 52-then
 53+
 54+if [[ "$OSTYPE" = solaris* ]]; then
 55   zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm"
 56 else
 57   zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
 58diff --git a/plugins/copybuffer/README.md b/plugins/copybuffer/README.md
 59new file mode 100644
 60index 0000000000000000000000000000000000000000..da138bdbd5c27d3fd2829d4c76aae0c3dedc917c
 61--- /dev/null
 62+++ b/plugins/copybuffer/README.md
 63@@ -0,0 +1,11 @@
 64+# `copybuffer` plugin
 65+
 66+This plugin binds the ctrl-o keyboard shortcut to a command that copies the text
 67+that is currently typed in the command line ($BUFFER) to the system clipboard.
 68+
 69+This is useful if you type a command - and before you hit enter to execute it - want
 70+to copy it maybe so you can paste it into a script, gist or whatnot.
 71+
 72+```zsh
 73+plugins=(... copybuffer)
 74+```
 75diff --git a/plugins/copybuffer/copybuffer.plugin.zsh b/plugins/copybuffer/copybuffer.plugin.zsh
 76new file mode 100644
 77index 0000000000000000000000000000000000000000..cc205d40f844c7be1df62132094b91d46ac05ba7
 78--- /dev/null
 79+++ b/plugins/copybuffer/copybuffer.plugin.zsh
 80@@ -0,0 +1,14 @@
 81+# copy the active line from the command line buffer 
 82+# onto the system clipboard (requires clipcopy plugin)
 83+
 84+copybuffer () {
 85+  if which clipcopy &>/dev/null; then
 86+    echo $BUFFER | clipcopy
 87+  else
 88+    echo "clipcopy function not found. Please make sure you have Oh My Zsh installed correctly."
 89+  fi
 90+}
 91+
 92+zle -N copybuffer
 93+
 94+bindkey "^O" copybuffer
 95diff --git a/plugins/docker/_docker b/plugins/docker/_docker
 96index 66dfeea9ef50a5a7142cca0ca41a6a0fe8206855..1366fd61b5af361aa7e798f8f60cb0ca6a4f165b 100644
 97--- a/plugins/docker/_docker
 98+++ b/plugins/docker/_docker
 99@@ -228,7 +228,7 @@ __docker_get_log_options() {
100     journald_options=("env" "labels" "tag")
101     json_file_options=("env" "labels" "max-file" "max-size")
102     syslog_options=("env" "labels" "syslog-address" "syslog-facility" "syslog-format" "syslog-tls-ca-cert" "syslog-tls-cert" "syslog-tls-key" "syslog-tls-skip-verify" "tag")
103-    splunk_options=("env" "labels" "splunk-caname" "splunk-capath" "splunk-format" "splunk-index" "splunk-insecureskipverify" "splunk-source" "splunk-sourcetype" "splunk-token" "splunk-url" "splunk-verify-connection" "tag")
104diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
105index 6197c234bce75c491dfd4a0ee0517742273d491b..25da035091cdd2495c51d12037909bd6bdace156 100644
106--- a/plugins/git/git.plugin.zsh
107+++ b/plugins/git/git.plugin.zsh
108@@ -46,6 +46,7 @@ alias gapa='git add --patch'
109 
110 alias gb='git branch'
111 alias gba='git branch -a'
112+alias gbd='git branch -d'
113 alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d'
114 alias gbl='git blame -b -w'
115 alias gbnm='git branch --no-merged'
116diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh
117index d290c98ec7b7b50ed36d9256a6710595dc6f916c..625aad94946e149ce8be0ec0a3e7860af483ce44 100644
118--- a/plugins/mvn/mvn.plugin.zsh
119+++ b/plugins/mvn/mvn.plugin.zsh
120@@ -172,7 +172,7 @@ function listMavenCompletions {
121         gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test
122 
123         # options
124-        -Dmaven.test.skip=true -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile -Dpmd.skip=true -Dcheckstyle.skip=true -Dtycho.mode=maven -Dmaven.test.failure.ignore=true
125+        -Dmaven.test.skip=true -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile -Dpmd.skip=true -Dcheckstyle.skip=true -Dtycho.mode=maven -Dmaven.test.failure.ignore=true -DgroupId= -DartifactId= -Dversion= -Dpackaging=jar -Dfile=
126 
127         # arguments
128         -am -amd -B -C -c -cpu -D -e -emp -ep -f -fae -ff -fn -gs -h -l -N -npr -npu -nsu -o -P -pl -q -rf -s -T -t -U -up -V -v -X
129diff --git a/plugins/ng/README.md b/plugins/ng/README.md
130new file mode 100644
131index 0000000000000000000000000000000000000000..86ad64041284fd29f7fcb34d4af0dfb59c0b1b7a
132--- /dev/null
133+++ b/plugins/ng/README.md
134@@ -0,0 +1,37 @@
135+## NG Plugin
136+
137+This [ng plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/ng)
138+ adds completion support for Angular's CLI (named ng).
139+
140+Ng is hosted on [ng home](https://github.com/catull/angular-cli)
141+
142+It is used to generate Angular 2 app "stubs", build those apps, configure them,
143+test them, lint them etc.
144+
145+Ahem, "stubs" is not what Angular engineers refer to the items ng can generate
146+for you.
147+
148+"Stubs" can be any one of:
149+- class
150+- component
151+- directive
152+- enum
153+- module
154+- pipe
155+- route
156+- service
157+
158+At the moment, `ng completion` creates a very rough completion for Zsh and
159+Bash.
160+
161+It is missing most of the options and a few arguments.
162+In future, this plugin may be shortened to simply being
163+
164+```zsh
165+eval `ng completion`
166+```
167+
168+There is hope this materialises in the 21st century.
169+
170+### CONTRIBUTOR
171+ - Carlo Dapor ([catull](https://github.com/catull))
172diff --git a/plugins/ng/ng.plugin.zsh b/plugins/ng/ng.plugin.zsh
173new file mode 100644
174index 0000000000000000000000000000000000000000..2488bc230fa40d011827f1510332f980619bc263
175--- /dev/null
176+++ b/plugins/ng/ng.plugin.zsh
177@@ -0,0 +1,77 @@
178+
179+ng_opts='addon asset-sizes b build completion d destroy doc e2e g generate get github-pages:deploy gh-pages:deploy h help i init install lint make-this-awesome new s serve server set t test v version -h --help'
180+
181+_ng_completion () {
182+  local words cword opts
183+  read -Ac words
184+  read -cn cword
185+  let cword-=1
186+
187+  case $words[cword] in
188+    addon )
189+      opts='-b --blueprint -d -dir --directory --dry-run -sb --skip-bower -sg --skip-git -sn --skip-npm -v --verbose'
190+      ;;
191+
192+    asset-sizes )
193+      opts='-o --output-path'
194+      ;;
195+
196+    b | build )
197+      opts='--environment --output-path --suppress-sizes --target --watch --watcher -dev -e -prod'
198+      ;;
199+
200+    d | destroy )
201+      opts='--dry-run --verbose --pod --classic --dummy --in-repo --in-repo-addon -d -v -p -c -dum -id -ir'
202+      ;;
203+
204+    g | generate )
205+      opts='class component directive enum module pipe route service --generate -d --dry-run --verbose -v --pod -p --classic -c --dummy -dum -id --in-repo --in-repo-addon -ir'
206+      ;;
207+
208+    gh-pages:deploy | github-pages:deploy )
209+      opts='--environment --gh-token --gh-username --skip-build --user-page --message'
210+      ;;
211+
212+    h | help | -h | --help)
213+      opts='--json --verbose -v'
214+      ;;
215+
216+    init )
217+      opts='--blueprint --dry-run --link-cli --mobile --name --prefix --skip-bower --skip-npm --source-dir --style --verbose -b -d -lc -n -p -sb -sd -sn -v'
218+      ;;
219+
220+    new )
221+      opts='--blueprint --directory --dry-run --link-cli --mobile --prefix --skip-bower --skip-git --skip-npm --source-dir --style --verbose -b -d -dir -lc -p -sb -sd -sg -sn -v'
222+      ;;
223+
224+    s | serve | server )
225diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh
226index 02e4f3e93f0deffbcf4ffbd93a045c294974d830..43aedc36d502a0f3dae6fa91426dcb026b11eda9 100644
227--- a/plugins/npm/npm.plugin.zsh
228+++ b/plugins/npm/npm.plugin.zsh
229@@ -32,6 +32,12 @@ alias npmE='PATH="$(npm bin)":"$PATH"'
230 # Check which npm modules are outdated
231 alias npmO="npm outdated"
232 
233+# Check package versions
234+alias npmV="npm -v"
235+
236+# List packages
237+alias npmL="npm list"
238+
239 # Run npm start
240 alias npmst="npm start"
241 
242diff --git a/plugins/perms/perms.plugin.zsh b/plugins/perms/perms.plugin.zsh
243index 81f56d577f7812c103bb383b8c8574b0a2f82607..7cdebab7f792e598241c7863954d79259adca62f 100644
244--- a/plugins/perms/perms.plugin.zsh
245+++ b/plugins/perms/perms.plugin.zsh
246@@ -6,10 +6,10 @@
247 ### Aliases
248 
249 # Set all files' permissions to 644 recursively in a directory
250-alias set644='find . -type f -print0 | xargs -0 chmod 644'
251+alias set644='find . -type f ! -perm 644 -print0 | xargs -0 chmod 644'
252 
253 # Set all directories' permissions to 755 recursively in a directory
254-alias set755='find . -type d -print0 | xargs -0 chmod 755'
255+alias set755='find . -type d ! -perm 755 -print0 | xargs -0 chmod 755'
256 
257 ### Functions
258 
259@@ -63,14 +63,14 @@ EOF
260   exit_status=0;
261   if [[ $use_slow == true ]]; then
262     # Process directories first so non-traversable ones are fixed as we go
263-    find "$target" -type d -exec chmod $chmod_opts 755 {} \;
264+    find "$target" -type d ! -perm 755 -exec chmod $chmod_opts 755 {} \;
265     if [[ $? != 0 ]]; then exit_status=$?; fi
266-    find "$target" -type f -exec chmod $chmod_opts 644 {} \;
267+    find "$target" -type f ! -perm 644 -exec chmod $chmod_opts 644 {} \;
268     if [[ $? != 0 ]]; then exit_status=$?; fi
269   else
270-    find "$target" -type d -print0 | xargs -0 chmod $chmod_opts 755
271+    find "$target" -type d ! -perm 755 -print0 | xargs -0 chmod $chmod_opts 755
272     if [[ $? != 0 ]]; then exit_status=$?; fi
273-    find "$target" -type f -print0 | xargs -0 chmod $chmod_opts 644
274+    find "$target" -type f ! -perm 644 -print0 | xargs -0 chmod $chmod_opts 644
275     if [[ $? != 0 ]]; then exit_status=$?; fi
276   fi
277   echo "Complete"
278diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh
279index e532639b528e9cdb6ae9aeea1375621112d18d3b..c8974b5f432e4a5d57c5fb93b4b1e8520da202b0 100644
280--- a/plugins/rails/rails.plugin.zsh
281+++ b/plugins/rails/rails.plugin.zsh
282@@ -36,6 +36,7 @@ alias -g RET='RAILS_ENV=test'
283 
284 # Rails aliases
285 alias rc='rails console'
286+alias rcs='rails console --sandbox'
287 alias rd='rails destroy'
288 alias rdb='rails dbconsole'
289 alias rg='rails generate'
290diff --git a/plugins/xcode/README.md b/plugins/xcode/README.md
291index 15e65785905ff2c58024bb54229904f86432a561..c12ce047fe51115b6ecda93c36883fb4539ff08b 100644
292--- a/plugins/xcode/README.md
293+++ b/plugins/xcode/README.md
294@@ -26,7 +26,7 @@ plugins=(... xcode)
295 
296 ###  `xc`
297 
298-Opens the current directory in Xcode as an Xcode project. This will open one of the `.xcworkspace` and `.xcodeproj` files that it can find in the current working directory.
299+Opens the current directory in Xcode as an Xcode project. This will open one of the `.xcworkspace` and `.xcodeproj` files that it can find in the current working directory. You can also specify a directory to look in for the Xcode files.
300 Returns 1 if it didn't find any relevant files.
301 
302 ###  `simulator`
303diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh
304index 0a2fa0839bdb99832f7d7eb4899959def7044002..f711c39fb6237e8b950ecbb9ca433afc7e2ebf51 100644
305--- a/plugins/xcode/xcode.plugin.zsh
306+++ b/plugins/xcode/xcode.plugin.zsh
307@@ -7,10 +7,19 @@ alias xcsel='sudo xcode-select --switch'
308 # source: http://gist.github.com/subdigital/5420709
309 function xc {
310   local xcode_proj
311-  xcode_proj=(*.{xcworkspace,xcodeproj}(N))
312+  if [[ $# == 0 ]]; then
313+    xcode_proj=(*.{xcworkspace,xcodeproj}(N))
314+  else
315+    xcode_proj=($1/*.{xcworkspace,xcodeproj}(N))
316+  fi
317+
318 
319   if [[ ${#xcode_proj} -eq 0 ]]; then
320-    echo "No xcworkspace/xcodeproj file found in the current directory."
321+    if [[ $# == 0 ]]; then
322+      echo "No xcworkspace/xcodeproj file found in the current directory."
323+    else
324+      echo "No xcworkspace/xcodeproj file found in $1."
325+    fi
326     return 1
327   else
328     echo "Found ${xcode_proj[1]}"
329diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
330index da1f9b6e6dfcaaebbdef2d47d63484e263b20e1f..07546fd34d437a4b04f89939d2a536a7b5451f7e 100644
331--- a/themes/agnoster.zsh-theme
332+++ b/themes/agnoster.zsh-theme
333@@ -86,7 +86,7 @@ prompt_context() {
334 
335 # Git: branch/detached head, dirty status
336 prompt_git() {
337-
338+  (( $+commands[git] )) || return
339   local PL_BRANCH_CHAR
340   () {
341     local LC_ALL="" LC_CTYPE="en_US.UTF-8"
342@@ -127,6 +127,28 @@ prompt_git() {
343   fi
344 }
345 
346+prompt_bzr() {
347+    (( $+commands[bzr] )) || return
348+    if (bzr status >/dev/null 2>&1); then
349+        status_mod=`bzr status | head -n1 | grep "modified" | wc -m`
350+        status_all=`bzr status | head -n1 | wc -m`
351+        revision=`bzr log | head -n2 | tail -n1 | sed 's/^revno: //'`
352+        if [[ $status_mod -gt 0 ]] ; then
353+            prompt_segment yellow black
354+            echo -n "bzr@"$revision "✚ "
355+        else
356+            if [[ $status_all -gt 0 ]] ; then
357+                prompt_segment yellow black
358+                echo -n "bzr@"$revision
359+
360+            else
361+                prompt_segment green black
362+                echo -n "bzr@"$revision
363+            fi
364+        fi
365+    fi
366+}
367+
368 prompt_hg() {
369   (( $+commands[hg] )) || return
370   local rev status
371@@ -198,6 +220,7 @@ build_prompt() {
372   prompt_context
373   prompt_dir
374   prompt_git
375+  prompt_bzr
376   prompt_hg
377   prompt_end
378 }
379diff --git a/themes/peepcode.zsh-theme b/themes/peepcode.zsh-theme
380index 9dc58294a5486c9794a5ef583bee9049b1fd3a97..b6dfa6870abc0c2c59b331392e3bdb813b853c7b 100644
381--- a/themes/peepcode.zsh-theme
382+++ b/themes/peepcode.zsh-theme
383@@ -41,10 +41,4 @@ PROMPT='
384 %~
385 ${smiley}  %{$reset_color%}'
386 
387-if [[ -d ~/.rvm ]] && [[ -e ~/.rvm/bin/rvm-prompt ]]; then
388-    rvm_prompt='$(~/.rvm/bin/rvm-prompt)'
389-else
390-    rvm_prompt=''
391-fi
392-
393-RPROMPT='%{$fg[white]%} $rvm_prompt$(git_prompt)%{$reset_color%}'
394+RPROMPT='%{$fg[white]%} $(ruby_prompt_info)$(git_prompt)%{$reset_color%}'