summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/alias-finder/alias-finder.plugin.zsh2
-rwxr-xr-xplugins/emacs/emacsclient.sh3
-rw-r--r--plugins/fabric/_fab19
-rw-r--r--plugins/fasd/README.md21
-rw-r--r--plugins/mvn/mvn.plugin.zsh2
-rw-r--r--plugins/powder/README.md8
-rw-r--r--plugins/profiles/README.md25
-rw-r--r--plugins/python/python.plugin.zsh7
-rw-r--r--plugins/swiftpm/README.md2
-rw-r--r--plugins/swiftpm/_swift190
10 files changed, 177 insertions, 102 deletions
diff --git a/plugins/alias-finder/alias-finder.plugin.zsh b/plugins/alias-finder/alias-finder.plugin.zsh
index 2bfaad597..6b8fa66ce 100644
--- a/plugins/alias-finder/alias-finder.plugin.zsh
+++ b/plugins/alias-finder/alias-finder.plugin.zsh
@@ -14,7 +14,7 @@ alias-finder() {
esac
done
cmd=$(sed 's/[].\|$(){}?+*^[]/\\&/g' <<< $cmd) # adds escaping for grep
- if [[ $(wc -l <<< $cmd) == 1 ]]; then
+ if (( $(wc -l <<< $cmd) == 1 )); then
while [[ $cmd != "" ]]; do
if [[ $longer = true ]]; then
wordStart="'{0,1}"
diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh
index 26b28d495..0aa8d6f40 100755
--- a/plugins/emacs/emacsclient.sh
+++ b/plugins/emacs/emacsclient.sh
@@ -20,7 +20,8 @@ _emacsfun()
# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
if [ "$#" -ge "2" -a "$2" = "-" ]
then
- tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)"
+ tempfile="$(mktemp --tmpdir emacs-stdin-$USER.XXXXXXX 2>/dev/null \
+ || mktemp -t emacs-stdin-$USER)" # support BSD mktemp
cat - > "$tempfile"
_emacsfun --no-wait $tempfile
else
diff --git a/plugins/fabric/_fab b/plugins/fabric/_fab
index 4c2e61306..9102dadef 100644
--- a/plugins/fabric/_fab
+++ b/plugins/fabric/_fab
@@ -4,10 +4,19 @@
local curcontext=$curcontext state line
declare -A opt_args
-declare target_list
-target_list=(`fab --shortlist 2>/dev/null || fab --complete 2>/dev/null`)
+declare -a target_list
+target_list=("${(@f)$(fab -l 2>/dev/null | awk '{
+ if (NF == 0 || NR == 1) next
+ if (NF < 2) print $1
+ else {
+ docstring=substr($0, index($0,$2))
+ gsub(":", "\\:", docstring)
+ print $1":"docstring
+ }
+}')}")
-_targets() {
+_fab_targets() {
+ [[ -n "$target_list" ]] || return
_describe -t commands "fabric targets" target_list
}
@@ -28,7 +37,7 @@ _arguments -w -S -C \
'(-)--shortlist[print non-verbose list of possible commands and exit]: :->noargs' \
'(--reject-unknown-hosts)--reject-unknown-hosts[reject unknown hosts]' \
'(--no-pty)--no-pty[do not use pseudo-terminal in run/sudo]' \
- "(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_targets" \
+ "(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_fab_targets" \
'(-D --disable-known-hosts)'{-D,--disable-known-hosts}'[do not load user known_hosts file]' \
'(-r --reject-unknown-hosts)'{-r,--reject-unknown-hosts}'[reject unknown hosts]' \
'(-u+ --user=-)'{-u+,--user=-}'[username to use when connecting to remote hosts]: :' \
@@ -53,7 +62,7 @@ if [[ CURRENT -ge 1 ]]; then
levels)
_describe -t commands "output levels" output_levels;;
*)
- _targets;;
+ _fab_targets;;
esac
return
diff --git a/plugins/fasd/README.md b/plugins/fasd/README.md
new file mode 100644
index 000000000..1641a92d0
--- /dev/null
+++ b/plugins/fasd/README.md
@@ -0,0 +1,21 @@
+# fasd
+
+[`Fasd`](https://github.com/clvv/fasd) (pronounced similar to "fast") is a command-line productivity booster. Fasd offers quick access to files and directories for POSIX shells.
+
+To use it, add `fasd` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... fd)
+```
+
+## Installation
+
+Please find detailed installation guide [`here`](https://github.com/clvv/fasd#install)
+
+## Aliases
+
+| Alias | Command | Description |
+|-------|-------------------------------------------|-------------------------------------------------------------|
+| v | `fasd -f -e "$EDITOR"` | List frequent/recent files matching the given filename. |
+| o | `fasd -a -e xdg-open` | List frequent/recent files and directories matching. |
+| j | `fasd_cd -d -i` | cd with interactive selection | \ No newline at end of file
diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh
index 01aef814d..0866e5553 100644
--- a/plugins/mvn/mvn.plugin.zsh
+++ b/plugins/mvn/mvn.plugin.zsh
@@ -267,6 +267,8 @@ function listMavenCompletions {
stage:copy
# toolchain
toolchain:toolchain
+ #liberty
+ liberty:clean-server liberty:compile-jsp liberty:configure-arquillian liberty:create-server liberty:debug liberty:debug-server liberty:deploy liberty:dev liberty:display-url liberty:dump-server liberty:install-apps liberty:install-feature liberty:install-server liberty:java-dump-server liberty:package-server liberty:run liberty:run-server liberty:server-status liberty:start liberty:start-server liberty:status liberty:stop liberty:stop-server liberty:test-start-server liberty:test-stop-server liberty:undeploy liberty:uninstall-feature
# options
"-Dmaven.test.skip=true" -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile "-Dpmd.skip=true" "-Dcheckstyle.skip=true" "-Dtycho.mode=maven" "-Dmaven.test.failure.ignore=true" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile="
diff --git a/plugins/powder/README.md b/plugins/powder/README.md
new file mode 100644
index 000000000..a83b1f2d3
--- /dev/null
+++ b/plugins/powder/README.md
@@ -0,0 +1,8 @@
+# Powder
+
+This plugin provides completion for [powder](https://github.com/powder-rb/powder/).
+
+To use it, add powder to the plugins array of your zshrc file:
+```
+plugins=(... powder)
+```
diff --git a/plugins/profiles/README.md b/plugins/profiles/README.md
new file mode 100644
index 000000000..5aa1918e2
--- /dev/null
+++ b/plugins/profiles/README.md
@@ -0,0 +1,25 @@
+# profiles plugin
+
+This plugin allows you to create separate configuration files for zsh based
+on your long hostname (including the domain).
+
+To use it, add profiles to the plugins array of your zshrc file:
+
+```sh
+plugins=(... profiles)
+```
+
+It takes your `$HOST` variable and looks for files named according to the
+domain parts in `$ZSH_CUSTOM/profiles/` directory.
+
+For example, for `HOST=host.domain.com`, it will try to load the following files,
+in this order:
+
+```text
+$ZSH_CUSTOM/profiles/com
+$ZSH_CUSTOM/profiles/domain.com
+$ZSH_CUSTOM/profiles/host.domain.com
+```
+
+This means that if there are conflicting settings on those files, the one to take
+precedence will be the last applied, i.e. the one in host.domain.com.
diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh
index 950b0e01a..f39cd80b7 100644
--- a/plugins/python/python.plugin.zsh
+++ b/plugins/python/python.plugin.zsh
@@ -1,13 +1,14 @@
# Find python file
alias pyfind='find . -name "*.py"'
-# Remove python compiled byte-code and mypy cache in either current directory or in a
-# list of specified directories
+# Remove python compiled byte-code and mypy/pytest cache in either the current
+# directory or in a list of specified directories (including sub directories).
function pyclean() {
ZSH_PYCLEAN_PLACES=${*:-'.'}
find ${ZSH_PYCLEAN_PLACES} -type f -name "*.py[co]" -delete
find ${ZSH_PYCLEAN_PLACES} -type d -name "__pycache__" -delete
- find ${ZSH_PYCLEAN_PLACES} -type d -name ".mypy_cache" -delete
+ find ${ZSH_PYCLEAN_PLACES} -depth -type d -name ".mypy_cache" -exec rm -r "{}" +
+ find ${ZSH_PYCLEAN_PLACES} -depth -type d -name ".pytest_cache" -exec rm -r "{}" +
}
# Grep among .py files
diff --git a/plugins/swiftpm/README.md b/plugins/swiftpm/README.md
index 291458511..a722c03e4 100644
--- a/plugins/swiftpm/README.md
+++ b/plugins/swiftpm/README.md
@@ -2,7 +2,7 @@
## Description
-This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager), as well as autocompletion for Swift 5.0.
+This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager), as well as autocompletion for Swift 5.1.
To start using it, add the `swiftpm` plugin to your `plugins` array in `~/.zshrc`:
diff --git a/plugins/swiftpm/_swift b/plugins/swiftpm/_swift
index 1366b4d9c..fe6f1c9aa 100644
--- a/plugins/swiftpm/_swift
+++ b/plugins/swiftpm/_swift
@@ -82,13 +82,15 @@ _swift_build() {
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
- "--enable-llbuild-library[Enable building with the llbuild library]"
"--force-resolved-versions[]"
"--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
"--enable-index-store[Enable indexing-while-building feature]"
"--disable-index-store[Disable indexing-while-building feature]"
"--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
"--enable-parseable-module-interfaces[]"
+ "--trace-resolver[]"
+ "(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
+ "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
"--build-tests[Build both source and test targets]"
"--product[Build the specified product]:Build the specified product: "
"--target[Build the specified target]:Build the specified target: "
@@ -125,13 +127,15 @@ _swift_run() {
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
- "--enable-llbuild-library[Enable building with the llbuild library]"
"--force-resolved-versions[]"
"--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
"--enable-index-store[Enable indexing-while-building feature]"
"--disable-index-store[Disable indexing-while-building feature]"
"--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
"--enable-parseable-module-interfaces[]"
+ "--trace-resolver[]"
+ "(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
+ "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
"--skip-build[Skip building the executable product]"
"--build-tests[Build both source and test targets]"
"--repl[Launch Swift REPL for the package]"
@@ -166,13 +170,15 @@ _swift_package() {
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
- "--enable-llbuild-library[Enable building with the llbuild library]"
"--force-resolved-versions[]"
"--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
"--enable-index-store[Enable indexing-while-building feature]"
"--disable-index-store[Disable indexing-while-building feature]"
"--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
"--enable-parseable-module-interfaces[]"
+ "--trace-resolver[]"
+ "(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
+ "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
'(-): :->command'
'(-)*:: :->arg'
)
@@ -181,49 +187,61 @@ _swift_package() {
(command)
local modes
modes=(
- 'update:Update package dependencies'
+ 'completion-tool:Completion tool (for shell completions)'
+ 'dump-package:Print parsed Package.swift as JSON'
'describe:Describe the current package'
- 'resolve:Resolve package dependencies'
- 'tools-version:Manipulate tools version of the current package'
- 'unedit:Remove a package from editable mode'
+ 'clean:Delete build artifacts'
'show-dependencies:Print the resolved dependency graph'
+ 'init:Initialize a new package'
+ 'unedit:Remove a package from editable mode'
+ 'tools-version:Manipulate tools version of the current package'
'fetch:'
- 'dump-package:Print parsed Package.swift as JSON'
+ 'resolve:Resolve package dependencies'
+ 'reset:Reset the complete cache/build directory'
+ 'generate-xcodeproj:Generates an Xcode project'
'edit:Put a package in editable mode'
'config:Manipulate configuration of the package'
- 'completion-tool:Completion tool (for shell completions)'
- 'clean:Delete build artifacts'
- 'generate-xcodeproj:Generates an Xcode project'
- 'reset:Reset the complete cache/build directory'
- 'init:Initialize a new package'
+ 'update:Update package dependencies'
)
_describe "mode" modes
;;
(arg)
case ${words[1]} in
- (update)
- _swift_package_update
+ (completion-tool)
+ _swift_package_completion-tool
+ ;;
+ (dump-package)
+ _swift_package_dump-package
;;
(describe)
_swift_package_describe
;;
- (resolve)
- _swift_package_resolve
+ (clean)
+ _swift_package_clean
;;
- (tools-version)
- _swift_package_tools-version
+ (show-dependencies)
+ _swift_package_show-dependencies
+ ;;
+ (init)
+ _swift_package_init
;;
(unedit)
_swift_package_unedit
;;
- (show-dependencies)
- _swift_package_show-dependencies
+ (tools-version)
+ _swift_package_tools-version
;;
(fetch)
_swift_package_fetch
;;
- (dump-package)
- _swift_package_dump-package
+ (resolve)
+ _swift_package_resolve
+ ;;
+ (reset)
+ _swift_package_reset
+ ;;
+ (generate-xcodeproj)
+ _swift_package_generate-xcodeproj
;;
(edit)
_swift_package_edit
@@ -231,27 +249,22 @@ _swift_package() {
(config)
_swift_package_config
;;
- (completion-tool)
- _swift_package_completion-tool
- ;;
- (clean)
- _swift_package_clean
- ;;
- (generate-xcodeproj)
- _swift_package_generate-xcodeproj
- ;;
- (reset)
- _swift_package_reset
- ;;
- (init)
- _swift_package_init
+ (update)
+ _swift_package_update
;;
esac
;;
esac
}
-_swift_package_update() {
+_swift_package_completion-tool() {
+ arguments=(
+ ": :{_values '' 'generate-bash-script[generate Bash completion script]' 'generate-zsh-script[generate Bash completion script]' 'list-dependencies[list all dependencies' names]' 'list-executables[list all executables' names]'}"
+ )
+ _arguments $arguments && return
+}
+
+_swift_package_dump-package() {
arguments=(
)
_arguments $arguments && return
@@ -264,20 +277,23 @@ _swift_package_describe() {
_arguments $arguments && return
}
-_swift_package_resolve() {
+_swift_package_clean() {
arguments=(
- ":The name of the package to resolve:_swift_dependency"
- "--version[The version to resolve at]:The version to resolve at: "
- "--branch[The branch to resolve at]:The branch to resolve at: "
- "--revision[The revision to resolve at]:The revision to resolve at: "
)
_arguments $arguments && return
}
-_swift_package_tools-version() {
+_swift_package_show-dependencies() {
arguments=(
- "--set[Set tools version of package to the given value]:Set tools version of package to the given value: "
- "--set-current[Set tools version of package to the current tools version in use]"
+ "--format[text|dot|json|flatlist]: :{_values '' 'text[list dependencies using text format]' 'dot[list dependencies using dot format]' 'json[list dependencies using JSON format]'}"
+ )
+ _arguments $arguments && return
+}
+
+_swift_package_init() {
+ arguments=(
+ "--type[empty|library|executable|system-module|manifest]: :{_values '' 'empty[generates an empty project]' 'library[generates project for a dynamic library]' 'executable[generates a project for a cli executable]' 'system-module[generates a project for a system module]'}"
+ "--name[Provide custom package name]:Provide custom package name: "
)
_arguments $arguments && return
}
@@ -290,9 +306,10 @@ _swift_package_unedit() {
_arguments $arguments && return
}
-_swift_package_show-dependencies() {
+_swift_package_tools-version() {
arguments=(
- "--format[text|dot|json|flatlist]: :{_values '' 'text[list dependencies using text format]' 'dot[list dependencies using dot format]' 'json[list dependencies using JSON format]'}"
+ "--set[Set tools version of package to the given value]:Set tools version of package to the given value: "
+ "--set-current[Set tools version of package to the current tools version in use]"
)
_arguments $arguments && return
}
@@ -303,8 +320,30 @@ _swift_package_fetch() {
_arguments $arguments && return
}
-_swift_package_dump-package() {
+_swift_package_resolve() {
arguments=(
+ ":The name of the package to resolve:_swift_dependency"
+ "--version[The version to resolve at]:The version to resolve at: "
+ "--branch[The branch to resolve at]:The branch to resolve at: "
+ "--revision[The revision to resolve at]:The revision to resolve at: "
+ )
+ _arguments $arguments && return
+}
+
+_swift_package_reset() {
+ arguments=(
+ )
+ _arguments $arguments && return
+}
+
+_swift_package_generate-xcodeproj() {
+ arguments=(
+ "--xcconfig-overrides[Path to xcconfig file]:Path to xcconfig file:_files"
+ "--enable-code-coverage[Enable code coverage in the generated project]"
+ "--output[Path where the Xcode project should be generated]:Path where the Xcode project should be generated:_files"
+ "--legacy-scheme-generator[Use the legacy scheme generator]"
+ "--watch[Watch for changes to the Package manifest to regenerate the Xcode project]"
+ "--skip-extra-files[Do not add file references for extra files to the generated Xcode project]"
)
_arguments $arguments && return
}
@@ -330,8 +369,8 @@ _swift_package_config() {
local modes
modes=(
'unset-mirror:Remove an existing mirror'
- 'set-mirror:Set a mirror for a dependency'
'get-mirror:Print mirror configuration for the given package dependency'
+ 'set-mirror:Set a mirror for a dependency'
)
_describe "mode" modes
;;
@@ -340,12 +379,12 @@ _swift_package_config() {
(unset-mirror)
_swift_package_config_unset-mirror
;;
- (set-mirror)
- _swift_package_config_set-mirror
- ;;
(get-mirror)
_swift_package_config_get-mirror
;;
+ (set-mirror)
+ _swift_package_config_set-mirror
+ ;;
esac
;;
esac
@@ -359,14 +398,6 @@ _swift_package_config_unset-mirror() {
_arguments $arguments && return
}
-_swift_package_config_set-mirror() {
- arguments=(
- "--package-url[The package dependency url]:The package dependency url: "
- "--mirror-url[The mirror url]:The mirror url: "
- )
- _arguments $arguments && return
-}
-
_swift_package_config_get-mirror() {
arguments=(
"--package-url[The package dependency url]:The package dependency url: "
@@ -374,41 +405,16 @@ _swift_package_config_get-mirror() {
_arguments $arguments && return
}
-_swift_package_completion-tool() {
- arguments=(
- ": :{_values '' 'generate-bash-script[generate Bash completion script]' 'generate-zsh-script[generate Bash completion script]' 'list-dependencies[list all dependencies' names]' 'list-executables[list all executables' names]'}"
- )
- _arguments $arguments && return
-}
-
-_swift_package_clean() {
- arguments=(
- )
- _arguments $arguments && return
-}
-
-_swift_package_generate-xcodeproj() {
- arguments=(
- "--xcconfig-overrides[Path to xcconfig file]:Path to xcconfig file:_files"
- "--enable-code-coverage[Enable code coverage in the generated project]"
- "--output[Path where the Xcode project should be generated]:Path where the Xcode project should be generated:_files"
- "--legacy-scheme-generator[Use the legacy scheme generator]"
- "--watch[Watch for changes to the Package manifest to regenerate the Xcode project]"
- "--skip-extra-files[Do not add file references for extra files to the generated Xcode project]"
- )
- _arguments $arguments && return
-}
-
-_swift_package_reset() {
+_swift_package_config_set-mirror() {
arguments=(
+ "--package-url[The package dependency url]:The package dependency url: "
+ "--mirror-url[The mirror url]:The mirror url: "
)
_arguments $arguments && return
}
-_swift_package_init() {
+_swift_package_update() {
arguments=(
- "--type[empty|library|executable|system-module]: :{_values '' 'empty[generates an empty project]' 'library[generates project for a dynamic library]' 'executable[generates a project for a cli executable]' 'system-module[generates a project for a system module]'}"
- "--name[Provide custom package name]:Provide custom package name: "
)
_arguments $arguments && return
}
@@ -440,13 +446,15 @@ _swift_test() {
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
- "--enable-llbuild-library[Enable building with the llbuild library]"
"--force-resolved-versions[]"
"--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
"--enable-index-store[Enable indexing-while-building feature]"
"--disable-index-store[Disable indexing-while-building feature]"
"--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
"--enable-parseable-module-interfaces[]"
+ "--trace-resolver[]"
+ "(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
+ "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
"--skip-build[Skip building the test target]"
"(--list-tests -l)"{--list-tests,-l}"[Lists test methods in specifier format]"
"--generate-linuxmain[Generate LinuxMain.swift entries for the package]"