summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/adb/README.md8
-rw-r--r--plugins/adb/_adb39
-rw-r--r--plugins/archlinux/archlinux.plugin.zsh18
-rw-r--r--plugins/aws/aws.plugin.zsh15
-rw-r--r--plugins/battery/battery.plugin.zsh2
-rw-r--r--plugins/bbedit/README.md20
-rw-r--r--plugins/bbedit/bbedit.plugin.zsh21
-rw-r--r--plugins/brew/_brew1
-rw-r--r--plugins/brew/brew.plugin.zsh1
-rw-r--r--plugins/bundler/README.md49
-rw-r--r--plugins/bundler/_bundler13
-rw-r--r--plugins/bundler/bundler.plugin.zsh55
-rw-r--r--plugins/docker/_docker2
-rw-r--r--plugins/emoji-clock/emoji-clock.plugin.zsh4
-rw-r--r--plugins/frontend-search/frontend-search.plugin.zsh2
-rw-r--r--plugins/gem/_gem2
-rw-r--r--plugins/git-prompt/gitstatus.py2
-rw-r--r--plugins/git/git.plugin.zsh17
-rw-r--r--plugins/gitignore/gitignore.plugin.zsh12
-rw-r--r--plugins/jira/jira.plugin.zsh55
-rw-r--r--plugins/marked2/README.md13
-rw-r--r--plugins/marked2/marked2.plugin.zsh12
-rw-r--r--plugins/mvn/mvn.plugin.zsh6
-rw-r--r--plugins/node/node.plugin.zsh2
-rw-r--r--plugins/osx/osx.plugin.zsh5
-rw-r--r--plugins/pass/_pass33
-rw-r--r--plugins/pj/pj.plugin.zsh11
-rw-r--r--plugins/postgres/postgres.plugin.zsh8
-rw-r--r--plugins/rails/rails.plugin.zsh4
-rw-r--r--plugins/rake-fast/rake-fast.plugin.zsh2
-rw-r--r--plugins/rvm/rvm.plugin.zsh12
-rw-r--r--plugins/sublime/sublime.plugin.zsh2
-rw-r--r--plugins/symfony2/symfony2.plugin.zsh26
-rw-r--r--plugins/textastic/README.md15
-rw-r--r--plugins/textastic/textastic.plugin.zsh17
-rw-r--r--plugins/tmuxinator/_tmuxinator6
-rw-r--r--plugins/vagrant/_vagrant3
-rw-r--r--plugins/virtualenv/virtualenv.plugin.zsh5
-rw-r--r--plugins/wd/LICENSE21
-rw-r--r--plugins/wd/README.md26
-rw-r--r--plugins/wd/_wd.sh15
-rw-r--r--plugins/wd/wd.plugin.zsh4
-rwxr-xr-xplugins/wd/wd.sh159
-rw-r--r--plugins/web-search/web-search.plugin.zsh7
-rw-r--r--plugins/wp-cli/README.md105
-rw-r--r--plugins/wp-cli/wp-cli.plugin.zsh138
-rw-r--r--plugins/xcode/xcode.plugin.zsh7
-rw-r--r--plugins/zsh_reload/zsh_reload.plugin.zsh5
48 files changed, 843 insertions, 164 deletions
diff --git a/plugins/adb/README.md b/plugins/adb/README.md
new file mode 100644
index 000000000..075beec0e
--- /dev/null
+++ b/plugins/adb/README.md
@@ -0,0 +1,8 @@
+# adb autocomplete plugin
+
+* Adds autocomplete options for all adb commands.
+
+
+## Requirements
+
+In order to make this work, you will need to have the Android adb tools set up in your path.
diff --git a/plugins/adb/_adb b/plugins/adb/_adb
new file mode 100644
index 000000000..4c998172d
--- /dev/null
+++ b/plugins/adb/_adb
@@ -0,0 +1,39 @@
+#compdef adb
+#autoload
+
+# in order to make this work, you will need to have the android adb tools
+
+# adb zsh completion, based on homebrew completion
+
+local -a _1st_arguments
+_1st_arguments=(
+'bugreport:return all information from the device that should be included in a bug report.'
+'connect:connect to a device via TCP/IP Port 5555 is default.'
+'devices:list all connected devices'
+'disconnect:disconnect from a TCP/IP device. Port 5555 is default.'
+'emu:run emulator console command'
+'forward:forward socket connections'
+'help:show the help message'
+'install:push this package file to the device and install it'
+'jdwp:list PIDs of processes hosting a JDWP transport'
+'logcat:View device log'
+'pull:copy file/dir from device'
+'push:copy file/dir to device'
+'shell:run remote shell interactively'
+'sync:copy host->device only if changed (-l means list but dont copy)'
+'uninstall:remove this app package from the device'
+'version:show version num'
+)
+
+local expl
+local -a pkgs installed_pkgs
+
+_arguments \
+ '*:: :->subcmds' && return 0
+
+if (( CURRENT == 1 )); then
+ _describe -t commands "adb subcommand" _1st_arguments
+ return
+fi
+
+_files
diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh
index bffe9657a..059884c27 100644
--- a/plugins/archlinux/archlinux.plugin.zsh
+++ b/plugins/archlinux/archlinux.plugin.zsh
@@ -21,10 +21,14 @@ if [[ -x `which yaourt` ]]; then
alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local")
alias yaorph='yaourt -Qtd' # Remove orphans using yaourt
# Additional yaourt alias examples
- if [[ -x `which abs` ]]; then
+ if [[ -x `which abs` && -x `which aur` ]]; then
+ alias yaupd='yaourt -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
+ elif [[ -x `which abs` ]]; then
alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
+ elif [[ -x `which aur` ]]; then
+ alias yaupd='yaourt -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
else
- alias yaupd='yaourt -Sy' # Update and refresh the local package and ABS databases against repositories
+ alias yaupd='yaourt -Sy' # Update and refresh the local package database against repositories
fi
alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package
alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
@@ -45,10 +49,14 @@ alias pacreps='pacman -Ss' # Search for package(s) in the repositori
alias pacloc='pacman -Qi' # Display information about a given package in the local database
alias paclocs='pacman -Qs' # Search for package(s) in the local database
# Additional pacman alias examples
-if [[ -x `which abs` ]]; then
- alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
+if [[ -x `which abs` && -x `which aur` ]]; then
+ alias pacupd='sudo pacman -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
+elif [[ -x `which abs` ]]; then
+ alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
+elif [[ -x `which aur` ]]; then
+ alias pacupd='sudo pacman -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
else
- alias pacupd='sudo pacman -Sy' # Update and refresh the local package and ABS databases against repositories
+ alias pacupd='sudo pacman -Sy' # Update and refresh the local package database against repositories
fi
alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package
alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
index 3f7fb1995..8b57d7db1 100644
--- a/plugins/aws/aws.plugin.zsh
+++ b/plugins/aws/aws.plugin.zsh
@@ -1,3 +1,11 @@
+_homebrew-installed() {
+ type brew &> /dev/null
+}
+
+_awscli-homebrew-installed() {
+ brew --prefix awscli &> /dev/null
+}
+
export AWS_HOME=~/.aws
function agp {
@@ -14,4 +22,9 @@ function aws_profiles {
}
compctl -K aws_profiles asp
-source `which aws_zsh_completer.sh`
+
+if _homebrew-installed && _awscli-homebrew-installed ; then
+ source $(brew --prefix)/opt/awscli/libexec/bin/aws_zsh_completer.sh
+else
+ source `which aws_zsh_completer.sh`
+fi
diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh
index 32dd4b624..014bb15dd 100644
--- a/plugins/battery/battery.plugin.zsh
+++ b/plugins/battery/battery.plugin.zsh
@@ -8,7 +8,7 @@
# Modified to add support for Apple Mac #
###########################################
-if [[ $(uname) == "Darwin" ]] ; then
+if [[ "$OSTYPE" = darwin* ]] ; then
function battery_pct() {
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
diff --git a/plugins/bbedit/README.md b/plugins/bbedit/README.md
new file mode 100644
index 000000000..ec2b743d6
--- /dev/null
+++ b/plugins/bbedit/README.md
@@ -0,0 +1,20 @@
+## bbedit
+
+Plugin for BBEdit, an HTML and text editor for Mac OS X
+
+### Requirements
+
+ * [BBEdit](http://www.barebones.com/products/bbedit/)
+ * [BBEdit Command-Line Tools](http://www.barebones.com/support/bbedit/cmd-line-tools.html)
+
+### Usage
+
+ * If the `bb` command is called without an argument, launch BBEdit
+
+ * If `bb` is passed a directory, cd to it and open it in BBEdit
+
+ * If `bb` is passed a file, open it in BBEdit
+
+ * If `bbpb` create a new BBEdit document with the contents of the clipboard
+
+ * If `bbd` alias for BBEdit diff tool
diff --git a/plugins/bbedit/bbedit.plugin.zsh b/plugins/bbedit/bbedit.plugin.zsh
new file mode 100644
index 000000000..fe9e72c65
--- /dev/null
+++ b/plugins/bbedit/bbedit.plugin.zsh
@@ -0,0 +1,21 @@
+alias bbpb='pbpaste | bbedit --clean --view-top'
+
+alias bbd=bbdiff
+
+#
+# If the bb command is called without an argument, launch BBEdit
+# If bb is passed a directory, cd to it and open it in BBEdit
+# If bb is passed a file, open it in BBEdit
+#
+function bb() {
+ if [[ -z "$1" ]]
+ then
+ bbedit --launch
+ else
+ bbedit "$1"
+ if [[ -d "$1" ]]
+ then
+ cd "$1"
+ fi
+ fi
+}
diff --git a/plugins/brew/_brew b/plugins/brew/_brew
index 9eb3bb557..40442a1d3 100644
--- a/plugins/brew/_brew
+++ b/plugins/brew/_brew
@@ -50,6 +50,7 @@ _1st_arguments=(
'server:start a local web app that lets you browse formulae (requires Sinatra)'
'services:small wrapper around `launchctl` for supported formulae'
'tap:tap a new formula repository from GitHub, or list existing taps'
+ 'uninstall:uninstall a formula'
'unlink:unlink a formula'
'unpin:unpin specified formulae'
'untap:remove a tapped repository'
diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh
index c2e95884e..42fb80c9a 100644
--- a/plugins/brew/brew.plugin.zsh
+++ b/plugins/brew/brew.plugin.zsh
@@ -1 +1,2 @@
alias brews='brew list -1'
+alias bubu="brew update && brew upgrade && brew cleanup"
diff --git a/plugins/bundler/README.md b/plugins/bundler/README.md
new file mode 100644
index 000000000..56f0c7176
--- /dev/null
+++ b/plugins/bundler/README.md
@@ -0,0 +1,49 @@
+# Bundler
+
+- adds completion for basic bundler commands
+- adds short aliases for common bundler commands
+ - `be` aliased to `bundle exec`
+ - `bl` aliased to `bundle list`
+ - `bp` aliased to `bundle package`
+ - `bo` aliased to `bundle open`
+ - `bu` aliased to `bundle update`
+ - `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`)
+- adds a wrapper for common gems:
+ - looks for a binstub under `./bin/` and executes it (if present)
+ - calls `bundle exec <gem executable>` otherwise
+
+For a full list of *common gems* being wrapped by default please look at the `bundler.plugin.zsh` file.
+
+## Configuration
+
+Please use the exact name of the executable and not the gem name.
+
+### Add additional gems to be wrapped
+
+Add this before the plugin-list in your `.zshrc`:
+```sh
+BUNDLED_COMMANDS=(rubocop)
+plugins=(... bundler ...)
+```
+This will add the wrapper for the `rubocop` gem (i.e. the executable).
+
+
+### Exclude gems from being wrapped
+
+Add this before the plugin-list in your `.zshrc`:
+```sh
+UNBUNDLED_COMMANDS=(foreman spin)
+plugins=(... bundler ...)
+```
+This will exclude the `foreman` and `spin` gems (i.e. their executable) from being wrapped.
+
+## Excluded gems
+
+These gems should not be called with `bundle exec`. Please see the Issues on GitHub for clarification.
+
+`berks`
+`foreman`
+`mailcatcher`
+`rails`
+`ruby`
+`spin`
diff --git a/plugins/bundler/_bundler b/plugins/bundler/_bundler
index 2ec3a5f9c..ba647ab80 100644
--- a/plugins/bundler/_bundler
+++ b/plugins/bundler/_bundler
@@ -18,11 +18,13 @@ case $state in
"check[Determine whether the requirements for your application are installed]" \
"list[Show all of the gems in the current bundle]" \
"show[Show the source location of a particular gem in the bundle]" \
+ "outdated[Show all of the outdated gems in the current bundle]" \
"console[Start an IRB session in the context of the current bundle]" \
"open[Open an installed gem in the editor]" \
"viz[Generate a visual representation of your dependencies]" \
"init[Generate a simple Gemfile, placed in the current directory]" \
"gem[Create a simple gem, suitable for development with bundler]" \
+ "platform[Displays platform compatibility information]" \
"clean[Cleans up unused gems in your bundler directory]" \
"help[Describe available tasks or one specific task]"
ret=0
@@ -39,11 +41,13 @@ case $state in
'check' \
'list' \
'show' \
+ 'outdated' \
'console' \
'open' \
'viz' \
'init' \
'gem' \
+ 'platform' \
'help' && ret=0
;;
install)
@@ -71,6 +75,15 @@ case $state in
'(--verbose)--verbose[Enable verbose output mode]'
ret=0
;;
+ outdated)
+ _arguments \
+ '(--pre)--pre[Check for newer pre-release gems]' \
+ '(--source)--source[Check against a specific source]' \
+ '(--local)--local[Do not attempt to fetch gems remotely and use the gem cache instead]' \
+ '(--no-color)--no-color[Disable colorization in output]' \
+ '(--verbose)--verbose[Enable verbose output mode]'
+ ret=0
+ ;;
(open|show)
_gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') )
if [[ $_gems != "" ]]; then
diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
index 20931dcef..ba3d3f623 100644
--- a/plugins/bundler/bundler.plugin.zsh
+++ b/plugins/bundler/bundler.plugin.zsh
@@ -5,22 +5,56 @@ alias bo="bundle open"
alias bu="bundle update"
alias bi="bundle_install"
-# The following is based on https://github.com/gma/bundler-exec
-
-bundled_commands=(annotate berks cap capify cucumber foodcritic foreman guard irb jekyll kitchen knife middleman nanoc puma rackup rainbows rake rspec ruby shotgun spec spin spork spring strainer tailor taps thin thor unicorn unicorn_rails)
+bundled_commands=(
+ annotate
+ cap
+ capify
+ cucumber
+ foodcritic
+ guard
+ irb
+ jekyll
+ kitchen
+ knife
+ middleman
+ nanoc
+ pry
+ puma
+ rackup
+ rainbows
+ rake
+ rspec
+ shotgun
+ sidekiq
+ spec
+ spork
+ spring
+ strainer
+ tailor
+ taps
+ thin
+ thor
+ unicorn
+ unicorn_rails
+)
# Remove $UNBUNDLED_COMMANDS from the bundled_commands list
for cmd in $UNBUNDLED_COMMANDS; do
bundled_commands=(${bundled_commands#$cmd});
done
+# Add $BUNDLED_COMMANDS to the bundled_commands list
+for cmd in $BUNDLED_COMMANDS; do
+ bundled_commands+=($cmd);
+done
+
## Functions
bundle_install() {
if _bundler-installed && _within-bundled-project; then
local bundler_version=`bundle version | cut -d' ' -f3`
if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
- if [[ "$(uname)" == 'Darwin' ]]
+ if [[ "$OSTYPE" = darwin* ]]
then
local cores_num="$(sysctl hw.ncpu | awk '{print $2}')"
else
@@ -48,9 +82,17 @@ _within-bundled-project() {
false
}
+_binstubbed() {
+ [ -f "./bin/${1}" ]
+}
+
_run-with-bundler() {
if _bundler-installed && _within-bundled-project; then
- bundle exec $@
+ if _binstubbed $1; then
+ ./bin/$@
+ else
+ bundle exec $@
+ fi
else
$@
fi
@@ -63,7 +105,6 @@ for cmd in $bundled_commands; do
alias $cmd=bundled_$cmd
if which _$cmd > /dev/null 2>&1; then
- compdef _$cmd bundled_$cmd=$cmd
+ compdef _$cmd bundled_$cmd=$cmd
fi
done
-
diff --git a/plugins/docker/_docker b/plugins/docker/_docker
index c291037a3..28568a6e5 100644
--- a/plugins/docker/_docker
+++ b/plugins/docker/_docker
@@ -214,7 +214,7 @@ __save() {
__start() {
_arguments \
'(-a,--attach=)'{-a,--attach=}'[Attach container''s stdout/stderr and forward all signals to the process]' \
- '(-i,--interactive=)'{-i, --interactive=}'[Attach container''s stdin]'
+ '(-i,--interactive=)'{-i,--interactive=}'[Attach container''s stdin]'
__docker_containers
}
diff --git a/plugins/emoji-clock/emoji-clock.plugin.zsh b/plugins/emoji-clock/emoji-clock.plugin.zsh
index 7351a02ec..a69446e3c 100644
--- a/plugins/emoji-clock/emoji-clock.plugin.zsh
+++ b/plugins/emoji-clock/emoji-clock.plugin.zsh
@@ -8,8 +8,8 @@
# -----------------------------------------------------------------------------
function emoji-clock() {
- hour=$(date '+%I')
- minutes=$(date '+%M')
+ hour=$(date -v '+15M' '+%I')
+ minutes=$(date -v '+15M' '+%M')
case $hour in
01) clock="🕐"; [ $minutes -ge 30 ] && clock="🕜";;
02) clock="🕑"; [ $minutes -ge 30 ] && clock="🕝";;
diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh
index 38b1a80ea..f1d45b0d1 100644
--- a/plugins/frontend-search/frontend-search.plugin.zsh
+++ b/plugins/frontend-search/frontend-search.plugin.zsh
@@ -118,7 +118,7 @@ alias jquery='frontend jquery'
alias mdn='frontend mdn'
# pre processors frameworks
-alias compass='frontend compass'
+alias compassdoc='frontend compass'
# important links
alias html5please='frontend html5please'
diff --git a/plugins/gem/_gem b/plugins/gem/_gem
index 25967f1e7..92feebe95 100644
--- a/plugins/gem/_gem
+++ b/plugins/gem/_gem
@@ -59,6 +59,8 @@ case "$words[1]" in
build)
_files -g "*.gemspec"
;;
+ install)
+ _files ;;
list)
if [[ "$state" == forms ]]; then
_gem_installed
diff --git a/plugins/git-prompt/gitstatus.py b/plugins/git-prompt/gitstatus.py
index c665a9ee1..256841432 100644
--- a/plugins/git-prompt/gitstatus.py
+++ b/plugins/git-prompt/gitstatus.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from subprocess import Popen, PIPE
import re
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index 9f7819df3..bf7cd1ac9 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -7,6 +7,8 @@ alias gd='git diff'
compdef _git gd=git-diff
alias gdc='git diff --cached'
compdef _git gdc=git-diff
+alias gdt='git diff-tree --no-commit-id --name-only -r'
+compdef _git gdc=git diff-tree --no-commit-id --name-only -r
alias gl='git pull'
compdef _git gl=git-pull
alias gup='git pull --rebase'
@@ -16,6 +18,7 @@ compdef _git gp=git-push
alias gd='git diff'
gdv() { git diff -w "$@" | view - }
compdef _git gdv=git-diff
+alias gdt='git difftool'
alias gc='git commit -v'
compdef _git gc=git-commit
alias gc!='git commit -v --amend'
@@ -51,6 +54,7 @@ alias gb='git branch'
compdef _git gb=git-branch
alias gba='git branch -a'
compdef _git gba=git-branch
+alias gbr='git branch --remote'
alias gcount='git shortlog -sn'
compdef gcount=git
alias gcl='git config --list'
@@ -70,6 +74,7 @@ alias gss='git status -s'
compdef _git gss=git-status
alias ga='git add'
compdef _git ga=git-add
+alias gap='git add --patch'
alias gm='git merge'
compdef _git gm=git-merge
alias grh='git reset HEAD'
@@ -77,6 +82,18 @@ alias grhh='git reset HEAD --hard'
alias gclean='git reset --hard && git clean -dfx'
alias gwc='git whatchanged -p --abbrev-commit --pretty=medium'
+# Sign and verify commits with GPG
+alias gcs='git commit -S'
+compdef _git gcs=git-commit
+alias gsps='git show --pretty=short --show-signature'
+compdef _git gsps=git-show
+
+# Sign and verify tags with GPG
+alias gts='git tag -s'
+compdef _git gts=git-tag
+alias gvt='git verify-tag'
+compdef _git gvt=git verify-tag
+
#remove the gf alias
#alias gf='git ls-files | grep'
diff --git a/plugins/gitignore/gitignore.plugin.zsh b/plugins/gitignore/gitignore.plugin.zsh
index be037d87a..481d487ba 100644
--- a/plugins/gitignore/gitignore.plugin.zsh
+++ b/plugins/gitignore/gitignore.plugin.zsh
@@ -1,12 +1,12 @@
-function gi() { curl http://www.gitignore.io/api/$@ ;}
+function gi() { curl -sL https://www.gitignore.io/api/$@ ;}
-_gitignireio_get_command_list() {
- curl -s http://www.gitignore.io/api/list | tr "," "\n"
+_gitignoreio_get_command_list() {
+ curl -sL https://www.gitignore.io/api/list | tr "," "\n"
}
-_gitignireio () {
+_gitignoreio () {
compset -P '*,'
- compadd -S '' `_gitignireio_get_command_list`
+ compadd -S '' `_gitignoreio_get_command_list`
}
-compdef _gitignireio gi
+compdef _gitignoreio gi
diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh
index 739ee7142..4a36b882d 100644
--- a/plugins/jira/jira.plugin.zsh
+++ b/plugins/jira/jira.plugin.zsh
@@ -12,7 +12,7 @@
# jira ABC-123 # Opens an existing issue
open_jira_issue () {
local open_cmd
- if [[ $(uname -s) == 'Darwin' ]]; then
+ if [[ "$OSTYPE" = darwin* ]]; then
open_cmd='open'
else
open_cmd='xdg-open'
@@ -26,20 +26,65 @@ open_jira_issue () {
jira_url=$JIRA_URL
else
echo "JIRA url is not specified anywhere."
- return 0
+ return 1
+ fi
+
+ if [ -f .jira-prefix ]; then
+ jira_prefix=$(cat .jira-prefix)
+ elif [ -f ~/.jira-prefix ]; then
+ jira_prefix=$(cat ~/.jira-prefix)
+ else
+ jira_prefix=""
fi
if [ -z "$1" ]; then
echo "Opening new issue"
- $open_cmd "$jira_url/secure/CreateIssue!default.jspa"
+ $open_cmd "${jira_url}/secure/CreateIssue!default.jspa"
+ elif [[ "$1" = "assigned" || "$1" = "reported" ]]; then
+ jira_query $@
else
echo "Opening issue #$1"
if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then
- $open_cmd "$jira_url/issues/$1"
+ $open_cmd "$jira_url/issues/$jira_prefix$1"
else
- $open_cmd "$jira_url/browse/$1"
+ $open_cmd "$jira_url/browse/$jira_prefix$1"
fi
fi
}
+jira_name () {
+ if [[ -z "$1" ]]; then
+ if [[ "x${JIRA_NAME}" != "x" ]]; then
+ jira_name=${JIRA_NAME}
+ else
+ echo "JIRA_NAME not specified"
+ return 1
+ fi
+ else
+ jira_name=$@
+ fi
+}
+
+jira_query () {
+ verb="$1"
+ if [[ "${verb}" = "reported" ]]; then
+ lookup=reporter
+ preposition=by
+ elif [[ "${verb}" = "assigned" ]]; then
+ lookup=assignee
+ preposition=to
+ else
+ echo "not a valid lookup $verb"
+ return 1
+ fi
+ shift 1
+ jira_name $@
+ if [[ $? = 1 ]]; then
+ return 1
+ fi
+ echo "Browsing issues ${verb} ${preposition} ${jira_name}"
+ $open_cmd "${jira_url}/secure/IssueNavigator.jspa?reset=true&jqlQuery=${lookup}+%3D+%22${jira_name}%22+AND+resolution+%3D+unresolved+ORDER+BY+priority+DESC%2C+created+ASC"
+}
+
alias jira='open_jira_issue'
+
diff --git a/plugins/marked2/README.md b/plugins/marked2/README.md
new file mode 100644
index 000000000..101343abb
--- /dev/null
+++ b/plugins/marked2/README.md
@@ -0,0 +1,13 @@
+## marked2
+
+Plugin for Marked 2, a previewer for Markdown files on Mac OS X
+
+### Requirements
+
+ * [Marked 2](http://marked2app.com)
+
+### Usage
+
+ * If `marked` is called without an argument, open Marked
+
+ * If `marked` is passed a file, open it in Marked
diff --git a/plugins/marked2/marked2.plugin.zsh b/plugins/marked2/marked2.plugin.zsh
new file mode 100644
index 000000000..56863ade5
--- /dev/null
+++ b/plugins/marked2/marked2.plugin.zsh
@@ -0,0 +1,12 @@
+#
+# If marked is called without an argument, open Marked
+# If marked is passed a file, open it in Marked
+#
+function marked() {
+ if [ "$1" ]
+ then
+ open -a "marked 2.app" "$1"
+ else
+ open -a "marked 2.app"
+ fi
+}
diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh
index 2b7683078..0c4f77162 100644
--- a/plugins/mvn/mvn.plugin.zsh
+++ b/plugins/mvn/mvn.plugin.zsh
@@ -64,7 +64,7 @@ alias mvns='mvn site'
function listMavenCompletions {
reply=(
# common lifecycle
- clean process-resources compile process-test-resources test-compile test package verify install deploy site
+ clean process-resources compile process-test-resources test-compile test integration-test package verify install deploy site
# common plugins
deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt
@@ -129,6 +129,10 @@ function listMavenCompletions {
tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy
# tomcat7
tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy
+ # tomee
+ tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy
+ # spring-boot
+ spring-boot:run spring-boot:repackage
# exec
exec:exec exec:java
# versions
diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh
index 2d78f2b4c..39d8b10d9 100644
--- a/plugins/node/node.plugin.zsh
+++ b/plugins/node/node.plugin.zsh
@@ -3,7 +3,7 @@
function node-docs {
# get the open command
local open_cmd
- if [[ $(uname -s) == 'Darwin' ]]; then
+ if [[ "$OSTYPE" = darwin* ]]; then
open_cmd='open'
else
open_cmd='xdg-open'
diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
index 63760b5ff..a63f0ee05 100644
--- a/plugins/osx/osx.plugin.zsh
+++ b/plugins/osx/osx.plugin.zsh
@@ -174,12 +174,16 @@ function itunes() {
next|previous)
opt="$opt track"
;;
+ vol)
+ opt="set sound volume to $1" #$1 Due to the shift
+ ;;
""|-h|--help)
echo "Usage: itunes <option>"
echo "option:"
echo "\tlaunch|play|pause|stop|rewind|resume|quit"
echo "\tmute|unmute\tcontrol volume set"
echo "\tnext|previous\tplay next or previous track"
+ echo "\tvol\tSet the volume, takes an argument from 0 to 100"
echo "\thelp\tshow this message and exit"
return 0
;;
@@ -190,4 +194,3 @@ function itunes() {
esac
osascript -e "tell application \"iTunes\" to $opt"
}
-
diff --git a/plugins/pass/_pass b/plugins/pass/_pass
index d8ec38828..7a9b1f955 100644
--- a/plugins/pass/_pass
+++ b/plugins/pass/_pass
@@ -1,13 +1,16 @@
#compdef pass
#autoload
-# Copyright (C) 2012:
+# Copyright (C) 2012 - 2014:
# Johan Venant <jvenant@invicem.pro>
# Brian Mattern <rephorm@rephorm.com>
# Jason A. Donenfeld <Jason@zx2c4.com>.
-# Santiago Borrazás <sanbor@gmail.com>
# All Rights Reserved.
-# This file is licensed under the GPLv2+. Please see COPYING for more information.
+#
+# This file is licensed under the GPLv2+.
+# Please visit http://git.zx2c4.com/password-store/tree/COPYING for more information.
+#
+# Oh my zsh plugin maintainer: Santiago Borrazás <sanbor@gmail.com>
_pass () {
@@ -23,8 +26,8 @@ _pass () {
case "${cmd}" in
init)
_arguments : \
- "-r[re-encrypt existing passwords]" \
- "--reencrypt[re-encrypt existing passwords]"
+ "-p[gpg-id will only be applied to this subfolder]" \
+ "--path[gpg-id will only be applied to this subfolder]"
_pass_complete_keys
;;
ls|list|edit)
@@ -43,9 +46,19 @@ _pass () {
"-n[don't include symbols in password]" \
"--no-symbols[don't include symbols in password]" \
"-c[copy password to the clipboard]" \
- "--clip[copy password to the clipboard]"
+ "--clip[copy password to the clipboard]" \
+ "-f[force overwrite]" \
+ "--force[force overwrite]" \
+ "-i[replace first line]" \
+ "--in-place[replace first line]"
_pass_complete_entries_with_subdirs
;;
+ cp|copy|mv|rename)
+ _arguments : \
+ "-f[force rename]" \
+ "--force[force rename]"
+ _pass_complete_entries_with_subdirs
+ ;;
rm)
_arguments : \
"-f[force deletion]" \
@@ -75,10 +88,14 @@ _pass () {
subcommands=(
"init:Initialize new password storage"
"ls:List passwords"
+ "find:Find password files or directories based on pattern"
+ "grep:Search inside decrypted password files for matching pattern"
"show:Decrypt and print a password"
"insert:Insert a new password"
"generate:Generate a new password using pwgen"
"edit:Edit a password with \$EDITOR"
+ "mv:Rename the password"
+ "cp:Copy the password"
"rm:Remove the password"
"git:Call git on the password store"
"version:Output version information"
@@ -101,7 +118,7 @@ _pass_cmd_show () {
_pass_complete_entries_helper () {
local IFS=$'\n'
local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
- _values -C 'passwords' $(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print | sed -e "s#${prefix}.##" -e 's#\.gpg##' | sort)
+ _values -C 'passwords' ${$(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print 2>/dev/null | sed -e "s#${prefix}/\{0,1\}##" -e 's#\.gpg##' | sort):-""}
}
_pass_complete_entries_with_subdirs () {
@@ -117,3 +134,5 @@ _pass_complete_keys () {
# Extract names and email addresses from gpg --list-keys
_values 'gpg keys' $(gpg2 --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d')
}
+
+_pass
diff --git a/plugins/pj/pj.plugin.zsh b/plugins/pj/pj.plugin.zsh
index ba3765b83..f9cbddf1a 100644
--- a/plugins/pj/pj.plugin.zsh
+++ b/plugins/pj/pj.plugin.zsh
@@ -18,8 +18,11 @@ function pj() {
file=$1
if [[ "open" == "$file" ]] then
- file=$2
+ shift
+ file=$*
cmd=(${(s: :)EDITOR})
+ else
+ file=$*
fi
for project in $PROJECT_PATHS; do
@@ -36,7 +39,11 @@ function pj() {
alias pjo="pj open"
function _pj () {
- compadd `/bin/ls -l $PROJECT_PATHS 2>/dev/null | awk '{ print $9 }'`
+ # might be possible to improve this using glob, without the basename trick
+ typeset -a projects
+ projects=($PROJECT_PATHS/*)
+ projects=$projects:t
+ _arguments '*:file:($projects)'
}
compdef _pj pj
diff --git a/plugins/postgres/postgres.plugin.zsh b/plugins/postgres/postgres.plugin.zsh
index cdd142e92..c2dbef244 100644
--- a/plugins/postgres/postgres.plugin.zsh
+++ b/plugins/postgres/postgres.plugin.zsh
@@ -1,6 +1,8 @@
-# Aliases to stop, start and restart Postgres
-# Paths noted below are for Postgress installed via Homebrew on OSX
+# Aliases to control Postgres
+# Paths noted below are for Postgres installed via Homebrew on OSX
alias startpost='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start'
alias stoppost='pg_ctl -D /usr/local/var/postgres stop -s -m fast'
-alias restartpost='stoppost && sleep 1 && startpost' \ No newline at end of file
+alias restartpost='stoppost && sleep 1 && startpost'
+alias reloadpost='pg_ctl reload -D /usr/local/var/postgres -s'
+alias statuspost='pg_ctl status -D /usr/local/var/postgres -s' \ No newline at end of file
diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh
index fb46cdcf0..824658e44 100644
--- a/plugins/rails/rails.plugin.zsh
+++ b/plugins/rails/rails.plugin.zsh
@@ -6,7 +6,7 @@ function _rails_command () {
elif [ -e "script/server" ]; then
ruby script/$@
else
- rails $@
+ command rails $@
fi
}
@@ -14,7 +14,7 @@ function _rake_command () {
if [ -e "bin/rake" ]; then
bin/rake $@
else
- rake $@
+ command rake $@
fi
}
diff --git a/plugins/rake-fast/rake-fast.plugin.zsh b/plugins/rake-fast/rake-fast.plugin.zsh
index cb84f69a1..cfc9a079f 100644
--- a/plugins/rake-fast/rake-fast.plugin.zsh
+++ b/plugins/rake-fast/rake-fast.plugin.zsh
@@ -10,7 +10,7 @@ _rake_refresh () {
_rake_does_task_list_need_generating () {
if [ ! -f .rake_tasks ]; then return 0;
else
- if [[ $(uname -s) == 'Darwin' ]]; then
+ if [[ "$OSTYPE" = darwin* ]]; then
accurate=$(stat -f%m .rake_tasks)
changed=$(stat -f%m Rakefile)
else
diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh
index 3bde154df..234ac1642 100644
--- a/plugins/rvm/rvm.plugin.zsh
+++ b/plugins/rvm/rvm.plugin.zsh
@@ -6,6 +6,7 @@ alias gemsets='rvm gemset list'
local ruby18='ruby-1.8.7'
local ruby19='ruby-1.9.3'
local ruby20='ruby-2.0.0'
+local ruby21='ruby-2.1.2'
function rb18 {
if [ -z "$1" ]; then
@@ -40,6 +41,17 @@ function rb20 {
_rb20() {compadd `ls -1 $rvm_path/gems | grep "^$ruby20@" | sed -e "s/^$ruby20@//" | awk '{print $1}'`}
compdef _rb20 rb20
+function rb21 {
+ if [ -z "$1" ]; then
+ rvm use "$ruby21"
+ else
+ rvm use "$ruby21@$1"
+ fi
+}
+
+_rb21() {compadd `ls -1 $rvm_path/gems | grep "^$ruby21@" | sed -e "s/^$ruby21@//" | awk '{print $1}'`}
+compdef _rb21 rb21
+
function rvm-update {
rvm get head
}
diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh
index 438f386fb..5acc75cc7 100644
--- a/plugins/sublime/sublime.plugin.zsh
+++ b/plugins/sublime/sublime.plugin.zsh
@@ -17,7 +17,7 @@ if [[ $('uname') == 'Linux' ]]; then
fi
done
-elif [[ $('uname') == 'Darwin' ]]; then
+elif [[ "$OSTYPE" = darwin* ]]; then
local _sublime_darwin_paths > /dev/null 2>&1
_sublime_darwin_paths=(
"/usr/local/bin/subl"
diff --git a/plugins/symfony2/symfony2.plugin.zsh b/plugins/symfony2/symfony2.plugin.zsh
index 4c07349a4..8df22e9ad 100644
--- a/plugins/symfony2/symfony2.plugin.zsh
+++ b/plugins/symfony2/symfony2.plugin.zsh
@@ -1,22 +1,26 @@
# Symfony2 basic command completion
+_symfony_console () {
+ echo "php $(find . -maxdepth 2 -mindepth 1 -name 'console' -type f | head -n 1)"
+}
+
_symfony2_get_command_list () {
- php app/console --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
+ `_symfony_console` --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
}
_symfony2 () {
- if [ -f app/console ]; then
- compadd `_symfony2_get_command_list`
- fi
+ compadd `_symfony2_get_command_list`
}
-compdef _symfony2 app/console
+compdef _symfony2 '`_symfony_console`'
+compdef _symfony2 'app/console'
+compdef _symfony2 'bin/console'
compdef _symfony2 sf
#Alias
-alias sf='php app/console'
-alias sfcl='php app/console cache:clear'
-alias sfroute='php app/console router:debug'
-alias sfcontainer='php app/console container:debug'
-alias sfgb='php app/console generate:bundle'
-
+alias sf='`_symfony_console`'
+alias sfcl='sf cache:clear'
+alias sfcw='sf cache:warmup'
+alias sfroute='sf router:debug'
+alias sfcontainer='sf container:debug'
+alias sfgb='sf generate:bundle' \ No newline at end of file
diff --git a/plugins/textastic/README.md b/plugins/textastic/README.md
new file mode 100644
index 000000000..369c2c137
--- /dev/null
+++ b/plugins/textastic/README.md
@@ -0,0 +1,15 @@
+## textastic
+
+Plugin for Textastic, a text and code editor for Mac OS X
+
+### Requirements
+
+ * [Textastic](http://www.textasticapp.com/mac.html)
+
+### Usage
+
+ * If `tt` command is called without an argument, launch Textastic
+
+ * If `tt` is passed a directory, cd to it and open it in Textastic
+
+ * If `tt` is passed a file, open it in Textastic
diff --git a/plugins/textastic/textastic.plugin.zsh b/plugins/textastic/textastic.plugin.zsh
new file mode 100644
index 000000000..f5901eae2
--- /dev/null
+++ b/plugins/textastic/textastic.plugin.zsh
@@ -0,0 +1,17 @@
+#
+# If the tt command is called without an argument, launch Textastic
+# If tt is passed a directory, cd to it and open it in Textastic
+# If tt is passed a file, open it in Textastic
+#
+function tt() {
+ if [[ -z "$1" ]]
+ then
+ open -a "textastic.app"
+ else
+ open -a "textastic.app" "$1"
+ if [[ -d "$1" ]]
+ then
+ cd "$1"
+ fi
+ fi
+}
diff --git a/plugins/tmuxinator/_tmuxinator b/plugins/tmuxinator/_tmuxinator
index cd227b7df..e4f8b6ce0 100644
--- a/plugins/tmuxinator/_tmuxinator
+++ b/plugins/tmuxinator/_tmuxinator
@@ -11,10 +11,12 @@ _arguments -C \
case $state in
cmds)
_values "tmuxinator command" \
+ "new[create a new project file and open it in your editor]" \
"start[start a tmux session using project's tmuxinator config]" \
"open[create a new project file and open it in your editor]" \
"copy[copy source_project project file to a new project called new_project]" \
"delete[deletes the project called project_name]" \
+ "debug[output the shell commands generated by a projet]" \
"implode[deletes all existing projects!]" \
"list[list all existing projects]" \
"doctor[look for problems in your configuration]" \
@@ -24,9 +26,9 @@ case $state in
;;
args)
case $line[1] in
- start|open|copy|delete)
+ start|open|copy|delete|debug)
_configs=(`find ~/.tmuxinator -name \*.yml | cut -d/ -f5 | sed s:.yml::g`)
- _values 'configs' $_configs
+ [[ -n "$_configs" ]] && _values 'configs' $_configs
ret=0
;;
esac
diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant
index 9ddfa1be7..0c82acd42 100644
--- a/plugins/vagrant/_vagrant
+++ b/plugins/vagrant/_vagrant
@@ -56,7 +56,8 @@ __box_list ()
__vm_list ()
{
- _wanted application expl 'command' compadd $(command grep Vagrantfile -oe '^[^#]*\.vm\.define *:\([a-zA-Z0-9]\+\)' 2>/dev/null | cut -d: -f2)
+ _wanted application expl 'command' compadd $(command grep Vagrantfile -oe '^[^#]*\.vm\.define *[:"]\([a-zA-Z0-9_-]\+\)' 2>/dev/null | awk '{print substr($2, 2)}')
+ _wanted application expl 'command' compadd $(command ls .vagrant/machines/ 2>/dev/null)
}
__vagrant-box ()
diff --git a/plugins/virtualenv/virtualenv.plugin.zsh b/plugins/virtualenv/virtualenv.plugin.zsh
index 8e06450b1..e250eb63e 100644
--- a/plugins/virtualenv/virtualenv.plugin.zsh
+++ b/plugins/virtualenv/virtualenv.plugin.zsh
@@ -1,7 +1,6 @@
function virtualenv_prompt_info(){
- if [[ -n $VIRTUAL_ENV ]]; then
- printf "%s[%s] " "%{${fg[yellow]}%}" ${${VIRTUAL_ENV}:t}
- fi
+ [[ -n ${VIRTUAL_ENV} ]] || return
+ echo "${ZSH_THEME_VIRTUALENV_PREFIX:=[}${VIRTUAL_ENV:t}${ZSH_THEME_VIRTUALENV_SUFFIX:=]}"
}
# disables prompt mangling in virtual_env/bin/activate
diff --git a/plugins/wd/LICENSE b/plugins/wd/LICENSE
new file mode 100644
index 000000000..8caa6c6ce
--- /dev/null
+++ b/plugins/wd/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Markus Færevaag
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE. \ No newline at end of file
diff --git a/plugins/wd/README.md b/plugins/wd/README.md
index f9f4e7ac1..bc0ebe334 100644
--- a/plugins/wd/README.md
+++ b/plugins/wd/README.md
@@ -2,37 +2,39 @@
**Maintainer:** [mfaerevaag](https://github.com/mfaerevaag)
-`wd` (warp directory) lets you jump to custom directories in zsh, without using cd. Why? Because cd seems ineffecient when the folder is frequently visited or has a long path. [Source](https://github.com/mfaerevaag/wd)
+`wd` (*warp directory*) lets you jump to custom directories in zsh, without using `cd`. Why? Because `cd` seems ineffecient when the folder is frequently visited or has a long path. [Source](https://github.com/mfaerevaag/wd)
### Usage
* Add warp point to current working directory:
- wd add test
+ $ wd add foo
If a warp point with the same name exists, use `add!` to overwrite it.
- * From an other directory, warp to test with:
+ Note, a warp point cannot contain colons, or only consist of only spaces and dots. The first will conflict in how `wd` stores the warp points, and the second will conflict other features, as below.
- wd test
+ * From an other directory (not necessarily), warp to `foo` with:
- * You can warp back to previous directory, and so on, with the puncticulation syntax:
+ $ wd foo
- wd ..
- wd ...
+ * You can warp back to previous directory, and so on, with this dot syntax:
+
+ $ wd ..
+ $ wd ...
This is a wrapper for the zsh `dirs` function.
* Remove warp point test point:
- wd rm test
+ $ wd rm foo
- * List warp points to current directory (stored in `~/.warprc`):
+ * List all warp points (stored in `~/.warprc`):
- wd show
+ $ wd ls
- * List all warp points (stored in `~/.warprc`):
+ * List warp points to current directory
- wd ls
+ $ wd show
* Print usage with no opts or the `help` argument.
diff --git a/plugins/wd/_wd.sh b/plugins/wd/_wd.sh
index 29df63520..0b03d8fff 100644
--- a/plugins/wd/_wd.sh
+++ b/plugins/wd/_wd.sh
@@ -5,23 +5,16 @@ zstyle ':completion::complete:wd:*:commands' group-name commands
zstyle ':completion::complete:wd:*:warp_points' group-name warp_points
zstyle ':completion::complete:wd::' list-grouped
-# Call `_wd()` when when trying to complete the command `wd`
-
zmodload zsh/mapfile
+
function _wd() {
- local ret=1
local CONFIG=$HOME/.warprc
-
- # Stolen from
- # http://stackoverflow.com/questions/9000698/completion-when-program-has-sub-commands
-
- # local curcontext="$curcontext" state line
- # typeset -A opt_args
+ local ret=1
local -a commands
local -a warp_points
- warp_points=( "${(f)mapfile[$CONFIG]}" )
- # LIST="${mapfile[$FNAME]}" # Not required unless stuff uses it
+
+ warp_points=( "${(f)mapfile[$CONFIG]//$HOME/~}" )
commands=(
'add:Adds the current working directory to your warp points'
diff --git a/plugins/wd/wd.plugin.zsh b/plugins/wd/wd.plugin.zsh
index 9800335fc..c0559293d 100644
--- a/plugins/wd/wd.plugin.zsh
+++ b/plugins/wd/wd.plugin.zsh
@@ -1,7 +1,7 @@
#!/bin/zsh
-# WARP
-# ====
+# WARP DIRECTORY
+# ==============
# oh-my-zsh plugin
#
# @github.com/mfaerevaag/wd
diff --git a/plugins/wd/wd.sh b/plugins/wd/wd.sh
index 96a3426fc..dfb9ad89a 100755
--- a/plugins/wd/wd.sh
+++ b/plugins/wd/wd.sh
@@ -1,7 +1,7 @@
#!/bin/zsh
-# WARP
-# ====
+# WARP DIRECTORY
+# ==============
# Jump to custom directories in terminal
# because `cd` takes too long...
#
@@ -9,26 +9,28 @@
## variables
-CONFIG=$HOME/.warprc
+readonly CONFIG=$HOME/.warprc
-## colors
-BLUE="\033[96m"
-GREEN="\033[92m"
-YELLOW="\033[93m"
-RED="\033[91m"
-NOC="\033[m"
+# colors
+readonly BLUE="\033[96m"
+readonly GREEN="\033[92m"
+readonly YELLOW="\033[93m"
+readonly RED="\033[91m"
+readonly NOC="\033[m"
+## init
+
# check if config file exists
-if [[ ! -a $CONFIG ]]
+if [ ! -e $CONFIG ]
then
- # if not: create config file
- touch $CONFIG
+ # if not, create config file
+ touch $CONFIG
fi
-## load warp points
+# load warp points
typeset -A points
-while read line
+while read -r line
do
arr=(${(s,:,)line})
key=${arr[1]}
@@ -39,72 +41,78 @@ done < $CONFIG
## functions
-# prepended wd_ to not conflict with your environment (no sub shell)
wd_warp()
{
- if [[ $1 =~ "^\.+$" ]]
+ local point=$1
+
+ if [[ $point =~ "^\.+$" ]]
then
- if [[ $#1 < 2 ]]
+ if [ $#1 < 2 ]
then
wd_print_msg $YELLOW "Warping to current directory?"
else
(( n = $#1 - 1 ))
- #wd_print_msg $BLUE "Warping..."
cd -$n > /dev/null
fi
- elif [[ ${points[$1]} != "" ]]
+ elif [[ ${points[$point]} != "" ]]
then
- #wd_print_msg $BLUE "Warping..."
- cd ${points[$1]}
+ cd ${points[$point]}
else
- wd_print_msg $RED "Unkown warp point '$1'"
+ wd_print_msg $RED "Unknown warp point '${point}'"
fi
}
wd_add()
{
- if [[ $2 =~ "^\.+$" || $2 =~ "^\s*$" ]]
+ local force=$1
+ local point=$2
+
+ if [[ $point =~ "^[\.]+$" ]]
+ then
+ wd_print_msg $RED "Warp point cannot be just dots"
+ elif [[ $point =~ "(\s|\ )+" ]]
then
- wd_print_msg $RED "Illegal warp point (see README)."
- elif [[ ${points[$2]} == "" ]] || $1
+ wd_print_msg $RED "Warp point should not contain whitespace"
+ elif [[ $point == *:* ]]
then
- wd_remove $2 > /dev/null
- print "$2:$PWD" >> $CONFIG
+ wd_print_msg $RED "Warp point cannot contain colons"
+ elif [[ $point == "" ]]
+ then
+ wd_print_msg $RED "Warp point cannot be empty"
+ elif [[ ${points[$2]} == "" ]] || $force
+ then
+ wd_remove $point > /dev/null
+ printf "%q:%q\n" "${point}" "${PWD}" >> $CONFIG
+
wd_print_msg $GREEN "Warp point added"
else
- wd_print_msg $YELLOW "Warp point '$2' already exists. Use 'add!' to overwrite."
+ wd_print_msg $YELLOW "Warp point '${point}' already exists. Use 'add!' to overwrite."
fi
}
wd_remove()
{
- if [[ ${points[$1]} != "" ]]
+ local point=$1
+
+ if [[ ${points[$point]} != "" ]]
then
- if wd_tmp=`sed "/^$1:/d" $CONFIG`
+ if sed -i.bak "s,^${point}:.*$,,g" $CONFIG
then
- # `>!` forces overwrite
- # we need this if people use `setopt NO_CLOBBER`
- echo $wd_tmp >! $CONFIG
wd_print_msg $GREEN "Warp point removed"
else
- wd_print_msg $RED "Warp point unsuccessfully removed. Sorry!"
+ wd_print_msg $RED "Something bad happened! Sorry."
fi
else
wd_print_msg $RED "Warp point was not found"
fi
}
-wd_show()
-{
- wd_print_msg $BLUE "Warp points to current directory:"
- wd_list_all | grep $PWD$
-}
-
wd_list_all()
{
wd_print_msg $BLUE "All warp points:"
- while read line
+
+ while IFS= read -r line
do
if [[ $line != "" ]]
then
@@ -112,38 +120,52 @@ wd_list_all()
key=${arr[1]}
val=${arr[2]}
- print "\t" $key "\t -> \t" $val
+ printf "%20s -> %s\n" $key $val
fi
- done < $CONFIG
+ done <<< $(sed "s:${HOME}:~:g" $CONFIG)
+}
+
+wd_show()
+{
+ local cwd=$(print $PWD | sed "s:^${HOME}:~:")
+
+ wd_print_msg $BLUE "Warp points to current directory:"
+ wd_list_all | grep -e "${cwd}$"
}
wd_print_msg()
{
- if [[ $1 == "" || $2 == "" ]]
+ local color=$1
+ local msg=$2
+
+ if [[ $color == "" || $msg == "" ]]
then
- print " $RED*$NOC Could not print message. Sorry!"
+ print " ${RED}*${NOC} Could not print message. Sorry!"
else
- print " $1*$NOC $2"
+ print " ${color}*${NOC} ${msg}"
fi
}
wd_print_usage()
{
- print "Usage: wd [add|-a|--add] [rm|-r|--remove] [ls|-l|--list] <point>"
- print "\nCommands:"
- print "\t add \t Adds the current working directory to your warp points"
- print "\t add! \t Overwrites existing warp point"
- print "\t rm \t Removes the given warp point"
- print "\t show \t Outputs warp points to current directory"
- print "\t ls \t Outputs all stored warp points"
- print "\t help \t Show this extremely helpful text"
+ cat <<- EOF
+Usage: wd [add|-a|--add] [rm|-r|--remove] <point>
+
+Commands:
+ add Adds the current working directory to your warp points
+ add! Overwrites existing warp point
+ rm Removes the given warp point
+ show Outputs warp points to current directory
+ ls Outputs all stored warp points
+ help Show this extremely helpful text
+EOF
}
## run
# get opts
-args=`getopt -o a:r:lhs -l add:,rm:,ls,help,show -- $*`
+args=$(getopt -o a:r:lhs -l add:,rm:,ls,help,show -- $*)
# check if no arguments were given
if [[ $? -ne 0 || $#* -eq 0 ]]
@@ -151,19 +173,16 @@ then
wd_print_usage
# check if config file is writeable
-elif [[ ! -w $CONFIG ]]
+elif [ ! -w $CONFIG ]
then
- wd_print_msg $RED "\'$CONFIG\' is not writeable."
- # do nothing => exit
+ # do nothing
# can't run `exit`, as this would exit the executing shell
- # i.e. your terminal
+ wd_print_msg $RED "\'$CONFIG\' is not writeable."
else
- #set -- $args # WTF
-
- for i
+ for o
do
- case "$i"
+ case "$o"
in
-a|--add|add)
wd_add false $2
@@ -190,7 +209,7 @@ else
break
;;
*)
- wd_warp $i
+ wd_warp $o
break
;;
--)
@@ -200,10 +219,18 @@ else
done
fi
-
## garbage collection
# if not, next time warp will pick up variables from this run
# remember, there's no sub shell
-unset points
+
+unset wd_warp
+unset wd_add
+unset wd_remove
+unset wd_show
+unset wd_list_all
+unset wd_print_msg
+unset wd_print_usage
+
unset args
+unset points
unset val &> /dev/null # fixes issue #1
diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh
index 8eedb90ee..371e3a303 100644
--- a/plugins/web-search/web-search.plugin.zsh
+++ b/plugins/web-search/web-search.plugin.zsh
@@ -1,10 +1,9 @@
# web_search from terminal
function web_search() {
-
# get the open command
local open_cmd
- if [[ $(uname -s) == 'Darwin' ]]; then
+ if [[ "$OSTYPE" = darwin* ]]; then
open_cmd='open'
else
open_cmd='xdg-open'
@@ -38,8 +37,8 @@ function web_search() {
done
url="${url%?}" # remove the last '+'
-
- $open_cmd "$url"
+ nohup $open_cmd "$url"
+ rm nohup.out
}
diff --git a/plugins/wp-cli/README.md b/plugins/wp-cli/README.md
new file mode 100644
index 000000000..6dda07d17
--- /dev/null
+++ b/plugins/wp-cli/README.md
@@ -0,0 +1,105 @@
+# WP-CLI
+
+**Maintainer:** [joshmedeski](https://github.com/joshmedeski)
+
+WordPress Command Line Interface (http://wp-cli.org/)
+
+WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser.
+
+## List of Aliases
+
+### Core
+- wpcc='wp core config'
+- wpcd='wp core download'
+- wpci='wp core install'
+- wpcii='wp core is-installed'
+- wpcmc='wp core multisite-convert'
+- wpcmi='wp core multisite-install'
+- wpcu='wp core update'
+- wpcudb='wp core update-db'
+- wpcvc='wp core verify-checksums'
+
+### Cron
+- wpcre='wp cron event'
+- wpcrs='wp cron schedule'
+- wpcrt='wp cron test'
+
+### Menu
+- wpmc='wp menu create'
+- wpmd='wp menu delete'
+- wpmi='wp menu item'
+- wpml='wp menu list'
+- wpmlo='wp menu location'
+
+### Plugin
+- wppa='activate'
+- wppda='deactivate'
+- wppd='delete'
+- wppg='get'
+- wppi='install'
+- wppis='is-installed'
+- wppl='list'
+- wppp='path'
+- wpps='search'
+- wppst='status'
+- wppt='toggle'
+- wppu='uninstall'
+- wppu='update'
+
+### Post
+- wppoc='wp post create'
+- wppod='wp post delete'
+- wppoe='wp post edit'
+- wppogen='wp post generate'
+- wppog='wp post get'
+- wppol='wp post list'
+- wppom='wp post meta'
+- wppou='wp post update'
+- wppou='wp post url'
+
+### Sidebar
+- wpsbl='wp sidebar list'
+
+### Theme
+- wpta='wp theme activate'
+- wptd='wp theme delete'
+- wptdis='wp theme disable'
+- wpte='wp theme enable'
+- wptg='wp theme get'
+- wpti='wp theme install'
+- wptis='wp theme is-installed'
+- wptl='wp theme list'
+- wptm='wp theme mod'
+- wptp='wp theme path'
+- wpts='wp theme search'
+- wptst='wp theme status'
+- wptu='wp theme updatet'
+
+### User
+- wpuac='wp user add-cap'
+- wpuar='wp user add-role'
+- wpuc='wp user create'
+- wpud='wp user delete'
+- wpugen='wp user generate'
+- wpug='wp user get'
+- wpui='wp user import-csv'
+- wpul='wp user list'
+- wpulc='wp user list-caps'
+- wpum='wp user meta'
+- wpurc='wp user remove-cap'
+- wpurr='wp user remove-role'
+- wpusr='wp user set-role'
+- wpuu='wp user update'
+
+### Widget
+- wpwa='wp widget add'
+- wpwda='wp widget deactivate'
+- wpwd='wp widget delete'
+- wpwl='wp widget list'
+- wpwm='wp widget move'
+- wpwu='wp widget update'
+
+The entire list of wp-cli commands can be found here: http://wp-cli.org/commands/
+
+I only included the commands that are most used. Please feel free to contribute to this project if you want more commands.
+
diff --git a/plugins/wp-cli/wp-cli.plugin.zsh b/plugins/wp-cli/wp-cli.plugin.zsh
new file mode 100644
index 000000000..5d9551e24
--- /dev/null
+++ b/plugins/wp-cli/wp-cli.plugin.zsh
@@ -0,0 +1,138 @@
+# WP-CLI
+# A command line interface for WordPress
+# http://wp-cli.org/
+
+# Cache
+
+# Cap
+
+# CLI
+
+# Comment
+
+# Core
+alias wpcc='wp core config'
+alias wpcd='wp core download'
+alias wpci='wp core install'
+alias wpcii='wp core is-installed'
+alias wpcmc='wp core multisite-convert'
+alias wpcmi='wp core multisite-install'
+alias wpcu='wp core update'
+alias wpcudb='wp core update-db'
+alias wpcvc='wp core verify-checksums'
+
+# Cron
+alias wpcre='wp cron event'
+alias wpcrs='wp cron schedule'
+alias wpcrt='wp cron test'
+
+# Db
+
+# Eval
+
+# Eval-File
+
+# Export
+
+# Help
+
+# Import
+
+# Media
+
+# Menu
+alias wpmc='wp menu create'
+alias wpmd='wp menu delete'
+alias wpmi='wp menu item'
+alias wpml='wp menu list'
+alias wpmlo='wp menu location'
+
+# Network
+
+# Option
+
+# Plugin
+alias wppa='activate'
+alias wppda='deactivate'
+alias wppd='delete'
+alias wppg='get'
+alias wppi='install'
+alias wppis='is-installed'
+alias wppl='list'
+alias wppp='path'
+alias wpps='search'
+alias wppst='status'
+alias wppt='toggle'
+alias wppu='uninstall'
+alias wppu='update'
+
+# Post
+alias wppoc='wp post create'
+alias wppod='wp post delete'
+alias wppoe='wp post edit'
+alias wppogen='wp post generate'
+alias wppog='wp post get'
+alias wppol='wp post list'
+alias wppom='wp post meta'
+alias wppou='wp post update'
+alias wppou='wp post url'
+
+# Rewrite
+
+# Role
+
+# Scaffold
+
+# Search-Replace
+
+# Shell
+
+# Sidebar
+alias wpsbl='wp sidebar list'
+
+# Site
+
+# Super-Admin
+
+# Term
+
+# Theme
+alias wpta='wp theme activate'
+alias wptd='wp theme delete'
+alias wptdis='wp theme disable'
+alias wpte='wp theme enable'
+alias wptg='wp theme get'
+alias wpti='wp theme install'
+alias wptis='wp theme is-installed'
+alias wptl='wp theme list'
+alias wptm='wp theme mod'
+alias wptp='wp theme path'
+alias wpts='wp theme search'
+alias wptst='wp theme status'
+alias wptu='wp theme updatet'
+
+# Transient
+
+# User
+alias wpuac='wp user add-cap'
+alias wpuar='wp user add-role'
+alias wpuc='wp user create'
+alias wpud='wp user delete'
+alias wpugen='wp user generate'
+alias wpug='wp user get'
+alias wpui='wp user import-csv'
+alias wpul='wp user list'
+alias wpulc='wp user list-caps'
+alias wpum='wp user meta'
+alias wpurc='wp user remove-cap'
+alias wpurr='wp user remove-role'
+alias wpusr='wp user set-role'
+alias wpuu='wp user update'
+
+# Widget
+alias wpwa='wp widget add'
+alias wpwda='wp widget deactivate'
+alias wpwd='wp widget delete'
+alias wpwl='wp widget list'
+alias wpwm='wp widget move'
+alias wpwu='wp widget update'
diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh
index e59bee8c7..b7b75cf93 100644
--- a/plugins/xcode/xcode.plugin.zsh
+++ b/plugins/xcode/xcode.plugin.zsh
@@ -16,4 +16,9 @@ function xcsel {
alias xcb='xcodebuild'
alias xcp='xcode-select --print-path'
-alias simulator='open $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'
+
+if [[ -d $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app ]]; then
+ alias simulator='open $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'
+else
+ alias simulator='open $(xcode-select -p)/Applications/iOS\ Simulator.app'
+fi
diff --git a/plugins/zsh_reload/zsh_reload.plugin.zsh b/plugins/zsh_reload/zsh_reload.plugin.zsh
index 94945bd48..3f44b99c6 100644
--- a/plugins/zsh_reload/zsh_reload.plugin.zsh
+++ b/plugins/zsh_reload/zsh_reload.plugin.zsh
@@ -1,10 +1,11 @@
# reload zshrc
function src()
{
+ local cache="$ZSH/cache"
autoload -U compinit zrecompile
- compinit -d "$ZSH/cache/zcomp-$HOST"
+ compinit -d "$cache/zcomp-$HOST"
- for f in ~/.zshrc "$ZSH/cache/zcomp-$HOST"; do
+ for f in ~/.zshrc "$cache/zcomp-$HOST"; do
zrecompile -p $f && command rm -f $f.zwc.old
done