summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/capistrano/_capistrano2
-rw-r--r--plugins/golang/golang.plugin.zsh150
-rwxr-xr-xplugins/grails/grails.plugin.zsh28
-rw-r--r--plugins/mvn/mvn.plugin.zsh2
-rw-r--r--plugins/osx/osx.plugin.zsh3
-rw-r--r--plugins/rbenv/rbenv.plugin.zsh2
-rw-r--r--plugins/ssh-agent/ssh-agent.plugin.zsh15
7 files changed, 185 insertions, 17 deletions
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/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/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh
index da29b4f0a..c2d8e7ed7 100644
--- a/plugins/mvn/mvn.plugin.zsh
+++ b/plugins/mvn/mvn.plugin.zsh
@@ -163,7 +163,7 @@ function listMavenCompletions {
cli:execute cli:execute-phase
archetype:generate generate-sources
cobertura:cobertura
- -Dtest= `if [ -d ./src ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`
+ -Dtest= `if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`
);
}
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/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh
index fb9df4bdd..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"
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}
}