summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/bundler/bundler.plugin.zsh1
-rw-r--r--plugins/capistrano/_capistrano2
-rw-r--r--plugins/encode64/encode64.plugin.zsh4
-rw-r--r--plugins/golang/golang.plugin.zsh150
-rwxr-xr-xplugins/grails/grails.plugin.zsh28
-rw-r--r--plugins/lein/lein.plugin.zsh14
-rw-r--r--plugins/osx/osx.plugin.zsh3
-rw-r--r--plugins/pj/pj.plugin.zsh42
-rw-r--r--plugins/rbenv/rbenv.plugin.zsh12
-rw-r--r--plugins/sprunge/sprunge.plugin.zsh4
-rw-r--r--plugins/ssh-agent/ssh-agent.plugin.zsh15
-rw-r--r--plugins/vi-mode/vi-mode.plugin.zsh17
-rw-r--r--plugins/zeus/README.md2
-rw-r--r--plugins/zeus/zeus.plugin.zsh5
14 files changed, 262 insertions, 37 deletions
diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
index f9843696b..10c221acd 100644
--- a/plugins/bundler/bundler.plugin.zsh
+++ b/plugins/bundler/bundler.plugin.zsh
@@ -33,6 +33,7 @@ _run-with-bundler() {
## Main program
for cmd in $bundled_commands; do
+ eval "function unbundled_$cmd () { $cmd \$@ }"
eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}"
alias $cmd=bundled_$cmd
diff --git a/plugins/capistrano/_capistrano b/plugins/capistrano/_capistrano
index cf6b50c7f..1002dad96 100644
--- a/plugins/capistrano/_capistrano
+++ b/plugins/capistrano/_capistrano
@@ -1,7 +1,7 @@
#compdef cap
#autoload
-if [ -f config/deploy.rb ]; then
+if [[ -f config/deploy.rb || -f Capfile ]]; then
if [[ ! -f .cap_tasks~ || config/deploy.rb -nt .cap_tasks~ ]]; then
echo "\nGenerating .cap_tasks~..." > /dev/stderr
cap --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~
diff --git a/plugins/encode64/encode64.plugin.zsh b/plugins/encode64/encode64.plugin.zsh
index cfb7c6a18..3b59447c5 100644
--- a/plugins/encode64/encode64.plugin.zsh
+++ b/plugins/encode64/encode64.plugin.zsh
@@ -1,2 +1,4 @@
encode64(){ echo -n $1 | base64 }
-decode64(){ echo -n $1 | base64 -D } \ No newline at end of file
+decode64(){ echo -n $1 | base64 -D }
+alias e64=encode64
+alias d64=decode64
diff --git a/plugins/golang/golang.plugin.zsh b/plugins/golang/golang.plugin.zsh
new file mode 100644
index 000000000..e60c4afe4
--- /dev/null
+++ b/plugins/golang/golang.plugin.zsh
@@ -0,0 +1,150 @@
+# From : http://golang.org/misc/zsh/go?m=text
+# gc
+prefixes=(5 6 8)
+for p in $prefixes; do
+ compctl -g "*.${p}" ${p}l
+ compctl -g "*.go" ${p}g
+done
+
+# standard go tools
+compctl -g "*.go" gofmt
+
+# gccgo
+compctl -g "*.go" gccgo
+
+# go tool
+__go_tool_complete() {
+ typeset -a commands build_flags
+ commands+=(
+ 'build[compile packages and dependencies]'
+ 'clean[remove object files]'
+ 'doc[run godoc on package sources]'
+ 'fix[run go tool fix on packages]'
+ 'fmt[run gofmt on package sources]'
+ 'get[download and install packages and dependencies]'
+ 'help[display help]'
+ 'install[compile and install packages and dependencies]'
+ 'list[list packages]'
+ 'run[compile and run Go program]'
+ 'test[test packages]'
+ 'tool[run specified go tool]'
+ 'version[print Go version]'
+ 'vet[run go tool vet on packages]'
+ )
+ if (( CURRENT == 2 )); then
+ # explain go commands
+ _values 'go tool commands' ${commands[@]}
+ return
+ fi
+ build_flags=(
+ '-a[force reinstallation of packages that are already up-to-date]'
+ '-n[print the commands but do not run them]'
+ "-p[number of parallel builds]:number"
+ '-x[print the commands]'
+ "-work[print temporary directory name and keep it]"
+ "-gcflags[flags for 5g/6g/8g]:flags"
+ "-ldflags[flags for 5l/6l/8l]:flags"
+ "-gccgoflags[flags for gccgo]:flags"
+ )
+ __go_list() {
+ local expl importpaths
+ declare -a importpaths
+ importpaths=($(go list ${words[$CURRENT]}... 2>/dev/null))
+ _wanted importpaths expl 'import paths' compadd "$@" - "${importpaths[@]}"
+ }
+ case ${words[2]} in
+ clean|doc)
+ _arguments -s -w : '*:importpaths:__go_list'
+ ;;
+ fix|fmt|list|vet)
+ _alternative ':importpaths:__go_list' ':files:_path_files -g "*.go"'
+ ;;
+ install)
+ _arguments -s -w : ${build_flags[@]} \
+ "-v[show package names]" \
+ '*:importpaths:__go_list'
+ ;;
+ get)
+ _arguments -s -w : \
+ ${build_flags[@]}
+ ;;
+ build)
+ _arguments -s -w : \
+ ${build_flags[@]} \
+ "-v[show package names]" \
+ "-o[output file]:file:_files" \
+ "*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }"
+ ;;
+ test)
+ _arguments -s -w : \
+ ${build_flags[@]} \
+ "-c[do not run, compile the test binary]" \
+ "-i[do not run, install dependencies]" \
+ "-v[print test output]" \
+ "-x[print the commands]" \
+ "-short[use short mode]" \
+ "-parallel[number of parallel tests]:number" \
+ "-cpu[values of GOMAXPROCS to use]:number list" \
+ "-run[run tests and examples matching regexp]:regexp" \
+ "-bench[run benchmarks matching regexp]:regexp" \
+ "-benchtime[run each benchmark during n seconds]:duration" \
+ "-timeout[kill test after that duration]:duration" \
+ "-cpuprofile[write CPU profile to file]:file:_files" \
+ "-memprofile[write heap profile to file]:file:_files" \
+ "-memprofilerate[set heap profiling rate]:number" \
+ "*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }"
+ ;;
+ help)
+ _values "${commands[@]}" \
+ 'gopath[GOPATH environment variable]' \
+ 'importpath[description of import paths]' \
+ 'remote[remote import path syntax]' \
+ 'testflag[description of testing flags]' \
+ 'testfunc[description of testing functions]'
+ ;;
+ run)
+ _arguments -s -w : \
+ ${build_flags[@]} \
+ '*:file:_path_files -g "*.go"'
+ ;;
+ tool)
+ if (( CURRENT == 3 )); then
+ _values "go tool" $(go tool)
+ return
+ fi
+ case ${words[3]} in
+ [568]g)
+ _arguments -s -w : \
+ '-I[search for packages in DIR]:includes:_path_files -/' \
+ '-L[show full path in file:line prints]' \
+ '-S[print the assembly language]' \
+ '-V[print the compiler version]' \
+ '-e[no limit on number of errors printed]' \
+ '-h[panic on an error]' \
+ '-l[disable inlining]' \
+ '-m[print optimization decisions]' \
+ '-o[file specify output file]:file' \
+ '-p[assumed import path for this code]:importpath' \
+ '-u[disable package unsafe]' \
+ "*:file:_files -g '*.go'"
+ ;;
+ [568]l)
+ local O=${words[3]%l}
+ _arguments -s -w : \
+ '-o[file specify output file]:file' \
+ '-L[search for packages in DIR]:includes:_path_files -/' \
+ "*:file:_files -g '*.[ao$O]'"
+ ;;
+ dist)
+ _values "dist tool" banner bootstrap clean env install version
+ ;;
+ *)
+ # use files by default
+ _files
+ ;;
+ esac
+ ;;
+ esac
+}
+
+compdef __go_tool_complete go \ No newline at end of file
diff --git a/plugins/grails/grails.plugin.zsh b/plugins/grails/grails.plugin.zsh
index cc6f9c53b..11777738c 100755
--- a/plugins/grails/grails.plugin.zsh
+++ b/plugins/grails/grails.plugin.zsh
@@ -24,17 +24,23 @@ _enumerateGrailsScripts() {
return
fi
- # - Strip the path
- # - Remove all scripts with a leading '_'
- # - PackagePlugin_.groovy -> PackagePlugin
- # - PackagePlugin -> Package-Plugin
- # - Package-Plugin -> package-plugin
- basename $files \
- | sed -E -e 's/^_?([^_]+)_?.groovy/\1/'\
- -e 's/([a-z])([A-Z])/\1-\2/g' \
- | tr "[:upper:]" "[:lower:]" \
- | sort \
- | uniq
+ scripts=()
+ for file in $files
+ do
+ # - Strip the path
+ # - Remove all scripts with a leading '_'
+ # - PackagePlugin_.groovy -> PackagePlugin
+ # - PackagePlugin -> Package-Plugin
+ # - Package-Plugin -> package-plugin
+ command=$(basename $file \
+ | sed -E -e 's/^_?([^_]+)_?.groovy/\1/'\
+ -e 's/([a-z])([A-Z])/\1-\2/g' \
+ | tr "[:upper:]" "[:lower:]" \
+ | sort \
+ | uniq)
+ scripts+=($command)
+ done
+ echo $scripts
}
_grails() {
diff --git a/plugins/lein/lein.plugin.zsh b/plugins/lein/lein.plugin.zsh
index 19af3556a..11c92979b 100644
--- a/plugins/lein/lein.plugin.zsh
+++ b/plugins/lein/lein.plugin.zsh
@@ -5,15 +5,29 @@ function _lein_commands() {
case $state in
subcommand)
subcommands=(
+ "classpath:print the classpath of the current project"
"clean:remove compiled files and dependencies from project"
"compile:ahead-of-time compile the project"
+ "deploy:build jar and deploy to remote repository"
"deps:download and install all dependencies"
"help:display a list of tasks or help for a given task"
"install:install the project and its dependencies in your local repository"
+ "int:enter an interactive task shell"
+ "interactive:enter an interactive task shell"
+ "jack-in:jack in to a clojure slime session from emacs."
"jar:create a jar file containing the compiled .class files"
+ "javac:compile java source files"
"new:create a new project skeleton"
+ "plugin:manage user-level plugins"
"pom:write a pom.xml file to disk for maven interop"
+ "repl:start a repl session either with the current project or standalone"
+ "retest:run only the test namespaces which failed last time around"
+ "run:run the project's -main function"
+ "search:search remote maven repositories for matching jars"
+ "swank:launch swank server for Emacs to connect"
"test:run the project's tests"
+ "test!:run a project's tests after cleaning and fetching dependencies"
+ "trampoline:run a task without nesting the project's JVM inside Leiningen's."
"uberjar:Create a jar including the contents of each of deps"
"upgrade:upgrade leiningen to the latest stable release"
"version:print leiningen's version"
diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
index f278d4f8d..51cd7c143 100644
--- a/plugins/osx/osx.plugin.zsh
+++ b/plugins/osx/osx.plugin.zsh
@@ -154,3 +154,6 @@ function trash() {
IFS=$temp_ifs
}
+function vncviewer() {
+ open vnc://$@
+}
diff --git a/plugins/pj/pj.plugin.zsh b/plugins/pj/pj.plugin.zsh
new file mode 100644
index 000000000..ba3765b83
--- /dev/null
+++ b/plugins/pj/pj.plugin.zsh
@@ -0,0 +1,42 @@
+#!/bin/zsh
+
+#
+# Original idea by DefV (Jan De Poorter)
+# Source: https://gist.github.com/pjaspers/368394#comment-1016
+#
+# Usage:
+# - Set `$PROJECT_PATHS` in your ~/.zshrc
+# e.g.: PROJECT_PATHS=(~/src ~/work)
+# - In ZSH you now can open a project directory with the command: `pj my-project`
+# the plugin will locate the `my-project` directory in one of the $PROJECT_PATHS
+# Also tab completion is supported.
+# - `pjo my-project` will open the directory in $EDITOR
+#
+
+function pj() {
+ cmd="cd"
+ file=$1
+
+ if [[ "open" == "$file" ]] then
+ file=$2
+ cmd=(${(s: :)EDITOR})
+ fi
+
+ for project in $PROJECT_PATHS; do
+ if [[ -d $project/$file ]] then
+ $cmd "$project/$file"
+ unset project # Unset project var
+ return
+ fi
+ done
+
+ echo "No such project $1"
+}
+
+alias pjo="pj open"
+
+function _pj () {
+ compadd `/bin/ls -l $PROJECT_PATHS 2>/dev/null | awk '{ print $9 }'`
+}
+
+compdef _pj pj
diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh
index d855c2445..78f76c3a3 100644
--- a/plugins/rbenv/rbenv.plugin.zsh
+++ b/plugins/rbenv/rbenv.plugin.zsh
@@ -17,7 +17,7 @@ for rbenvdir in "${rbenvdirs[@]}" ; do
FOUND_RBENV=1
export RBENV_ROOT=$rbenvdir
export PATH=${rbenvdir}/bin:$PATH
- eval "$(rbenv init - zsh)"
+ eval "$(rbenv init --no-rehash - zsh)"
alias rubies="rbenv versions"
alias gemsets="rbenv gemset list"
@@ -32,11 +32,11 @@ for rbenvdir in "${rbenvdirs[@]}" ; do
function gems {
local rbenv_path=$(rbenv prefix)
- gem list $@ | sed \
- -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
- -Ee "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \
- -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
- -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
+ gem list $@ | sed -E \
+ -e "s/\([0-9a-z, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
+ -e "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \
+ -e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
+ -e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
}
function rbenv_prompt_info() {
diff --git a/plugins/sprunge/sprunge.plugin.zsh b/plugins/sprunge/sprunge.plugin.zsh
index 9f9432ac8..fcc9004f8 100644
--- a/plugins/sprunge/sprunge.plugin.zsh
+++ b/plugins/sprunge/sprunge.plugin.zsh
@@ -57,8 +57,6 @@ sprunge() {
fi
else
echo Using input from a pipe or STDIN redirection... >&2
- while read -r line ; do
- echo $line
- done | curl -F 'sprunge=<-' http://sprunge.us
+ curl -F 'sprunge=<-' http://sprunge.us
fi
}
diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh
index c4e92a1fe..7468749f8 100644
--- a/plugins/ssh-agent/ssh-agent.plugin.zsh
+++ b/plugins/ssh-agent/ssh-agent.plugin.zsh
@@ -6,11 +6,17 @@
#
# zstyle :omz:plugins:ssh-agent agent-forwarding on
#
-# To load multiple identies use the identities style, For
+# To load multiple identities use the identities style, For
# example:
#
# zstyle :omz:plugins:ssh-agent id_rsa id_rsa2 id_github
#
+# To set the maximum lifetime of the identities, use the
+# lifetime style. The lifetime may be specified in seconds
+# or as described in sshd_config(5) (see TIME FORMATS)
+# If left unspecified, the default lifetime is forever.
+#
+# zstyle :omz:plugins:ssh-agent lifetime 4h
#
# CREDITS
#
@@ -27,15 +33,18 @@ local _plugin__forwarding
function _plugin__start_agent()
{
local -a identities
+ local lifetime
+ zstyle -s :omz:plugins:ssh-agent lifetime lifetime
# start ssh-agent and setup environment
- /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${_plugin__ssh_env}
+ /usr/bin/env ssh-agent ${lifetime:+-t} ${lifetime} | sed 's/^echo/#echo/' > ${_plugin__ssh_env}
chmod 600 ${_plugin__ssh_env}
. ${_plugin__ssh_env} > /dev/null
# load identies
zstyle -a :omz:plugins:ssh-agent identities identities
- echo starting...
+ echo starting ssh-agent...
+
/usr/bin/ssh-add $HOME/.ssh/${^identities}
}
diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh
index f91be70e4..a06100472 100644
--- a/plugins/vi-mode/vi-mode.plugin.zsh
+++ b/plugins/vi-mode/vi-mode.plugin.zsh
@@ -3,18 +3,13 @@
function zle-keymap-select zle-line-init zle-line-finish {
# The terminal must be in application mode when ZLE is active for $terminfo
# values to be valid.
- if (( $+terminfo[smkx] && $+terminfo[rmkx] )); then
- case "$0" in
- (zle-line-init)
- # Enable terminal application mode.
- echoti smkx
- ;;
- (zle-line-finish)
- # Disable terminal application mode.
- echoti rmkx
- ;;
- esac
+ if (( ${+terminfo[smkx]} )); then
+ printf '%s' ${terminfo[smkx]}
fi
+ if (( ${+terminfo[rmkx]} )); then
+ printf '%s' ${terminfo[rmkx]}
+ fi
+
zle reset-prompt
zle -R
}
diff --git a/plugins/zeus/README.md b/plugins/zeus/README.md
index 4409943fe..d7c2aef80 100644
--- a/plugins/zeus/README.md
+++ b/plugins/zeus/README.md
@@ -25,6 +25,8 @@
* `zcu` aliases `zeus cucumber`
* `zucumber` aliases `zeus cucumber`
+* `zspec` aliases `zeus rspec`
+
* `zt` aliases `zeus test`
* `zest` aliases `zeus test`
diff --git a/plugins/zeus/zeus.plugin.zsh b/plugins/zeus/zeus.plugin.zsh
index 2fc7e1ebf..1658b34d3 100644
--- a/plugins/zeus/zeus.plugin.zsh
+++ b/plugins/zeus/zeus.plugin.zsh
@@ -4,7 +4,7 @@
# Always use bundler.
# Rails depends on bundler, so we can be pretty sure, that there are no
-# problems with this command. For all the other aliases I provided an
+# problems with this command. For all the other aliases I provided an
# alternative, in case people have conflicts with other plugins (e.g. suse).
alias zeus='bundle exec zeus'
@@ -40,6 +40,9 @@ alias zunner='zeus runner'
alias zcu='zeus cucumber'
alias zucumber='zeus cucumber'
+# Rspec
+alias zspec='zeus rspec'
+
# Test
alias zt='zeus test'
alias zest='zeus test'