summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/autojump/autojump.plugin.zsh4
-rw-r--r--plugins/aws/aws.plugin.zsh13
-rw-r--r--plugins/dircycle/dircycle.plugin.zsh2
-rw-r--r--plugins/extract/extract.plugin.zsh4
-rw-r--r--plugins/heroku/_heroku32
-rw-r--r--plugins/mercurial/mercurial.plugin.zsh2
-rw-r--r--plugins/osx/osx.plugin.zsh31
-rw-r--r--plugins/phing/phing.plugin.zsh4
-rw-r--r--plugins/pj/pj.plugin.zsh4
-rw-r--r--plugins/svn-fast-info/svn-fast-info.plugin.zsh12
-rw-r--r--plugins/svn/svn.plugin.zsh4
-rw-r--r--plugins/symfony2/symfony2.plugin.zsh4
-rw-r--r--plugins/xcode/xcode.plugin.zsh1
13 files changed, 70 insertions, 47 deletions
diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh
index 50a694764..4cf036401 100644
--- a/plugins/autojump/autojump.plugin.zsh
+++ b/plugins/autojump/autojump.plugin.zsh
@@ -1,6 +1,10 @@
if [ $commands[autojump] ]; then # check if autojump is installed
if [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation
. $HOME/.autojump/etc/profile.d/autojump.zsh
+ elif [ -f $HOME/.autojump/share/autojump/autojump.zsh ]; then # another manual user-local installation
+ . $HOME/.autojump/share/autojump/autojump.zsh
+ elif [ -f $HOME/.nix-profile/etc/profile.d/autojump.zsh ]; then # nix installation
+ . $HOME/.nix-profile/etc/profile.d/autojump.zsh
elif [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package
. /usr/share/autojump/autojump.zsh
elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
index 8b57d7db1..0ae18dd56 100644
--- a/plugins/aws/aws.plugin.zsh
+++ b/plugins/aws/aws.plugin.zsh
@@ -3,19 +3,17 @@ _homebrew-installed() {
}
_awscli-homebrew-installed() {
- brew --prefix awscli &> /dev/null
+ brew list awscli &> /dev/null
}
export AWS_HOME=~/.aws
function agp {
echo $AWS_DEFAULT_PROFILE
-
}
function asp {
export AWS_DEFAULT_PROFILE=$1
- export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>"
-
+ export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>"
}
function aws_profiles {
reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/'))
@@ -24,7 +22,10 @@ function aws_profiles {
compctl -K aws_profiles asp
if _homebrew-installed && _awscli-homebrew-installed ; then
- source $(brew --prefix)/opt/awscli/libexec/bin/aws_zsh_completer.sh
+ _aws_zsh_completer_path=$(brew --prefix)/opt/awscli/libexec/bin/aws_zsh_completer.sh
else
- source `which aws_zsh_completer.sh`
+ _aws_zsh_completer_path=$(which aws_zsh_completer.sh)
fi
+
+[ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path
+unset _aws_zsh_completer_path
diff --git a/plugins/dircycle/dircycle.plugin.zsh b/plugins/dircycle/dircycle.plugin.zsh
index 46a0ab268..c6b6ba785 100644
--- a/plugins/dircycle/dircycle.plugin.zsh
+++ b/plugins/dircycle/dircycle.plugin.zsh
@@ -5,6 +5,6 @@
eval "insert-cycledleft () { zle push-line; LBUFFER='pushd -q +1'; zle accept-line }"
zle -N insert-cycledleft
bindkey "\e[1;6D" insert-cycledleft
-eval "insert-cycledright () { zle push-line; LBUFFER='pushd -q -0'; zle accept-line }"
+eval "insert-cycledright () { zle push-line; LBUFFER='pushd -q +0'; zle accept-line }"
zle -N insert-cycledright
bindkey "\e[1;6C" insert-cycledright
diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh
index a6e16ddf7..898d3d36e 100644
--- a/plugins/extract/extract.plugin.zsh
+++ b/plugins/extract/extract.plugin.zsh
@@ -38,7 +38,7 @@ function extract() {
file_name="$( basename "$1" )"
extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )"
case "$1" in
- (*.tar.gz|*.tgz) tar xvzf "$1" ;;
+ (*.tar.gz|*.tgz) [ -z $commands[pigz] ] && tar zxvf "$1" || pigz -dc "$1" | tar xv ;;
(*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
(*.tar.xz|*.txz) tar --xz --help &> /dev/null \
&& tar --xz -xvf "$1" \
@@ -47,7 +47,7 @@ function extract() {
&& tar --lzma -xvf "$1" \
|| lzcat "$1" | tar xvf - ;;
(*.tar) tar xvf "$1" ;;
- (*.gz) gunzip "$1" ;;
+ (*.gz) [ -z $commands[pigz] ] && gunzip "$1" || pigz -d "$1" ;;
(*.bz2) bunzip2 "$1" ;;
(*.xz) unxz "$1" ;;
(*.lzma) unlzma "$1" ;;
diff --git a/plugins/heroku/_heroku b/plugins/heroku/_heroku
index 46663303a..bb2f7403f 100644
--- a/plugins/heroku/_heroku
+++ b/plugins/heroku/_heroku
@@ -27,8 +27,6 @@ _1st_arguments=(
"config\:push":"push local config vars to heroku"
"config\:set":"set one or more config vars"
"config\:unset":"unset one or more config vars"
- "db\:push":"push local data up to your app"
- "db\:pull":"pull heroku data down into your local database"
"domains":"list custom domains for an app"
"domains\:add":"add a custom domain to an app"
"domains\:remove":"remove a custom domain from an app"
@@ -43,12 +41,20 @@ _1st_arguments=(
"logs\:drains":"manage syslog drains"
"maintenance\:on":"put the app into maintenance mode"
"maintenance\:off":"take the app out of maintenance mode"
+ "pg\:credentials":"display the DATABASE credentials"
+ "pg\:diagnose":"run diagnostics report on DATABASE"
"pg\:info":"display database information"
- "pg\:ingress":"allow direct connections to the database from this IP for one minute"
+ "pg\:kill":"kill a query"
+ "pg\:killall":"terminates ALL connections"
+ "pg\:maintenance":"manage maintenance for DATABASE"
"pg\:promote":"sets DATABASE as your DATABASE_URL"
+ "pg\:ps":"view active queries with execution time"
"pg\:psql":"open a psql shell to the database"
+ "pg\:pull":"pull from REMOTE_SOURCE_DATABASE to LOCAL_TARGET_DATABASE"
+ "pg\:push":"push from LOCAL_SOURCE_DATABASE to REMOTE_TARGET_DATABASE"
"pg\:reset":"delete all data in DATABASE"
"pg\:unfollow":"stop a replica from following and make it a read/write database"
+ "pg\:upgrade":"unfollow a database and upgrade it to the latest PostgreSQL version"
"pg\:wait":"monitor database creation, exit when complete"
"pgbackups":"list captured backups"
"pgbackups\:url":"get a temporary URL for a backup"
@@ -108,26 +114,6 @@ case "$words[1]" in
'(-s|--shell)'{-s,--shell}'[output config vars in shell format]' \
)
;;
- db:push)
- _command_args=(
- '(-c|--chunksize)'{-c,--chunksize}'[specify the number of rows to send in each batch]' \
- '(-d|--debug)'{-d,--debug}'[enable debugging output]' \
- '(-e|--exclude)'{-e,--exclude}'[exclude the specified tables from the push]' \
- '(-f|--filter)'{-f,--filter}'[only push certain tables]' \
- '(-r|--resume)'{-r,--resume}'[resume transfer described by a .dat file]' \
- '(-t|--tables)'{-t,--tables}'[only push the specified tables]' \
- )
- ;;
- db:pull)
- _command_args=(
- '(-c|--chunksize)'{-c,--chunksize}'[specify the number of rows to send in each batch]' \
- '(-d|--debug)'{-d,--debug}'[enable debugging output]' \
- '(-e|--exclude)'{-e,--exclude}'[exclude the specified tables from the pull]' \
- '(-f|--filter)'{-f,--filter}'[only pull certain tables]' \
- '(-r|--resume)'{-r,--resume}'[resume transfer described by a .dat file]' \
- '(-t|--tables)'{-t,--tables}'[only pull the specified tables]' \
- )
- ;;
keys)
_command_args=(
'(-l|--long)'{-l,--long}'[display extended information for each key]' \
diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh
index ff95d5e40..ed4d23713 100644
--- a/plugins/mercurial/mercurial.plugin.zsh
+++ b/plugins/mercurial/mercurial.plugin.zsh
@@ -42,7 +42,7 @@ $ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_HG_PROMPT_SU
function hg_dirty_choose {
if [ $(in_hg) ]; then
- hg status 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'
+ hg status 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'
if [ $pipestatus[-1] -eq 0 ]; then
# Grep exits with 0 when "One or more lines were selected", return "dirty".
echo $1
diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
index 2eea0d8ef..d366f1fc8 100644
--- a/plugins/osx/osx.plugin.zsh
+++ b/plugins/osx/osx.plugin.zsh
@@ -177,12 +177,43 @@ function itunes() {
vol)
opt="set sound volume to $1" #$1 Due to the shift
;;
+ shuf|shuff|shuffle)
+ # The shuffle property of current playlist can't be changed in iTunes 12,
+ # so this workaround uses AppleScript to simulate user input instead.
+ # Defaults to toggling when no options are given.
+ # The toggle option depends on the shuffle button being visible in the Now playing area.
+ # On and off use the menu bar items.
+ local state=$1
+
+ if [[ -n "$state" && ! "$state" =~ "^(on|off|toggle)$" ]]
+ then
+ print "Usage: itunes shuffle [on|off|toggle]. Invalid option."
+ return 1
+ fi
+
+ case "$state" in
+ on|off)
+ # Inspired by: http://stackoverflow.com/a/14675583
+ osascript 1>/dev/null 2>&1 <<-EOF
+ tell application "System Events" to perform action "AXPress" of (menu item "${state}" of menu "Shuffle" of menu item "Shuffle" of menu "Controls" of menu bar item "Controls" of menu bar 1 of application process "iTunes" )
+EOF
+ return 0
+ ;;
+ toggle|*)
+ osascript 1>/dev/null 2>&1 <<-EOF
+ tell application "System Events" to perform action "AXPress" of (button 2 of process "iTunes"'s window "iTunes"'s scroll area 1)
+EOF
+ return 0
+ ;;
+ esac
+ ;;
""|-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 "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer."
echo "\tvol\tSet the volume, takes an argument from 0 to 100"
echo "\thelp\tshow this message and exit"
return 0
diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/phing.plugin.zsh
index 795f1db85..1f022047c 100644
--- a/plugins/phing/phing.plugin.zsh
+++ b/plugins/phing/phing.plugin.zsh
@@ -1,13 +1,13 @@
_phing_does_target_list_need_generating () {
[ ! -f .phing_targets ] && return 0;
- [ .phing_targets -nt build.xml ] && return 0;
+ [ build.xml -nt .phing_targets ] && return 0;
return 1;
}
_phing () {
if [ -f build.xml ]; then
if _phing_does_target_list_need_generating; then
- phing -l |grep -v ":$" |grep -v "^-*$" > .phing_targets
+ phing -l|grep -v "\[property\]"|grep -v "Buildfile"|sed 1d|grep -v ":$" |grep -v "^\-*$"|awk '{print $1}' > .phing_targets
fi
compadd `cat .phing_targets`
fi
diff --git a/plugins/pj/pj.plugin.zsh b/plugins/pj/pj.plugin.zsh
index f9cbddf1a..1572e9363 100644
--- a/plugins/pj/pj.plugin.zsh
+++ b/plugins/pj/pj.plugin.zsh
@@ -42,8 +42,8 @@ function _pj () {
# might be possible to improve this using glob, without the basename trick
typeset -a projects
projects=($PROJECT_PATHS/*)
- projects=$projects:t
- _arguments '*:file:($projects)'
+ projects=$projects:t
+ _arguments "*:file:($projects)"
}
compdef _pj pj
diff --git a/plugins/svn-fast-info/svn-fast-info.plugin.zsh b/plugins/svn-fast-info/svn-fast-info.plugin.zsh
index ea19bcea0..9ea7f641d 100644
--- a/plugins/svn-fast-info/svn-fast-info.plugin.zsh
+++ b/plugins/svn-fast-info/svn-fast-info.plugin.zsh
@@ -63,11 +63,11 @@ function svn_current_revision() {
function svn_status_info() {
local svn_status_string="$ZSH_THEME_SVN_PROMPT_CLEAN"
local svn_status="$(svn status 2> /dev/null)";
- if grep -E '^\s*A' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"; fi
- if grep -E '^\s*D' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DELETIONS:-✖}"; fi
- if grep -E '^\s*M' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-✎}"; fi
- if grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-∿}"; fi
- if grep -E '^\s*\?' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"; fi
- if grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DIRTY:-'!'}"; fi
+ if command grep -E '^\s*A' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"; fi
+ if command grep -E '^\s*D' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DELETIONS:-✖}"; fi
+ if command grep -E '^\s*M' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-✎}"; fi
+ if command grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-∿}"; fi
+ if command grep -E '^\s*\?' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"; fi
+ if command grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DIRTY:-'!'}"; fi
echo $svn_status_string
}
diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh
index ba281d790..9f7a4c6eb 100644
--- a/plugins/svn/svn.plugin.zsh
+++ b/plugins/svn/svn.plugin.zsh
@@ -61,7 +61,7 @@ function svn_get_rev_nr() {
function svn_dirty_choose() {
if in_svn; then
root=`svn info 2> /dev/null | sed -n 's/^Working Copy Root Path: //p'`
- if $(svn status $root 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'); then
+ if $(svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'); then
# Grep exits with 0 when "One or more lines were selected", return "dirty".
echo $1
else
@@ -78,7 +78,7 @@ function svn_dirty() {
function svn_dirty_choose_pwd () {
if in_svn; then
root=$PWD
- if $(svn status $root 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'); then
+ if $(svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'); then
# Grep exits with 0 when "One or more lines were selected", return "dirty".
echo $1
else
diff --git a/plugins/symfony2/symfony2.plugin.zsh b/plugins/symfony2/symfony2.plugin.zsh
index 8df22e9ad..7a19cbdd3 100644
--- a/plugins/symfony2/symfony2.plugin.zsh
+++ b/plugins/symfony2/symfony2.plugin.zsh
@@ -5,7 +5,7 @@ _symfony_console () {
}
_symfony2_get_command_list () {
- `_symfony_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 () {
@@ -23,4 +23,4 @@ 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
+alias sfgb='sf generate:bundle'
diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh
index b7b75cf93..1d1205b80 100644
--- a/plugins/xcode/xcode.plugin.zsh
+++ b/plugins/xcode/xcode.plugin.zsh
@@ -16,6 +16,7 @@ function xcsel {
alias xcb='xcodebuild'
alias xcp='xcode-select --print-path'
+alias xcdd='rm -rf ~/Library/Developer/Xcode/DerivedData/*'
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'