summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/CODEOWNERS1
-rw-r--r--README.md8
-rw-r--r--lib/clipboard.zsh2
-rw-r--r--lib/completion.zsh2
-rw-r--r--lib/functions.zsh4
-rw-r--r--lib/grep.zsh57
-rw-r--r--lib/misc.zsh20
-rw-r--r--lib/spectrum.zsh26
-rw-r--r--lib/termsupport.zsh65
-rw-r--r--plugins/apache2-macports/README.md26
-rw-r--r--plugins/arcanist/README.md14
-rw-r--r--plugins/arcanist/arcanist.plugin.zsh17
-rw-r--r--plugins/archlinux/README.md10
-rw-r--r--plugins/archlinux/archlinux.plugin.zsh2
-rw-r--r--plugins/autoenv/README.md8
-rw-r--r--plugins/autoenv/autoenv.plugin.zsh60
-rw-r--r--plugins/autojump/README.md2
-rw-r--r--plugins/autojump/autojump.plugin.zsh2
-rw-r--r--plugins/aws/aws.plugin.zsh69
-rw-r--r--plugins/battery/battery.plugin.zsh6
-rw-r--r--plugins/bower/README.md3
-rw-r--r--plugins/cake/README.md2
-rw-r--r--plugins/catimg/README.md24
-rw-r--r--plugins/chucknorris/README.md28
-rw-r--r--plugins/cloudapp/README.md2
-rw-r--r--plugins/coffee/README.md2
-rw-r--r--plugins/colored-man-pages/README.md3
-rw-r--r--plugins/colored-man-pages/colored-man-pages.plugin.zsh7
-rw-r--r--plugins/command-not-found/command-not-found.plugin.zsh6
-rw-r--r--plugins/compleat/README.md3
-rw-r--r--plugins/composer/README.md30
-rw-r--r--plugins/composer/composer.plugin.zsh26
-rw-r--r--plugins/copyfile/README.md3
-rw-r--r--plugins/cpanm/README.md6
-rw-r--r--plugins/direnv/README.md15
-rw-r--r--plugins/direnv/direnv.plugin.zsh13
-rw-r--r--plugins/dirhistory/README.md22
-rw-r--r--plugins/dirpersist/README.md3
-rw-r--r--plugins/django/README.md20
-rw-r--r--plugins/dnf/README.md14
-rw-r--r--plugins/docker-compose/README.md3
-rw-r--r--plugins/docker/README.md1
-rw-r--r--plugins/dotenv/README.md34
-rw-r--r--plugins/dotenv/dotenv.plugin.zsh51
-rw-r--r--plugins/encode64/README.md25
-rw-r--r--plugins/fabric/README.md2
-rw-r--r--plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh6
-rw-r--r--plugins/fasd/fasd.plugin.zsh24
-rw-r--r--plugins/fbterm/README.md5
-rw-r--r--plugins/forklift/README.md18
-rw-r--r--plugins/gas/README.md1
-rw-r--r--plugins/geeknote/README.md16
-rw-r--r--plugins/geeknote/_geeknote267
-rw-r--r--plugins/git-extras/README.md10
-rw-r--r--plugins/git-flow/README.md13
-rw-r--r--plugins/git-remote-branch/README.md5
-rw-r--r--plugins/git/README.md8
-rw-r--r--plugins/git/git.plugin.zsh2
-rw-r--r--plugins/gitfast/README.md2
-rw-r--r--plugins/github/README.md10
-rw-r--r--plugins/gitignore/gitignore.plugin.zsh2
-rw-r--r--plugins/gnu-utils/gnu-utils.plugin.zsh2
-rw-r--r--plugins/gpg-agent/README.md3
-rw-r--r--plugins/gradle/README.md13
-rw-r--r--[l---------]plugins/gradle/_gradle421
l---------plugins/gradle/_gradlew1
-rw-r--r--plugins/gradle/gradle.plugin.zsh202
-rw-r--r--plugins/grails/README.md55
-rw-r--r--plugins/history-substring-search/README.md179
-rw-r--r--plugins/history-substring-search/history-substring-search.plugin.zsh17
-rw-r--r--plugins/history-substring-search/history-substring-search.zsh510
-rw-r--r--plugins/history/README.md20
-rw-r--r--plugins/history/history.plugin.zsh9
-rw-r--r--plugins/httpie/README.md1
-rw-r--r--plugins/jira/README.md3
-rw-r--r--plugins/jira/jira.plugin.zsh28
-rw-r--r--plugins/jsontools/README.md36
-rw-r--r--plugins/keychain/keychain.plugin.zsh3
-rw-r--r--plugins/kitchen/_kitchen2
-rw-r--r--plugins/knife/_knife11
-rw-r--r--plugins/kube-ps1/README.md258
-rw-r--r--plugins/kube-ps1/kube-ps1.plugin.zsh316
-rw-r--r--plugins/laravel4/README.md12
-rw-r--r--plugins/last-working-dir/README.md8
-rw-r--r--plugins/lighthouse/README.md5
-rw-r--r--plugins/lol/README.md102
-rw-r--r--plugins/man/man.plugin.zsh8
-rw-r--r--plugins/mercurial/README.md96
-rw-r--r--plugins/mercurial/mercurial.plugin.zsh13
-rw-r--r--plugins/meteor/README.md3
-rw-r--r--plugins/minikube/minikube.plugin.zsh11
-rw-r--r--plugins/mix/_mix3
-rw-r--r--plugins/mvn/README.md1
-rw-r--r--plugins/mysql-macports/README.md12
-rw-r--r--plugins/node/README.md9
-rw-r--r--plugins/npm/README.md5
-rw-r--r--plugins/nvm/_nvm1
-rw-r--r--plugins/osx/README.md47
-rw-r--r--plugins/pass/_pass8
-rw-r--r--plugins/perms/README.md14
-rw-r--r--plugins/phing/README.md5
-rw-r--r--plugins/pip/_pip1
-rw-r--r--plugins/pylint/README.md7
-rw-r--r--plugins/pylint/pylint.plugin.zsh2
-rw-r--r--plugins/python/README.md3
-rw-r--r--plugins/python/python.plugin.zsh29
-rw-r--r--plugins/rails/README.md1
-rw-r--r--plugins/rbenv/rbenv.plugin.zsh15
-rw-r--r--plugins/repo/README.md28
-rw-r--r--plugins/repo/_repo2
-rw-r--r--plugins/repo/repo.plugin.zsh20
-rw-r--r--plugins/rvm/README.md3
-rw-r--r--plugins/scala/README.md13
-rw-r--r--plugins/sdk/README.md8
-rw-r--r--plugins/sdk/sdk.plugin.zsh18
-rw-r--r--plugins/shrink-path/README.md23
-rw-r--r--plugins/shrink-path/shrink-path.plugin.zsh52
-rw-r--r--plugins/sprunge/README.md3
-rw-r--r--plugins/stack/stack.plugin.zsh39
-rw-r--r--plugins/sublime/sublime.plugin.zsh2
-rw-r--r--plugins/sudo/README.md22
-rw-r--r--plugins/supervisor/README.md1
-rw-r--r--plugins/svn-fast-info/README.md1
-rw-r--r--plugins/systemd/systemd.plugin.zsh2
-rw-r--r--plugins/taskwarrior/README.md7
-rw-r--r--plugins/taskwarrior/_task4
-rw-r--r--plugins/textmate/README.md3
-rw-r--r--plugins/themes/themes.plugin.zsh10
-rw-r--r--plugins/tig/README.md2
-rw-r--r--plugins/tmux/README.md4
-rw-r--r--plugins/tmuxinator/README.md12
-rw-r--r--plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh3
-rw-r--r--plugins/wakeonlan/README.md (renamed from plugins/wakeonlan/README)24
-rw-r--r--plugins/yii/README.md3
-rw-r--r--plugins/yii2/yii2.plugin.zsh2
-rw-r--r--plugins/yum/README.md2
-rw-r--r--plugins/z/README.md23
-rw-r--r--plugins/zeus/README.md107
-rw-r--r--plugins/zsh_reload/zsh_reload.plugin.zsh2
-rw-r--r--themes/nebirhos.zsh-theme2
-rw-r--r--themes/random.zsh-theme4
-rw-r--r--tools/upgrade.sh36
142 files changed, 2657 insertions, 1479 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 000000000..6a18bf062
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1 @@
+plugins/gitfast/ @felipec
diff --git a/README.md b/README.md
index 187cceb7d..38cfd9f4e 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twi
* A Unix-like operating system: macOS, Linux, BSD. On Windows: WSL is preferred, but cygwin or msys also mostly work.
* [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (run `zsh --version` to confirm), check the following instructions here: [Installing ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH)
* `curl` or `wget` should be installed
-* `git` should be installed
+* `git` should be installed (recommended v1.7.2 or higher)
### Basic Installation
@@ -133,6 +133,12 @@ ZSH_THEME_RANDOM_CANDIDATES=(
)
```
+If you only know which themes you don't like, you can add them similarly to a blacklist:
+
+```shell
+ZSH_THEME_RANDOM_BLACKLIST=(pygmalion tjkirch_mod)
+```
+
### FAQ
If you have some more questions or issues, you might find a solution in our [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ).
diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh
index 808f2ea2d..122145f15 100644
--- a/lib/clipboard.zsh
+++ b/lib/clipboard.zsh
@@ -83,7 +83,7 @@ function detect-clipboard() {
function clippaste() { tmux save-buffer -; }
elif [[ $(uname -r) = *icrosoft* ]]; then
function clipcopy() { clip.exe < "${1:-/dev/stdin}"; }
- function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; }
+ function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
else
function _retry_clipboard_detection_or_fail() {
local clipcmd="${1}"; shift
diff --git a/lib/completion.zsh b/lib/completion.zsh
index c932bc925..8b87557a2 100644
--- a/lib/completion.zsh
+++ b/lib/completion.zsh
@@ -73,4 +73,4 @@ if [[ $COMPLETION_WAITING_DOTS = true ]]; then
fi
# automatically load bash completion functions
-autoload -Uz bashcompinit && bashcompinit
+autoload -U +X bashcompinit && bashcompinit
diff --git a/lib/functions.zsh b/lib/functions.zsh
index 91e9cf895..678e29ce7 100644
--- a/lib/functions.zsh
+++ b/lib/functions.zsh
@@ -8,7 +8,7 @@ function uninstall_oh_my_zsh() {
function upgrade_oh_my_zsh() {
env ZSH="$ZSH" sh "$ZSH/tools/upgrade.sh"
- rm -rf "$ZSH/log/update.lock"
+ command rm -rf "$ZSH/log/update.lock"
}
function take() {
@@ -89,7 +89,7 @@ function default() {
# 0 if the env variable exists, 3 if it was set
#
function env_default() {
- (( ${${(@f):-$(typeset +xg)}[(I)$1]} )) && return 0
+ [[ ${parameters[$1]} = *-export* ]] && return 0
export "$1=$2" && return 3
}
diff --git a/lib/grep.zsh b/lib/grep.zsh
index abc1650a1..a725e0f26 100644
--- a/lib/grep.zsh
+++ b/lib/grep.zsh
@@ -1,28 +1,41 @@
-# is x grep argument available?
-grep-flag-available() {
- echo | grep $1 "" >/dev/null 2>&1
-}
+__GREP_CACHE_FILE="$ZSH_CACHE_DIR"/grep-alias
-GREP_OPTIONS=""
+# See if there's a cache file modified in the last day
+__GREP_ALIAS_CACHES=("$__GREP_CACHE_FILE"(Nm-1))
+if [[ -n "$__GREP_ALIAS_CACHES" ]]; then
+ source "$__GREP_CACHE_FILE"
+else
+ grep-flags-available() {
+ command grep "$@" "" &>/dev/null <<< ""
+ }
-# color grep results
-if grep-flag-available --color=auto; then
- GREP_OPTIONS+=" --color=auto"
-fi
+ # Ignore these folders (if the necessary grep flags are available)
+ EXC_FOLDERS="{.bzr,CVS,.git,.hg,.svn,.idea,.tox}"
-# ignore VCS folders (if the necessary grep flags are available)
-VCS_FOLDERS="{.bzr,CVS,.git,.hg,.svn}"
+ # Check for --exclude-dir, otherwise check for --exclude. If --exclude
+ # isn't available, --color won't be either (they were released at the same
+ # time (v2.5): https://git.savannah.gnu.org/cgit/grep.git/tree/NEWS?id=1236f007
+ if grep-flags-available --color=auto --exclude-dir=.cvs; then
+ GREP_OPTIONS="--color=auto --exclude-dir=$EXC_FOLDERS"
+ elif grep-flags-available --color=auto --exclude=.cvs; then
+ GREP_OPTIONS="--color=auto --exclude=$EXC_FOLDERS"
+ fi
-if grep-flag-available --exclude-dir=.cvs; then
- GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS"
-elif grep-flag-available --exclude=.cvs; then
- GREP_OPTIONS+=" --exclude=$VCS_FOLDERS"
-fi
+ if [[ -n "$GREP_OPTIONS" ]]; then
+ # export grep, egrep and fgrep settings
+ alias grep="grep $GREP_OPTIONS"
+ alias egrep="egrep $GREP_OPTIONS"
+ alias fgrep="fgrep $GREP_OPTIONS"
-# export grep settings
-alias grep="grep $GREP_OPTIONS"
+ # write to cache file if cache directory is writable
+ if [[ -w "$ZSH_CACHE_DIR" ]]; then
+ alias -L grep egrep fgrep >| "$__GREP_CACHE_FILE"
+ fi
+ fi
+
+ # Clean up
+ unset GREP_OPTIONS EXC_FOLDERS
+ unfunction grep-flags-available
+fi
-# clean up
-unset GREP_OPTIONS
-unset VCS_FOLDERS
-unfunction grep-flag-available
+unset __GREP_CACHE_FILE __GREP_ALIAS_CACHES
diff --git a/lib/misc.zsh b/lib/misc.zsh
index 61571afc9..a5d3af998 100644
--- a/lib/misc.zsh
+++ b/lib/misc.zsh
@@ -3,15 +3,15 @@ autoload -Uz is-at-least
# *-magic is known buggy in some versions; disable if so
if [[ $DISABLE_MAGIC_FUNCTIONS != true ]]; then
for d in $fpath; do
- if [[ -e "$d/url-quote-magic" ]]; then
- if is-at-least 5.1; then
- autoload -Uz bracketed-paste-magic
- zle -N bracketed-paste bracketed-paste-magic
- fi
- autoload -Uz url-quote-magic
- zle -N self-insert url-quote-magic
- break
- fi
+ if [[ -e "$d/url-quote-magic" ]]; then
+ if is-at-least 5.1; then
+ autoload -Uz bracketed-paste-magic
+ zle -N bracketed-paste bracketed-paste-magic
+ fi
+ autoload -Uz url-quote-magic
+ zle -N self-insert url-quote-magic
+ break
+ fi
done
fi
@@ -25,7 +25,7 @@ env_default 'LESS' '-R'
alias _='sudo '
## more intelligent acking for ubuntu users
-if which ack-grep &> /dev/null; then
+if (( $+commands[ack-grep] )); then
alias afind='ack-grep -il'
else
alias afind='ack -il'
diff --git a/lib/spectrum.zsh b/lib/spectrum.zsh
index 312ab2248..d5c22a8c5 100644
--- a/lib/spectrum.zsh
+++ b/lib/spectrum.zsh
@@ -1,4 +1,3 @@
-#! /bin/zsh
# A script to make using 256 colors in zsh less painful.
# P.C. Shyamshankar <sykora@lucentbeing.com>
# Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
@@ -6,32 +5,31 @@
typeset -AHg FX FG BG
FX=(
- reset "%{%}"
- bold "%{%}" no-bold "%{%}"
- italic "%{%}" no-italic "%{%}"
- underline "%{%}" no-underline "%{%}"
- blink "%{%}" no-blink "%{%}"
- reverse "%{%}" no-reverse "%{%}"
+ reset "%{%}"
+ bold "%{%}" no-bold "%{%}"
+ italic "%{%}" no-italic "%{%}"
+ underline "%{%}" no-underline "%{%}"
+ blink "%{%}" no-blink "%{%}"
+ reverse "%{%}" no-reverse "%{%}"
)
for color in {000..255}; do
- FG[$color]="%{[38;5;${color}m%}"
- BG[$color]="%{[48;5;${color}m%}"
+ FG[$color]="%{[38;5;${color}m%}"
+ BG[$color]="%{[48;5;${color}m%}"
done
-
-ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
-
# Show all 256 colors with color number
function spectrum_ls() {
+ local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
for code in {000..255}; do
- print -P -- "$code: %{$FG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}"
+ print -P -- "$code: $FG[$code]$ZSH_SPECTRUM_TEXT%{$reset_color%}"
done
}
# Show all 256 colors where the background is set to specific color
function spectrum_bls() {
+ local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
for code in {000..255}; do
- print -P -- "$code: %{$BG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}"
+ print -P -- "$code: $BG[$code]$ZSH_SPECTRUM_TEXT%{$reset_color%}"
done
}
diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
index f5e367fcb..3f71eb06a 100644
--- a/lib/termsupport.zsh
+++ b/lib/termsupport.zsh
@@ -17,7 +17,7 @@ function title {
: ${2=$1}
case "$TERM" in
- cygwin|xterm*|putty*|rxvt*|ansi)
+ cygwin|xterm*|putty*|rxvt*|konsole*|ansi)
print -Pn "\e]2;$2:q\a" # set window name
print -Pn "\e]1;$1:q\a" # set tab name
;;
@@ -32,10 +32,10 @@ function title {
# Try to use terminfo to set the title
# If the feature is available set title
if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
- echoti tsl
- print -Pn "$1"
- echoti fsl
- fi
+ echoti tsl
+ print -Pn "$1"
+ echoti fsl
+ fi
fi
;;
esac
@@ -50,22 +50,52 @@ fi
# Runs before showing the prompt
function omz_termsupport_precmd {
- emulate -L zsh
-
- if [[ "$DISABLE_AUTO_TITLE" == true ]]; then
- return
- fi
-
+ [[ "$DISABLE_AUTO_TITLE" == true ]] && return
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
}
# Runs before executing the command
function omz_termsupport_preexec {
+ [[ "$DISABLE_AUTO_TITLE" == true ]] && return
+
emulate -L zsh
setopt extended_glob
- if [[ "$DISABLE_AUTO_TITLE" == true ]]; then
- return
+ # split command into array of arguments
+ local -a cmdargs
+ cmdargs=("${(z)2}")
+ # if running fg, extract the command from the job description
+ if [[ "${cmdargs[1]}" = fg ]]; then
+ # get the job id from the first argument passed to the fg command
+ local job_id jobspec="${cmdargs[2]#%}"
+ # logic based on jobs arguments:
+ # http://zsh.sourceforge.net/Doc/Release/Jobs-_0026-Signals.html#Jobs
+ # https://www.zsh.org/mla/users/2007/msg00704.html
+ case "$jobspec" in
+ <->) # %number argument:
+ # use the same <number> passed as an argument
+ job_id=${jobspec} ;;
+ ""|%|+) # empty, %% or %+ argument:
+ # use the current job, which appears with a + in $jobstates:
+ # suspended:+:5071=suspended (tty output)
+ job_id=${(k)jobstates[(r)*:+:*]} ;;
+ -) # %- argument:
+ # use the previous job, which appears with a - in $jobstates:
+ # suspended:-:6493=suspended (signal)
+ job_id=${(k)jobstates[(r)*:-:*]} ;;
+ [?]*) # %?string argument:
+ # use $jobtexts to match for a job whose command *contains* <string>
+ job_id=${(k)jobtexts[(r)*${(Q)jobspec}*]} ;;
+ *) # %string argument:
+ # use $jobtexts to match for a job whose command *starts with* <string>
+ job_id=${(k)jobtexts[(r)${(Q)jobspec}*]} ;;
+ esac
+
+ # override preexec function arguments with job command
+ if [[ -n "${jobtexts[$job_id]}" ]]; then
+ 1="${jobtexts[$job_id]}"
+ 2="${jobtexts[$job_id]}"
+ fi
fi
# cmd name only, or if this is sudo or ssh, the next cmd
@@ -91,12 +121,13 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
function update_terminalapp_cwd() {
emulate -L zsh
- # Percent-encode the pathname.
- local URL_PATH="$(omz_urlencode -P $PWD)"
- [[ $? != 0 ]] && return 1
+ # Percent-encode the host and path names.
+ local URL_HOST URL_PATH
+ URL_HOST="$(omz_urlencode -P $HOST)" || return 1
+ URL_PATH="$(omz_urlencode -P $PWD)" || return 1
# Undocumented Terminal.app-specific control sequence
- printf '\e]7;%s\a' "file://$HOST$URL_PATH"
+ printf '\e]7;%s\a' "file://$URL_HOST$URL_PATH"
}
# Use a precmd hook instead of a chpwd hook to avoid contaminating output
diff --git a/plugins/apache2-macports/README.md b/plugins/apache2-macports/README.md
index 099fc8da3..dbf2e89a2 100644
--- a/plugins/apache2-macports/README.md
+++ b/plugins/apache2-macports/README.md
@@ -1,19 +1,21 @@
-## APACHE2 MACPORTS PLUGIN
+# apache2-macports plugin
+Enables aliases to control a local Apache2 installed via [MacPorts](https://www.macports.org/).
----
+To use it, add `apache2-macports` to the plugins array in your zshrc file:
-### FEATURES
+```zsh
+plugins=(... apache2-macports)
+```
-| Alias | Function | Description |
-|:--------------:|:-------------------------------------------------------------------------------|----------------------:|
-| apache2restart | sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart | Restart apache daemon |
-| apache2start | sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start | Start apache daemon |
-| apache2stop | sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop | Stop apache daemon |
+## Aliases
----
+| Alias | Function | Description |
+|----------------|-----------------------------------------|-----------------------|
+| apache2restart | `sudo /path/to/apache2.wrapper restart` | Restart apache daemon |
+| apache2start | `sudo /path/to/apache2.wrapper start` | Start apache daemon |
+| apache2stop | `sudo /path/to/apache2.wrapper stop` | Stop apache daemon |
-### CONTRIBUTORS
- - Alexander Rinass (alex@rinass.net)
+## Contributors
----
+- Alexander Rinass (alex@rinass.net)
diff --git a/plugins/arcanist/README.md b/plugins/arcanist/README.md
index 9c15f09b5..f49e4344b 100644
--- a/plugins/arcanist/README.md
+++ b/plugins/arcanist/README.md
@@ -11,13 +11,14 @@ plugins=(... arcanist)
## Aliases
| Alias | Command |
-|---------|------------------------------------|
+| ------- | ---------------------------------- |
| ara | `arc amend` |
| arb | `arc branch` |
| arco | `arc cover` |
| arci | `arc commit` |
| ard | `arc diff` |
| ardc | `arc diff --create` |
+| ardp | `arc diff --preview` |
| ardnu | `arc diff --nounit` |
| ardnupc | `arc diff --nounit --plan-changes` |
| ardpc | `arc diff --plan-changes` |
@@ -27,3 +28,14 @@ plugins=(... arcanist)
| arli | `arc lint` |
| arls | `arc list` |
| arpa | `arc patch` |
+
+## Functions
+
+The following functions make copy pasting revision ids from the URL bar of your browser
+easier, as they allow for copy pasting the whole URL. For example: `ardu` accepts
+both `https://arcanist-url.com/<REVISION>` as well as `<REVISION>`.
+
+| Function | Command |
+| ------------------------- | --------------------------------- |
+| ardu [URL or revision_id] | `arc diff --update` [revision_id] |
+| arpa [URL or revision_id] | `arc patch` [revision_id] |
diff --git a/plugins/arcanist/arcanist.plugin.zsh b/plugins/arcanist/arcanist.plugin.zsh
index 8918bffdd..88e6713e4 100644
--- a/plugins/arcanist/arcanist.plugin.zsh
+++ b/plugins/arcanist/arcanist.plugin.zsh
@@ -13,10 +13,25 @@ alias ardc='arc diff --create'
alias ardnu='arc diff --nounit'
alias ardnupc='arc diff --nounit --plan-changes'
alias ardpc='arc diff --plan-changes'
+alias ardp='arc diff --preview' # creates a new diff in the phab interface
alias are='arc export'
alias arh='arc help'
alias arl='arc land'
alias arli='arc lint'
alias arls='arc list'
-alias arpa='arc patch'
+
+#
+# Functions
+# (sorted alphabetically)
+#
+
+ardu() {
+ # Both `ardu https://arcanist-url.com/<REVISION>`, and `ardu <REVISION>` work.
+ arc diff --update "${1:t}"
+}
+
+arpa() {
+ # Both `arpa https://arcanist-url.com/<REVISION>`, and `arpa <REVISION>` work.
+ arc patch "${1:t}"
+}
diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md
index ff2b6a4c4..5882c7603 100644
--- a/plugins/archlinux/README.md
+++ b/plugins/archlinux/README.md
@@ -1,5 +1,13 @@
# Archlinux plugin
+This plugin adds some aliases and functions to work with Arch Linux.
+
+To use it, add `archlinux` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... archlinux)
+```
+
## Features
#### YAY
@@ -119,7 +127,7 @@
| pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages |
| upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages |
| pacfileupg | sudo pacman -Fy | Download fresh package databases from the server |
-| pacfiles | pacman -Fs | Search package file names for matching strings |
+| pacfiles | pacman -F | Search package file names for matching strings |
| pacls | pacman -Ql | List files in a package |
| pacown | pacman -Qo | Show which package owns a file |
diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh
index e0101c7eb..6ccef85c5 100644
--- a/plugins/archlinux/archlinux.plugin.zsh
+++ b/plugins/archlinux/archlinux.plugin.zsh
@@ -149,7 +149,7 @@ alias pacmir='sudo pacman -Syy'
alias paclsorphans='sudo pacman -Qdt'
alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
alias pacfileupg='sudo pacman -Fy'
-alias pacfiles='pacman -Fs'
+alias pacfiles='pacman -F'
alias pacls='pacman -Ql'
alias pacown='pacman -Qo'
diff --git a/plugins/autoenv/README.md b/plugins/autoenv/README.md
index de3881774..5dfb5fbe8 100644
--- a/plugins/autoenv/README.md
+++ b/plugins/autoenv/README.md
@@ -7,8 +7,14 @@ To use it, add `autoenv` to the plugins array in your zshrc file:
```zsh
plugins=(... autoenv)
```
+
+## Functions
+
+* `use_env()`: creates and/or activates a virtualenv. For use in `.env` files.
+ See the source code for details.
+
## Requirements
In order to make this work, you will need to have the autoenv installed.
-More info on the usage and install: https://github.com/inishchith/autoenv
+More info on the usage and install at [the project's homepage](https://github.com/inishchith/autoenv).
diff --git a/plugins/autoenv/autoenv.plugin.zsh b/plugins/autoenv/autoenv.plugin.zsh
index 3c1b0fafc..bd03cf4b2 100644
--- a/plugins/autoenv/autoenv.plugin.zsh
+++ b/plugins/autoenv/autoenv.plugin.zsh
@@ -1,12 +1,39 @@
-# Activates autoenv or reports its failure
+# Initialization: activate autoenv or report its absence
() {
+local d autoenv_dir install_locations
if ! type autoenv_init >/dev/null; then
- for d (~/.autoenv ~/.local/bin /usr/local/opt/autoenv /usr/local/bin); do
+ # Check if activate.sh is in $PATH
+ if (( $+commands[activate.sh] )); then
+ autoenv_dir="${commands[activate.sh]:h}"
+ fi
+
+ # Locate autoenv installation
+ if [[ -z $autoenv_dir ]]; then
+ install_locations=(
+ ~/.autoenv
+ ~/.local/bin
+ /usr/local/opt/autoenv
+ /usr/local/bin
+ /usr/share/autoenv-git
+ ~/Library/Python/bin
+ )
+ for d ( $install_locations ); do
+ if [[ -e $d/activate.sh ]]; then
+ autoenv_dir=$d
+ break
+ fi
+ done
+ fi
+
+ # Look for Homebrew path as a last resort
+ if [[ -z "$autoenv_dir" ]] && (( $+commands[brew] )); then
+ d=$(brew --prefix)/opt/autoenv
if [[ -e $d/activate.sh ]]; then
autoenv_dir=$d
- break
fi
- done
+ fi
+
+ # Complain if autoenv is not installed
if [[ -z $autoenv_dir ]]; then
cat <<END >&2
-------- AUTOENV ---------
@@ -17,6 +44,7 @@ In the meantime the autoenv plugin is DISABLED.
END
return 1
fi
+ # Load autoenv
source $autoenv_dir/activate.sh
fi
}
@@ -27,17 +55,17 @@ fi
# It only performs an action if the requested virtualenv is not the current one.
use_env() {
- typeset venv
- venv="$1"
- if [[ "${VIRTUAL_ENV:t}" != "$venv" ]]; then
- if workon | grep -q "$venv"; then
- workon "$venv"
- else
- echo -n "Create virtualenv $venv now? (Yn) "
- read answer
- if [[ "$answer" == "Y" ]]; then
- mkvirtualenv "$venv"
- fi
- fi
+ local venv
+ venv="$1"
+ if [[ "${VIRTUAL_ENV:t}" != "$venv" ]]; then
+ if workon | grep -q "$venv"; then
+ workon "$venv"
+ else
+ echo -n "Create virtualenv $venv now? (Yn) "
+ read answer
+ if [[ "$answer" == "Y" ]]; then
+ mkvirtualenv "$venv"
+ fi
fi
+ fi
}
diff --git a/plugins/autojump/README.md b/plugins/autojump/README.md
index 18ff793cd..750ff56d1 100644
--- a/plugins/autojump/README.md
+++ b/plugins/autojump/README.md
@@ -8,4 +8,4 @@ To use it, add `autojump` to the plugins array in your zshrc file:
plugins=(... autojump)
```
-More info on the usage: https://github.com/wting/autojump
+**Note:** you have to [install autojump](https://github.com/wting/autojump#installation) first.
diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh
index d80c88822..f40b0e931 100644
--- a/plugins/autojump/autojump.plugin.zsh
+++ b/plugins/autojump/autojump.plugin.zsh
@@ -29,6 +29,6 @@ if (( ! found && $+commands[brew] )); then
fi
fi
-(( ! found )) && echo '[oh-my-zsh] autojump script not found'
+(( ! found )) && echo '[oh-my-zsh] autojump not found. Please install it first.'
unset autojump_paths file found
diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
index 567311372..6fa8362ca 100644
--- a/plugins/aws/aws.plugin.zsh
+++ b/plugins/aws/aws.plugin.zsh
@@ -62,36 +62,45 @@ fi
# Load awscli completions
-function _awscli-homebrew-installed() {
- # check if Homebrew is installed
- (( $+commands[brew] )) || return 1
-
- # speculatively check default brew prefix
- if [ -h /usr/local/opt/awscli ]; then
- _brew_prefix=/usr/local/opt/awscli
- else
- # ok, it is not in the default prefix
- # this call to brew is expensive (about 400 ms), so at least let's make it only once
- _brew_prefix=$(brew --prefix awscli)
+# AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back
+if [[ -x /usr/local/bin/aws_completer ]]; then
+ autoload -Uz bashcompinit && bashcompinit
+ complete -C aws_completer aws
+else
+ function _awscli-homebrew-installed() {
+ # check if Homebrew is installed
+ (( $+commands[brew] )) || return 1
+
+ # speculatively check default brew prefix
+ if [ -h /usr/local/opt/awscli ]; then
+ _brew_prefix=/usr/local/opt/awscli
+ else
+ # ok, it is not in the default prefix
+ # this call to brew is expensive (about 400 ms), so at least let's make it only once
+ _brew_prefix=$(brew --prefix awscli)
+ fi
+ }
+
+ # get aws_zsh_completer.sh location from $PATH
+ _aws_zsh_completer_path="$commands[aws_zsh_completer.sh]"
+
+ # otherwise check common locations
+ if [[ -z $_aws_zsh_completer_path ]]; then
+ # Homebrew
+ if _awscli-homebrew-installed; then
+ _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh
+ # Ubuntu
+ elif [[ -e /usr/share/zsh/vendor-completions/_awscli ]]; then
+ _aws_zsh_completer_path=/usr/share/zsh/vendor-completions/_awscli
+ # NixOS
+ elif [[ -e "${commands[aws]:P:h:h}/share/zsh/site-functions/aws_zsh_completer.sh" ]]; then
+ _aws_zsh_completer_path="${commands[aws]:P:h:h}/share/zsh/site-functions/aws_zsh_completer.sh"
+ # RPM
+ else
+ _aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh
+ fi
fi
-}
-# get aws_zsh_completer.sh location from $PATH
-_aws_zsh_completer_path="$commands[aws_zsh_completer.sh]"
-
-# otherwise check common locations
-if [[ -z $_aws_zsh_completer_path ]]; then
- # Homebrew
- if _awscli-homebrew-installed; then
- _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh
- # Ubuntu
- elif [[ -e /usr/share/zsh/vendor-completions/_awscli ]]; then
- _aws_zsh_completer_path=/usr/share/zsh/vendor-completions/_awscli
- # RPM
- else
- _aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh
- fi
+ [[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path
+ unset _aws_zsh_completer_path _brew_prefix
fi
-
-[[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path
-unset _aws_zsh_completer_path _brew_prefix
diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh
index 4c4d0d4fc..755ec8d64 100644
--- a/plugins/battery/battery.plugin.zsh
+++ b/plugins/battery/battery.plugin.zsh
@@ -118,7 +118,7 @@ elif [[ "$OSTYPE" = linux* ]]; then
function battery_pct() {
if (( $+commands[acpi] )); then
- acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -E '^Battery.*(Disc|C)harging' | cut -f2 -d ',' | tr -cd '[:digit:]'
+ acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -E '^Battery.*(Full|(Disc|C)harging)' | cut -f2 -d ',' | tr -cd '[:digit:]'
fi
}
@@ -201,11 +201,11 @@ function battery_level_gauge() {
battery_is_charging && charging=$charging_symbol
# Charging status and prefix
- printf ${charging_color//\%/\%\%}$charging${color_reset//\%/\%\%}${battery_prefix//\%/\%\%}${gauge_color//\%/\%\%}
+ print -n ${charging_color}${charging}${color_reset}${battery_prefix}${gauge_color}
# Filled slots
[[ $filled -gt 0 ]] && printf ${filled_symbol//\%/\%\%}'%.0s' {1..$filled}
# Empty slots
[[ $filled -lt $gauge_slots ]] && printf ${empty_symbol//\%/\%\%}'%.0s' {1..$empty}
# Suffix
- printf ${color_reset//\%/\%\%}${battery_suffix//\%/\%\%}${color_reset//\%/\%\%}
+ print -n ${color_reset}${battery_suffix}${color_reset}
}
diff --git a/plugins/bower/README.md b/plugins/bower/README.md
index 743b6a0ea..8877fbdc5 100644
--- a/plugins/bower/README.md
+++ b/plugins/bower/README.md
@@ -4,7 +4,7 @@ This plugin adds completion for [Bower](https://bower.io/) and a few useful alia
To use it, add `bower` to the plugins array in your zshrc file:
-```
+```zsh
plugins=(... bower)
```
@@ -15,4 +15,3 @@ plugins=(... bower)
| bi | `bower install` | Installs the project dependencies listed in bower.json |
| bl | `bower list` | List local packages and possible updates |
| bs | `bower search` | Finds all packages or a specific package. |
-
diff --git a/plugins/cake/README.md b/plugins/cake/README.md
index aad92a3ec..2c2a28053 100644
--- a/plugins/cake/README.md
+++ b/plugins/cake/README.md
@@ -10,6 +10,6 @@ plugins=(... cake)
## Note
-This plugin generates a cache file of the cake tasks found, named `.cake_task_cache`, in the current working directory.
+This plugin generates a cache file of the cake tasks found, named `.cake_task_cache`, in the current working directory.
It is regenerated when the Cakefile is newer than the cache file. It is advised that you add the cake file to your
`.gitignore` files.
diff --git a/plugins/catimg/README.md b/plugins/catimg/README.md
index 42b59a62c..8f2688050 100644
--- a/plugins/catimg/README.md
+++ b/plugins/catimg/README.md
@@ -2,27 +2,15 @@
Plugin for displaying images on the terminal using the the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
-## Requirements
-
-- `convert` (ImageMagick)
-
-## Enabling the plugin
+To use it, add `catimg` to the plugins array in your zshrc file:
-1. Open your `.zshrc` file and add `catimg` in the plugins section:
+```zsh
+plugins=(... catimg)
+```
- ```zsh
- plugins=(
- # all your enabled plugins
- catimg
- )
- ```
-
-2. Restart the shell or restart your Terminal session:
+## Requirements
- ```console
- $ exec zsh
- $
- ```
+- `convert` (ImageMagick)
## Functions
diff --git a/plugins/chucknorris/README.md b/plugins/chucknorris/README.md
index be7b97e24..35f989180 100644
--- a/plugins/chucknorris/README.md
+++ b/plugins/chucknorris/README.md
@@ -1,6 +1,6 @@
# chucknorris
-Chuck Norris fortunes plugin for oh-my-zsh
+Chuck Norris fortunes plugin for oh-my-zsh. Perfectly suitable as MOTD.
**Maintainers**: [apjanke](https://github.com/apjanke) [maff](https://github.com/maff)
@@ -10,11 +10,31 @@ To use it add `chucknorris` to the plugins array in you zshrc file.
plugins=(... chucknorris)
```
-
-Depends on fortune (and cowsay if using chuck_cow) being installed (available via homebrew, apt, ...). Perfectly suitable as MOTD.
-
+## Usage
| Command | Description |
| ----------- | ------------------------------- |
| `chuck` | Print random Chuck Norris quote |
| `chuck_cow` | Print quote in cowthink |
+
+Example: output of `chuck_cow`:
+
+```
+Last login: Fri Jan 30 23:12:26 on ttys001
+ ______________________________________
+( When Chuck Norris plays Monopoly, it )
+( affects the actual world economy. )
+ --------------------------------------
+ o ^__^
+ o (oo)\_______
+ (__)\ )\/\
+ ||----w |
+ || ||
+```
+
+## Requirements
+
+- `fortune`
+- `cowsay` if using `chuck_cow`
+
+Available via homebrew, apt, ...
diff --git a/plugins/cloudapp/README.md b/plugins/cloudapp/README.md
index 6c7f9bc6c..fc9fc32bd 100644
--- a/plugins/cloudapp/README.md
+++ b/plugins/cloudapp/README.md
@@ -4,7 +4,7 @@
To use it, add `cloudapp` to the plugins array of your `~/.zshrc` file:
-```
+```zsh
plugins=(... cloudapp)
```
diff --git a/plugins/coffee/README.md b/plugins/coffee/README.md
index d6cd074d3..2baade844 100644
--- a/plugins/coffee/README.md
+++ b/plugins/coffee/README.md
@@ -1,4 +1,4 @@
-## Coffeescript Plugin
+# Coffeescript Plugin
This plugin provides aliases for quickly compiling and previewing your
coffeescript code.
diff --git a/plugins/colored-man-pages/README.md b/plugins/colored-man-pages/README.md
index d9f6acb2a..f34941e73 100644
--- a/plugins/colored-man-pages/README.md
+++ b/plugins/colored-man-pages/README.md
@@ -8,6 +8,9 @@ To use it, add `colored-man-pages` to the plugins array in your zshrc file:
plugins=(... colored-man-pages)
```
+It will also automatically colorize man pages displayed by `dman` or `debman`,
+from [`debian-goodies`](https://packages.debian.org/stable/debian-goodies).
+
You can also try to color other pages by prefixing the respective command with `colored`:
```zsh
diff --git a/plugins/colored-man-pages/colored-man-pages.plugin.zsh b/plugins/colored-man-pages/colored-man-pages.plugin.zsh
index f74105d40..ec518472c 100644
--- a/plugins/colored-man-pages/colored-man-pages.plugin.zsh
+++ b/plugins/colored-man-pages/colored-man-pages.plugin.zsh
@@ -31,6 +31,9 @@ function colored() {
"$@"
}
-function man() {
- colored man "$@"
+# Colorize man and dman/debman (from debian-goodies)
+function man \
+ dman \
+ debman {
+ colored $0 "$@"
}
diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh
index dd1186e44..81d76e638 100644
--- a/plugins/command-not-found/command-not-found.plugin.zsh
+++ b/plugins/command-not-found/command-not-found.plugin.zsh
@@ -26,10 +26,8 @@ fi
# OSX command-not-found support
# https://github.com/Homebrew/homebrew-command-not-found
-if type brew &> /dev/null; then
- if brew command command-not-found-init > /dev/null 2>&1; then
- eval "$(brew command-not-found-init)";
- fi
+if [[ -s '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh' ]]; then
+ source '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh'
fi
# NixOS command-not-found support
diff --git a/plugins/compleat/README.md b/plugins/compleat/README.md
index 630c91503..af0e383be 100644
--- a/plugins/compleat/README.md
+++ b/plugins/compleat/README.md
@@ -3,6 +3,7 @@
This plugin looks for [compleat](https://github.com/mbrubeck/compleat) and loads its completion.
To use it, add compleat to the plugins array in your zshrc file:
-```
+
+```zsh
plugins=(... compleat)
```
diff --git a/plugins/composer/README.md b/plugins/composer/README.md
index 2b4bae579..85eef3cc7 100644
--- a/plugins/composer/README.md
+++ b/plugins/composer/README.md
@@ -12,18 +12,18 @@ plugins=(... composer)
## Aliases
-| Alias | Command | Description |
-| ------ | -------------------------------------------- | -------------------------------------------------------------------------------------- |
-| `c` | composer | Starts composer |
-| `csu` | composer self-update | Updates composer to the latest version |
-| `cu` | composer update | Updates composer dependencies and `composer.lock` file |
-| `cr` | composer require | Adds new packages to `composer.json` |
-| `crm` | composer remove | Removes packages from `composer.json` |
-| `ci` | composer install | Resolves and installs dependencies from `composer.json` |
-| `ccp` | composer create-project | Create new project from an existing package |
-| `cdu` | composer dump-autoload | Updates the autoloader |
-| `cdo` | composer dump-autoload --optimize-autoloader | Converts PSR-0/4 autoloading to classmap for a faster autoloader (good for production) |
-| `cgu` | composer global update | Allows update command to run on COMPOSER_HOME directory |
-| `cgr` | composer global require | Allows require command to run on COMPOSER_HOME directory |
-| `cgrm` | composer global remove | Allows remove command to run on COMPOSER_HOME directory |
-| `cget` | `curl -s https://getcomposer.org/installer` | Installs composer in the current directory |
+| Alias | Command | Description |
+| ------ | ---------------------------------------------- | -------------------------------------------------------------------------------------- |
+| `c` | `composer` | Starts composer |
+| `csu` | `composer self-update` | Updates composer to the latest version |
+| `cu` | `composer update` | Updates composer dependencies and `composer.lock` file |
+| `cr` | `composer require` | Adds new packages to `composer.json` |
+| `crm` | `composer remove` | Removes packages from `composer.json` |
+| `ci` | `composer install` | Resolves and installs dependencies from `composer.json` |
+| `ccp` | `composer create-project` | Create new project from an existing package |
+| `cdu` | `composer dump-autoload` | Updates the autoloader |
+| `cdo` | `composer dump-autoload --optimize-autoloader` | Converts PSR-0/4 autoloading to classmap for a faster autoloader (good for production) |
+| `cgu` | `composer global update` | Allows update command to run on COMPOSER_HOME directory |
+| `cgr` | `composer global require` | Allows require command to run on COMPOSER_HOME directory |
+| `cgrm` | `composer global remove` | Allows remove command to run on COMPOSER_HOME directory |
+| `cget` | `curl -s https://getcomposer.org/installer` | Installs composer in the current directory |
diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh
index 634961023..2c6044aef 100644
--- a/plugins/composer/composer.plugin.zsh
+++ b/plugins/composer/composer.plugin.zsh
@@ -15,20 +15,16 @@ _composer_get_required_list () {
}
_composer () {
- local curcontext="$curcontext" state line
- typeset -A opt_args
- _arguments \
- '1: :->command'\
- '*: :->args'
-
- case $state in
- command)
- compadd $(_composer_get_command_list)
- ;;
- *)
- compadd $(_composer_get_required_list)
- ;;
- esac
+ local curcontext="$curcontext" state line
+ typeset -A opt_args
+ _arguments \
+ '*:: :->subcmds'
+
+ if (( CURRENT == 1 )) || ( ((CURRENT == 2)) && [ "$words[1]" = "global" ] ) ; then
+ compadd $(_composer_get_command_list)
+ else
+ compadd $(_composer_get_required_list)
+ fi
}
compdef _composer composer
@@ -43,7 +39,7 @@ alias crm='composer remove'
alias ci='composer install'
alias ccp='composer create-project'
alias cdu='composer dump-autoload'
-alias cdo='composer dump-autoload --optimize-autoloader'
+alias cdo='composer dump-autoload -o'
alias cgu='composer global update'
alias cgr='composer global require'
alias cgrm='composer global remove'
diff --git a/plugins/copyfile/README.md b/plugins/copyfile/README.md
index 53138ad06..a110b83fe 100644
--- a/plugins/copyfile/README.md
+++ b/plugins/copyfile/README.md
@@ -3,7 +3,8 @@
Puts the contents of a file in your system clipboard so you can paste it anywhere.
To use, add `copyfile` to your plugins array:
-```
+
+```zsh
plugins=(... copyfile)
```
diff --git a/plugins/cpanm/README.md b/plugins/cpanm/README.md
index 3803e3e00..13e93d0a5 100644
--- a/plugins/cpanm/README.md
+++ b/plugins/cpanm/README.md
@@ -1,9 +1,9 @@
# Cpanm
This plugin provides completion for [Cpanm](https://github.com/miyagawa/cpanminus) ([docs](https://metacpan.org/pod/App::cpanminus)).
-
+
To use it add cpanm to the plugins array in your zshrc file.
-
- ```bash
+
+```zsh
plugins=(... cpanm)
```
diff --git a/plugins/direnv/README.md b/plugins/direnv/README.md
new file mode 100644
index 000000000..8deaf38bb
--- /dev/null
+++ b/plugins/direnv/README.md
@@ -0,0 +1,15 @@
+# direnv plugin
+
+This plugin creates the [Direnv](https://direnv.net/) hook.
+
+To use it, add `direnv` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... direnv)
+```
+
+## Requirements
+
+In order to make this work, you will need to have the direnv installed.
+
+More info on the usage and install: https://github.com/direnv/direnv
diff --git a/plugins/direnv/direnv.plugin.zsh b/plugins/direnv/direnv.plugin.zsh
new file mode 100644
index 000000000..d36c4ae5e
--- /dev/null
+++ b/plugins/direnv/direnv.plugin.zsh
@@ -0,0 +1,13 @@
+_direnv_hook() {
+ trap -- '' SIGINT;
+ eval "$(direnv export zsh)";
+ trap - SIGINT;
+}
+typeset -ag precmd_functions;
+if [[ -z ${precmd_functions[(r)_direnv_hook]} ]]; then
+ precmd_functions=( _direnv_hook ${precmd_functions[@]} )
+fi
+typeset -ag chpwd_functions;
+if [[ -z ${chpwd_functions[(r)_direnv_hook]} ]]; then
+ chpwd_functions=( _direnv_hook ${chpwd_functions[@]} )
+fi
diff --git a/plugins/dirhistory/README.md b/plugins/dirhistory/README.md
index 511f2be17..223650727 100644
--- a/plugins/dirhistory/README.md
+++ b/plugins/dirhistory/README.md
@@ -7,6 +7,7 @@ To use it, add `dirhistory` to the plugins array in your zshrc file:
```zsh
plugins=(... dirhistory)
```
+
## Keyboard Shortcuts
| Shortcut | Description |
@@ -15,3 +16,24 @@ plugins=(... dirhistory)
| <kbd>alt</kbd> + <kbd>right</kbd> | Undo <kbd>alt</kbd> + <kbd>left</kbd> |
| <kbd>alt</kbd> + <kbd>up</kbd> | Move into the parent directory |
| <kbd>alt</kbd> + <kbd>down</kbd> | Move into the first child directory by alphabetical order |
+
+## Usage
+
+This plugin allows you to navigate the history of previous current-working-directories using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT. MAC users may alternately use OPT-LEFT and OPT-RIGHT.
+
+Also, navigate directory **hierarchy** using ALT-UP and ALT-DOWN. (mac keybindings not yet implemented). ALT-UP moves to higher hierarchy (shortcut for 'cd ..'). ALT-DOWN moves into the first directory found in alphabetical order (useful to navigate long empty directories e.g. java packages)
+
+For example, if the shell was started, and the following commands were entered:
+
+```shell
+cd ~
+cd /usr
+cd share
+cd doc
+```
+
+Then entering ALT-LEFT at the prompt would change directory from /usr/share/doc to /usr/share, then if pressed again to /usr/, then ~. If ALT-RIGHT were pressed the directory would be changed to /usr/ again.
+
+After that, ALT-DOWN will probably go to /usr/bin (depends on your /usr structure), ALT-UP will return to /usr, then ALT-UP will get you to /
+
+**Currently the max history size is 30**. The navigation should work for xterm, PuTTY xterm mode, GNU screen, and on MAC with alternate keys as mentioned above.
diff --git a/plugins/dirpersist/README.md b/plugins/dirpersist/README.md
index 9880bc563..792fb4bfe 100644
--- a/plugins/dirpersist/README.md
+++ b/plugins/dirpersist/README.md
@@ -1,6 +1,7 @@
# Dirpersist plugin
-This plugin keeps a running tally of the previous 20 unique directories in the $HOME/.zdirs file. When you cd to a new directory, it is prepended to the beginning of the file.
+This plugin keeps a running tally of the previous 20 unique directories in the `$HOME/.zdirs` file.
+When you cd to a new directory, it is prepended to the beginning of the file.
To use it, add `dirpersist` to the plugins array in your zshrc file:
diff --git a/plugins/django/README.md b/plugins/django/README.md
index 415f6b7ea..1740e55e5 100644
--- a/plugins/django/README.md
+++ b/plugins/django/README.md
@@ -34,23 +34,3 @@ runfcgi -- run this project as a fastcgi
runserver -- start a lightweight web server for development
...
```
-
-If you want to see the options available for a specific command, try:
-
-```zsh
-$> python manage.py makemessages (press <TAB> here)
-```
-
-And that would result in:
-
-```zsh
---all -a -- re-examine all code and templates
---domain -d -- domain of the message files (default: "django")
---extensions -e -- file extension(s) to examine (default: ".html")
---help -- display help information
---locale -l -- locale to process (default: all)
---pythonpath -- directory to add to the Python path
---settings -- python path to settings module
-...
-```
-
diff --git a/plugins/dnf/README.md b/plugins/dnf/README.md
index f9ef496fa..dc0d1e0a0 100644
--- a/plugins/dnf/README.md
+++ b/plugins/dnf/README.md
@@ -1,10 +1,14 @@
-## Description
+# dnf plugin
-This plugin makes `dnf` usage easier by adding aliases for the most
-common commands.
+This plugin makes `dnf` usage easier by adding aliases for the most common commands.
-`dnf` is the new package manager for RPM-based distributions, which
-replaces `yum`.
+`dnf` is the new package manager for RPM-based distributions, which replaces `yum`.
+
+To use it, add `dnf` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... dnf)
+```
## Aliases
diff --git a/plugins/docker-compose/README.md b/plugins/docker-compose/README.md
index 07a87bc81..1105e03f6 100644
--- a/plugins/docker-compose/README.md
+++ b/plugins/docker-compose/README.md
@@ -4,7 +4,8 @@ This plugin provides completion for [docker-compose](https://docs.docker.com/com
aliases for frequent docker-compose commands.
To use it, add docker-compose to the plugins array of your zshrc file:
-```
+
+```zsh
plugins=(... docker-compose)
```
diff --git a/plugins/docker/README.md b/plugins/docker/README.md
index 4d9f3ae9b..241a6a448 100644
--- a/plugins/docker/README.md
+++ b/plugins/docker/README.md
@@ -3,6 +3,7 @@
This plugin adds auto-completion for [docker](https://www.docker.com/).
To use it add `docker` to the plugins array in your zshrc file.
+
```zsh
plugins=(... docker)
```
diff --git a/plugins/dotenv/README.md b/plugins/dotenv/README.md
index dbc02bf61..f66124731 100644
--- a/plugins/dotenv/README.md
+++ b/plugins/dotenv/README.md
@@ -4,9 +4,7 @@ Automatically load your project ENV variables from `.env` file when you `cd` int
Storing configuration in the environment is one of the tenets of a [twelve-factor app](https://www.12factor.net). Anything that is likely to change between deployment environments, such as resource handles for databases or credentials for external services, should be extracted from the code into environment variables.
-## Installation
-
-Just add the plugin to your `.zshrc`:
+To use it, add `dotenv` to the plugins array in your zshrc file:
```sh
plugins=(... dotenv)
@@ -17,22 +15,26 @@ plugins=(... dotenv)
Create `.env` file inside your project root directory and put your ENV variables there.
For example:
+
```sh
export AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a
export SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f
export MONGO_URI=mongodb://127.0.0.1:27017
export PORT=3001
```
+
`export` is optional. This format works as well:
+
```sh
AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a
SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f
MONGO_URI=mongodb://127.0.0.1:27017
PORT=3001
```
+
You can even mix both formats, although it's probably a bad idea.
-## Plugin options
+## Settings
### ZSH_DOTENV_FILE
@@ -40,7 +42,7 @@ You can also modify the name of the file to be loaded with the variable `ZSH_DOT
If the variable isn't set, the plugin will default to use `.env`.
For example, this will make the plugin look for files named `.dotenv` and load them:
-```
+```zsh
# in ~/.zshrc, before Oh My Zsh is sourced:
ZSH_DOTENV_FILE=.dotenv
```
@@ -48,6 +50,27 @@ ZSH_DOTENV_FILE=.dotenv
### ZSH_DOTENV_PROMPT
Set `ZSH_DOTENV_PROMPT=false` in your zshrc file if you don't want the confirmation message.
+You can also choose the `Always` option when prompted to always allow sourcing the .env file
+in that directory. See the next section for more details.
+
+### ZSH_DOTENV_ALLOWED_LIST
+
+The default behavior of the plugin is to always ask whether to source a dotenv file. There's
+a **Y**es, **N**o, and **A**lways option. If you choose Always, the directory of the .env file
+will be added to an allowed list. If a directory is found in this list, the plugin won't ask
+for confirmation and will instead source the .env file directly.
+
+This allowed list is saved by default in `$ZSH_CACHE_DIR/dotenv-allowed.list`. If you want
+to change that location, change the `$ZSH_DOTENV_ALLOWED_LIST` variable, like so:
+
+```zsh
+# in ~/.zshrc, before Oh My Zsh is sourced:
+ZSH_DOTENV_ALLOWED_LIST=/path/to/dotenv/allowed/list
+```
+
+This file is just a list of directories allowed, separated by a newline character. If you want
+to disallow a directory, just edit this file and remove the line for the directory you want to
+disallow.
## Version Control
@@ -58,5 +81,6 @@ Set `ZSH_DOTENV_PROMPT=false` in your zshrc file if you don't want the confirmat
This plugin only sources the `.env` file. Nothing less, nothing more. It doesn't do any checks. It's designed to be the fastest and simplest option. You're responsible for the `.env` file content. You can put some code (or weird symbols) there, but do it on your own risk. `dotenv` is the basic tool, yet it does the job.
If you need more advanced and feature-rich ENV management, check out these awesome projects:
+
* [direnv](https://github.com/direnv/direnv)
* [zsh-autoenv](https://github.com/Tarrasch/zsh-autoenv)
diff --git a/plugins/dotenv/dotenv.plugin.zsh b/plugins/dotenv/dotenv.plugin.zsh
index 54036bee3..ac3210d7f 100644
--- a/plugins/dotenv/dotenv.plugin.zsh
+++ b/plugins/dotenv/dotenv.plugin.zsh
@@ -1,35 +1,46 @@
+## Settings
+
+# Filename of the dotenv file to look for
+: ${ZSH_DOTENV_FILE:=.env}
+
+# Path to the file containing allowed paths
+: ${ZSH_DOTENV_ALLOWED_LIST:="${ZSH_CACHE_DIR:-$ZSH/cache}/dotenv-allowed.list"}
+
+
+## Functions
+
source_env() {
if [[ -f $ZSH_DOTENV_FILE ]]; then
- if [ "$ZSH_DOTENV_PROMPT" != "false" ]; then
- # confirm before sourcing file
- local confirmation
- # print same-line prompt and output newline character if necessary
- echo -n "dotenv: source '$ZSH_DOTENV_FILE' file in the directory? (Y/n) "
- read -k 1 confirmation; [[ "$confirmation" != $'\n' ]] && echo
- # only bail out if confirmation character is n
- if [[ "$confirmation" = [nN] ]]; then
- return
+ if [[ "$ZSH_DOTENV_PROMPT" != false ]]; then
+ local confirmation dirpath="${PWD:A}"
+
+ # make sure there is an allowed file
+ touch "$ZSH_DOTENV_ALLOWED_LIST"
+
+ # check if current directory's .env file is allowed or ask for confirmation
+ if ! grep -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then
+ # print same-line prompt and output newline character if necessary
+ echo -n "dotenv: found '$ZSH_DOTENV_FILE' file. Source it? ([Y]es/[n]o/[a]lways) "
+ read -k 1 confirmation; [[ "$confirmation" != $'\n' ]] && echo
+
+ # check input
+ case "$confirmation" in
+ [nN]) return ;;
+ [aA]) echo "$dirpath" >> "$ZSH_DOTENV_ALLOWED_LIST" ;;
+ *) ;; # interpret anything else as a yes
+ esac
fi
fi
# test .env syntax
zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2
- if [[ -o a ]]; then
- source $ZSH_DOTENV_FILE
- else
- set -a
- source $ZSH_DOTENV_FILE
- set +a
- fi
+ setopt localoptions allexport
+ source $ZSH_DOTENV_FILE
fi
}
autoload -U add-zsh-hook
add-zsh-hook chpwd source_env
-if [[ -z $ZSH_DOTENV_FILE ]]; then
- ZSH_DOTENV_FILE=.env
-fi
-
source_env
diff --git a/plugins/encode64/README.md b/plugins/encode64/README.md
index 66fc7cba4..a83a3d3d2 100644
--- a/plugins/encode64/README.md
+++ b/plugins/encode64/README.md
@@ -1,6 +1,12 @@
# encode64
-Alias plugin for encoding or decoding using `base64` command
+Alias plugin for encoding or decoding using `base64` command.
+
+To use it, add `encode64` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... encode64)
+```
## Functions and Aliases
@@ -9,23 +15,6 @@ Alias plugin for encoding or decoding using `base64` command
| `encode64` | `e64` | Encodes given data to base64 |
| `decode64` | `d64` | Decodes given data from base64 |
-## Enabling plugin
-
-1. Edit your `.zshrc` file and add `encode64` to the list of plugins:
-
- ```sh
- plugins=(
- # ...other enabled plugins
- encode64
- )
- ```
-
-2. Restart your terminal session or restart the shell:
-
- ```sh
- exec zsh
- ```
-
## Usage and examples
### Encoding
diff --git a/plugins/fabric/README.md b/plugins/fabric/README.md
index cf0fa81f4..f121d2ed8 100644
--- a/plugins/fabric/README.md
+++ b/plugins/fabric/README.md
@@ -4,6 +4,6 @@ This plugin provides completion for [Fabric](https://www.fabfile.org/).
To use it add fabric to the plugins array in your zshrc file.
-```bash
+```zsh
plugins=(... fabric)
```
diff --git a/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh b/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh
index 8ab297913..82b968894 100644
--- a/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh
+++ b/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh
@@ -1,10 +1,10 @@
fancy-ctrl-z () {
if [[ $#BUFFER -eq 0 ]]; then
BUFFER="fg"
- zle accept-line
+ zle accept-line -w
else
- zle push-input
- zle clear-screen
+ zle push-input -w
+ zle clear-screen -w
fi
}
zle -N fancy-ctrl-z
diff --git a/plugins/fasd/fasd.plugin.zsh b/plugins/fasd/fasd.plugin.zsh
index ec2e5183a..6538d097e 100644
--- a/plugins/fasd/fasd.plugin.zsh
+++ b/plugins/fasd/fasd.plugin.zsh
@@ -1,12 +1,16 @@
-if [ $commands[fasd] ]; then # check if fasd is installed
- fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache"
- if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
- fasd --init auto >| "$fasd_cache"
- fi
- source "$fasd_cache"
- unset fasd_cache
+# check if fasd is installed
+if (( ! ${+commands[fasd]} )); then
+ return
+fi
- alias v='f -e "$EDITOR"'
- alias o='a -e xdg-open'
- alias j='zz'
+fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache"
+if [[ "$commands[fasd]" -nt "$fasd_cache" || ! -s "$fasd_cache" ]]; then
+ fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install \
+ zsh-wcomp zsh-wcomp-install >| "$fasd_cache"
fi
+source "$fasd_cache"
+unset fasd_cache
+
+alias v='f -e "$EDITOR"'
+alias o='a -e xdg-open'
+alias j='zz'
diff --git a/plugins/fbterm/README.md b/plugins/fbterm/README.md
index eec33d7ee..70ce56da8 100644
--- a/plugins/fbterm/README.md
+++ b/plugins/fbterm/README.md
@@ -3,7 +3,8 @@
This plugin automatically starts [fbterm](https://github.com/zhangyuanwei/fbterm)
if on a real TTY (`/dev/tty*`).
-To use it, add fbterm to the plugins array of your zshrc file:
-```
+To use it, add `fbterm` to the plugins array of your zshrc file:
+
+```zsh
plugins=(... fbterm)
```
diff --git a/plugins/forklift/README.md b/plugins/forklift/README.md
index 6c4ce1e81..7dfd8bf95 100644
--- a/plugins/forklift/README.md
+++ b/plugins/forklift/README.md
@@ -1,15 +1,23 @@
-## forklift
+# forklift
Plugin for ForkLift, an FTP application for OS X.
-### Requirements
+To use it, add `forklift` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... forklift)
+```
+
+## Requirements
* [ForkLift](https://binarynights.com/)
-### Usage
+## Usage
-<code>fl [*file_or_folder*]</code>
+`fl [<file_or_folder>]`
* If `fl` is called without arguments then the current folder is opened in ForkLift. This is equivalent to `fl .`.
-* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift. If called with a non-directory file as the argument, then the file's parent directory is opened.
+* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift
+
+* If `fl` is called with a non-directory file as the argument, then the file's parent directory is opened.
diff --git a/plugins/gas/README.md b/plugins/gas/README.md
index cd8800e7d..47b3fb9df 100644
--- a/plugins/gas/README.md
+++ b/plugins/gas/README.md
@@ -4,6 +4,7 @@ This plugin adds autocompletion for the [gas](http://walle.github.com/gas) comma
a utility to manage Git authors.
To use it, add `gas` to the plugins array of your zshrc file:
+
```zsh
plugins=(... gas)
```
diff --git a/plugins/geeknote/README.md b/plugins/geeknote/README.md
index 3f2353112..95b3aa7dd 100644
--- a/plugins/geeknote/README.md
+++ b/plugins/geeknote/README.md
@@ -1,12 +1,10 @@
-## ZSH-Geeknote
+# Geeknote plugin
-[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for oh-my-zsh.
+This plugin provides autocompletion for [Geeknote](https://github.com/VitaliyRodnenko/geeknote)
+and an alias for `geeknote` called `gn`.
-Plugins provides:
+To use it, add `geeknote` to the plugins array in your zshrc file:
-- auto completion of commands and their options
-- alias `gn`
-
-You can find information how to install Geeknote and it's available commands on the [project website](http://www.geeknote.me/).
-
-Maintainer : Ján Koščo ([@s7anley](https://twitter.com/s7anley))
+```zsh
+plugins=( ... geeknote ...)
+```
diff --git a/plugins/geeknote/_geeknote b/plugins/geeknote/_geeknote
index cf1a187d2..a34be59b1 100644
--- a/plugins/geeknote/_geeknote
+++ b/plugins/geeknote/_geeknote
@@ -1,136 +1,157 @@
#compdef geeknote
-# --------------- ------------------------------------------------------------
-# Name : _geeknote
-# Synopsis : zsh completion for geeknote
-# Author : Ján Koščo <3k.stanley@gmail.com>
-# HomePage : http://www.geeknote.me
-# Version : 0.1
-# Tag : [ shell, zsh, completion, evernote ]
-# Copyright : © 2014 by Ján Koščo,
-# Released under current GPL license.
-# --------------- ------------------------------------------------------------
+
+# Geeknote Autocomplete plugin for Zsh
+# Requires: Geeknote installed
+# Author : Ján Koščo (@s7anley)
+
+__login() {
+ # no arguments
+}
+
+__logout() {
+ _arguments \
+ '--force[Do not ask about logging out.]'
+}
+
+__settings() {
+ _arguments \
+ "--editor+[Set the editor, which use to edit and create notes.]::"
+}
+
+__create() {
+ _arguments \
+ '--title+[The note title.]::' \
+ '--content+[The note content.]::' \
+ '--tags+[One tag or the list of tags which will be added to the note.]::' \
+ '--notebook+[Set the notebook where to save note.]::' \
+ '--resource+[Add a resource to the note.]::'
+}
+
+__edit() {
+ _arguments \
+ '--note+[The name or ID from the previous search of a note to edit.]::' \
+ '--title+[Set new title of the note.]::' \
+ '--content+[Set new content of the note.]::' \
+ '--tags+[Set new list o tags for the note.]::' \
+ '--notebook+[Assign new notebook for the note.]::' \
+ '--resource+[Add a resource to the note.]::'
+}
+
+__find() {
+ _arguments \
+ '--search+[Text to search.]::' \
+ '--tags+[Notes with which tag/tags to search.]::' \
+ '--notebook+[In which notebook search the note.]::' \
+ '--date+[Set date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy.]::' \
+ '--count+[How many notes show in the result list.]::' \
+ '--with-url[Add direct url of each note in results to Evernote web-version.]' \
+ '--content-search[Search by content, not by title.]' \
+ '--exact-entry[Search for exact entry of the request.]'
+}
+
+__show() {
+ _arguments \
+ '--note+[The name or ID from the previous search of a note to show.]::' \
+ '--raw[Show the raw note body.]'
+}
+
+__remove() {
+ _arguments \
+ '--note+[The name or ID from the previous search of a note to remove.]::' \
+ '--force[Do not ask about removing.]'
+}
+
+__notebook-list() {
+ # no arguments
+}
+
+__notebook-create() {
+ _arguments \
+ '--title+[Set the title of new notebook.]::'
+}
+
+__notebook-edit() {
+ _arguments \
+ '--title+[Set the title of new notebook.]::' \
+ '--notebook+[The name of a notebook to rename.]::'
+}
+
+__tag-list() {
+ # no arguments
+}
+
+__tag-create() {
+ _arguments \
+ '--title+[Set the title of new tag.]::'
+}
+
+__tag-edit() {
+ _arguments \
+ '--tagname+[The name of a tag to rename.]::' \
+ '--title+[Set the new name of tag.]::'
+}
+
+__user() {
+ _arguments \
+ '--full[Show full information.]'
+}
local -a _1st_arguments
_1st_arguments=(
- 'login'
- 'logout'
- 'settings'
- 'create'
- 'edit'
- 'find'
- 'show'
- 'remove'
- 'notebook-list'
- 'notebook-create'
- 'notebook-edit'
- 'tag-list'
- 'tag-create'
- 'tag-edit'
- 'tag-remove'
- 'gnsync'
- 'user'
+ 'login':'Authorize in Evernote.'
+ 'logout':'Logout from Evernote.'
+ 'settings':'Show and edit current settings.'
+ 'create':'Create note in Evernote.'
+ 'edit':'Edit note in Evernote.'
+ 'find':'Search notes in Evernote.'
+ 'show':'Output note in the terminal.'
+ 'remove':'Remove note from Evernote.'
+ 'notebook-list':'Show the list of existing notebooks in your Evernote.'
+ 'notebook-create':'Create new notebook.'
+ 'notebook-edit':'Edit/rename notebook.'
+ 'tag-list':'Show the list of existing tags in your Evernote.'
+ 'tag-create':'Create new tag.'
+ 'tag-edit':'Edit/rename tag.'
+ 'user':'Show information about active user.'
)
_arguments '*:: :->command'
if (( CURRENT == 1 )); then
- _describe -t commands "geeknote command" _1st_arguments
- return
+ _describe -t commands "geeknote command" _1st_arguments
+ return
fi
local -a _command_args
case "$words[1]" in
- user)
- _command_args=(
- '(--full)--full' \
- )
- ;;
- logout)
- _command_args=(
- '(--force)--force' \
- )
- ;;
- settings)
- _command_args=(
- '(--editor)--editor' \
- )
- ;;
- create)
- _command_args=(
- '(-t|--title)'{-t,--title}'[note title]' \
- '(-c|--content)'{-c,--content}'[note content]' \
- '(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
- '(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
- )
- ;;
- edit)
- _command_args=(
- '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
- '(-t|--title)'{-t,--title}'[note title]' \
- '(-c|--content)'{-c,--content}'[note content]' \
- '(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
- '(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
- )
- ;;
- remove)
- _command_args=(
- '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
- '(--force)--force' \
- )
- ;;
- show)
- _command_args=(
- '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
- )
- ;;
- find)
- _command_args=(
- '(-s|--search)'{-s,--search}'[text to search]' \
- '(-tg|--tags)'{-tg,--tags}'[notes with which tag/tags to search]' \
- '(-nb|--notebook)'{-nb,--notebook}'[in which notebook search the note]' \
- '(-d|--date)'{-d,--date}'[date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy]' \
- '(-cn|--count)'{-cn,--count}'[how many notes show in the result list]' \
- '(-uo|--url-only)'{-uo,--url-only}'[add direct url of each note in results to Evernote web-version]' \
- '(-ee|--exact-entry)'{-ee,--exact-entry}'[search for exact entry of the request]' \
- '(-cs|--content-search)'{-cs,--content-search}'[search by content, not by title]' \
- )
- ;;
- notebook-create)
- _command_args=(
- '(-t|--title)'{-t,--title}'[notebook title]' \
- )
- ;;
- notebook-edit)
- _command_args=(
- '(-nb|--notebook)'{-nb,--notebook}'[name of notebook to rename]' \
- '(-t|--title)'{-t,--title}'[new notebook title]' \
- )
- ;;
- notebook-remove)
- _command_args=(
- '(-nb|--notebook)'{-nb,--notebook}'[name of notebook to remove]' \
- '(--force)--force' \
- )
- ;;
- tag-create)
- _command_args=(
- '(-t|--title)'{-t,--title}'[title of tag]' \
- )
- ;;
- tag-edit)
- _command_args=(
- '(-tgn|--tagname)'{-tgn,--tagname}'[tag to edit]' \
- '(-t|--title)'{-t,--title}'[new tag name]' \
- )
- ;;
- tag-remove)
- _command_args=(
- '(-tgn|--tagname)'{-tgn,--tagname}'[tag to remove]' \
- '(--force)--force' \
- )
- ;;
- esac
-
-_arguments \
- $_command_args \
- && return 0
+ login)
+ __login ;;
+ logout)
+ __logout ;;
+ settings)
+ __settings ;;
+ create)
+ __create ;;
+ edit)
+ __edit ;;
+ find)
+ __find ;;
+ show)
+ __show ;;
+ remove)
+ __remove ;;
+ notebook-list)
+ __notebook-list ;;
+ notebook-create)
+ __notebook-create ;;
+ notebook-edit)
+ __notebook-edit ;;
+ tag-list)
+ __tag-list ;;
+ tag-create)
+ __tag-create ;;
+ tag-edit)
+ __tag-edit ;;
+ user)
+ __user ;;
+esac
diff --git a/plugins/git-extras/README.md b/plugins/git-extras/README.md
index 987f0d800..2adc9d477 100644
--- a/plugins/git-extras/README.md
+++ b/plugins/git-extras/README.md
@@ -2,10 +2,16 @@
This plugin provides completion definitions for some of the commands defined by [git-extras](https://github.com/tj/git-extras).
-## Setup notes
+To use it, add `git-extras` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... git-extras)
+```
+
+## Setup notes
The completions work by augmenting the `_git` completion provided by `zsh`. This only works with the `zsh`-provided `_git`, not the `_git` provided by `git` itself. If you have both `zsh` and `git` installed, you need to make sure that the `zsh`-provided `_git` takes precedence.
### OS X Homebrew Setup
-On OS X with Homebrew, you need to install `git` with `brew install git --without-completions`. Otherwise, `git`'s `_git` will take precedence, and you won't see the completions for `git-extras` commands.
+**NOTE:** this no longer works on current Homebrew distributions of git. ~~On OS X with Homebrew, you need to install `git` with `brew install git --without-completions`. Otherwise, `git`'s `_git` will take precedence, and you won't see the completions for `git-extras` commands.~~
diff --git a/plugins/git-flow/README.md b/plugins/git-flow/README.md
index 5d8049e3b..9c25dec83 100644
--- a/plugins/git-flow/README.md
+++ b/plugins/git-flow/README.md
@@ -1,18 +1,15 @@
# Git-Flow plugin
-This plugin adds completion and aliases for the `git-flow` command. More information
-at https://github.com/nvie/gitflow.
+This plugin adds completion and aliases for the [`git-flow` command](https://github.com/nvie/gitflow).
-Enable git-flow plugin in your zshrc file:
-```
+To use it, add `git-flow` to the plugins array in your zshrc file:
+
+```zsh
plugins=(... git-flow)
```
## Aliases
-More information about `git-flow` commands:
-https://github.com/nvie/gitflow/wiki/Command-Line-Arguments
-
| Alias | Command | Description |
|---------|----------------------------|----------------------------------------|
| `gfl` | `git flow` | Git-Flow command |
@@ -30,3 +27,5 @@ https://github.com/nvie/gitflow/wiki/Command-Line-Arguments
| `gflfp` | `git flow feature publish` | Publish feature: `gflfp <name>` |
| `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` |
| `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` |
+
+[More information about `git-flow` commands](https://github.com/nvie/gitflow/wiki/Command-Line-Arguments).
diff --git a/plugins/git-remote-branch/README.md b/plugins/git-remote-branch/README.md
index bd73e5dec..d4eb75954 100644
--- a/plugins/git-remote-branch/README.md
+++ b/plugins/git-remote-branch/README.md
@@ -3,8 +3,9 @@
This plugin adds completion for [`grb`](https://github.com/webmat/git_remote_branch),
or `git_remote_branch`.
-To use it, add `git-remote-branch` to the plugins array of your `.zshrc` file:
-```
+To use it, add `git-remote-branch` to the plugins array of your zshrc file:
+
+```zsh
plugins=(... git-remote-branch)
```
diff --git a/plugins/git/README.md b/plugins/git/README.md
index 009a74016..dbe565634 100644
--- a/plugins/git/README.md
+++ b/plugins/git/README.md
@@ -22,7 +22,7 @@ plugins=(... git)
| gb | git branch |
| gba | git branch -a |
| gbd | git branch -d |
-| gbda | git branch --no-color --merged \| command grep -vE "^(\+|\*\|\s*(master\|develop\|dev)\s*$)" \| command xargs -n 1 git branch -d |
+| gbda | git branch --no-color --merged \| command grep -vE "^(\+\|\*\|\s*(master\|develop\|dev)\s*$)" \| command xargs -n 1 git branch -d |
| gbD | git branch -D |
| gbl | git blame -b -w |
| gbnm | git branch --no-merged |
@@ -45,7 +45,7 @@ plugins=(... git)
| gcf | git config --list |
| gcl | git clone --recurse-submodules |
| gclean | git clean -id |
-| gpristine | git reset --hard && git clean -dfx |
+| gpristine | git reset --hard && git clean -dffx |
| gcm | git checkout master |
| gcd | git checkout develop |
| gcmsg | git commit -m |
@@ -172,7 +172,7 @@ plugins=(... git)
| gwch | git whatchanged -p --abbrev-commit --pretty=medium |
| gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]" |
-### Deprecated
+### Deprecated aliases
These are aliases that have been removed, renamed, or otherwise modified in a way that may, or may not, receive further support.
@@ -211,7 +211,7 @@ These features allow to pause a branch development and switch to another one (_"
| gwip | Commit wip branch |
| gunwip | Uncommit wip branch |
-### Deprecated
+### Deprecated functions
| Command | Description | Reason |
|:-----------------------|:----------------------------------------|:----------------------------------------------------------------|
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index ffb3e506a..3ff5b1f5a 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -66,7 +66,7 @@ alias gcb='git checkout -b'
alias gcf='git config --list'
alias gcl='git clone --recurse-submodules'
alias gclean='git clean -id'
-alias gpristine='git reset --hard && git clean -dfx'
+alias gpristine='git reset --hard && git clean -dffx'
alias gcm='git checkout master'
alias gcd='git checkout develop'
alias gcmsg='git commit -m'
diff --git a/plugins/gitfast/README.md b/plugins/gitfast/README.md
index 23db5393b..fed4b120a 100644
--- a/plugins/gitfast/README.md
+++ b/plugins/gitfast/README.md
@@ -1,6 +1,6 @@
# Gitfast plugin
-This plugin adds completion for Git, using the zsh completion from git.git folks, which is much faster than the official one from zsh. A lot of zsh-specific features are not supported, like descriptions for every argument, but everything the bash completion has, this one does too (as it is using it behind the scenes). Not only is it faster, it should be more robust, and updated regularly to the latest git upstream version..
+This plugin adds completion for Git, using the zsh completion from git.git folks, which is much faster than the official one from zsh. A lot of zsh-specific features are not supported, like descriptions for every argument, but everything the bash completion has, this one does too (as it is using it behind the scenes). Not only is it faster, it should be more robust, and updated regularly to the latest git upstream version.
To use it, add `gitfast` to the plugins array in your zshrc file:
diff --git a/plugins/github/README.md b/plugins/github/README.md
index 2b66e390f..70b863f64 100644
--- a/plugins/github/README.md
+++ b/plugins/github/README.md
@@ -1,4 +1,4 @@
-# github
+# github plugin
This plugin supports working with GitHub from the command line. It provides a few things:
@@ -6,7 +6,7 @@ This plugin supports working with GitHub from the command line. It provides a fe
* Completion for the `github` Ruby gem.
* Convenience functions for working with repos and URLs.
-### Functions
+### Functions
* `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub
* `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub
@@ -14,13 +14,13 @@ This plugin supports working with GitHub from the command line. It provides a fe
* `git.io` - Shortens a URL using [git.io](https://git.io)
-## Installation
+## Installation
[Hub](https://github.com/github/hub) needs to be installed if you want to use it. On OS X with Homebrew, this can be done with `brew install hub`. The `hub` completion definition needs to be added to your `$FPATH` before initializing OMZ.
The [`github` Ruby gem](https://github.com/defunkt/github-gem) needs to be installed if you want to use it.
-### Configuration
+### Configuration
These settings affect `github`'s behavior.
@@ -35,7 +35,7 @@ These settings affect `github`'s behavior.
See `man hub` for more details.
-### Homebrew installation note
+### Homebrew installation note
If you have installed `hub` using Homebrew, its completions may not be on your `$FPATH` if you are using the system `zsh`. Homebrew installs `zsh` completion definitions to `/usr/local/share/zsh/site-functions`, which will be on `$FPATH` for the Homebrew-installed `zsh`, but not for the system `zsh`. If you want it to work with the system `zsh`, add this to your `~/.zshrc` before it sources `oh-my-zsh.sh`.
diff --git a/plugins/gitignore/gitignore.plugin.zsh b/plugins/gitignore/gitignore.plugin.zsh
index 15e38d3b7..a687f5cce 100644
--- a/plugins/gitignore/gitignore.plugin.zsh
+++ b/plugins/gitignore/gitignore.plugin.zsh
@@ -1,4 +1,4 @@
-function gi() { curl -fL https://www.gitignore.io/api/${(j:,:)@} }
+function gi() { curl -fLw '\n' https://www.gitignore.io/api/"${(j:,:)@}" }
_gitignoreio_get_command_list() {
curl -sfL https://www.gitignore.io/api/list | tr "," "\n"
diff --git a/plugins/gnu-utils/gnu-utils.plugin.zsh b/plugins/gnu-utils/gnu-utils.plugin.zsh
index 967b8b4ea..23e00c295 100644
--- a/plugins/gnu-utils/gnu-utils.plugin.zsh
+++ b/plugins/gnu-utils/gnu-utils.plugin.zsh
@@ -36,7 +36,7 @@ __gnu_utils() {
gcmds+=('gfind' 'gxargs' 'glocate')
# Not part of either coreutils or findutils, installed separately.
- gcmds+=('gsed' 'gtar' 'gtime')
+ gcmds+=('gsed' 'gtar' 'gtime' 'gmake')
for gcmd in "${gcmds[@]}"; do
# Do nothing if the command isn't found
diff --git a/plugins/gpg-agent/README.md b/plugins/gpg-agent/README.md
index a9711f923..9c1e6d2cc 100644
--- a/plugins/gpg-agent/README.md
+++ b/plugins/gpg-agent/README.md
@@ -3,6 +3,7 @@
Enables [GPG's gpg-agent](https://www.gnupg.org/documentation/manuals/gnupg/) if it is not running.
To use it, add gpg-agent to the plugins array of your zshrc file:
-```
+
+```zsh
plugins=(... gpg-agent)
```
diff --git a/plugins/gradle/README.md b/plugins/gradle/README.md
index 215503c81..3756db0dc 100644
--- a/plugins/gradle/README.md
+++ b/plugins/gradle/README.md
@@ -1,4 +1,4 @@
-## Gradle Plugin
+# Gradle plugin
This plugin adds completions and aliases for [Gradle](https://gradle.org/).
@@ -10,9 +10,15 @@ plugins=(... gradle)
## Usage
-This plugin creates an alias `gradle` which is used to determine whether the current working directory has a gradlew file. If gradlew is present it will be used otherwise `gradle` is used directly. Gradle tasks can be executed directly without regard for whether it is `gradle` or `gradlew`
+This plugin creates a function called `gradle-or-gradlew`, which is aliased
+to `gradle`, which is used to determine whether the current project directory
+has a gradlew file. If `gradlew` is present it will be used, otherwise `gradle`
+is used instead. Gradle tasks can be executed directly without regard for
+whether it is `gradle` or `gradlew`. It also supports being called from
+any directory inside the root project directory.
Examples:
+
```zsh
gradle test
gradle build
@@ -20,4 +26,5 @@ gradle build
## Completion
-The completion provided for this plugin caches the parsed tasks into a file named `.gradletasknamecache` in the current working directory, so you might want to add that to your `.gitignore` file so that it's not accidentally committed.
+This plugin uses [the completion from the Gradle project](https://github.com/gradle/gradle-completion),
+which is distributed under the MIT license.
diff --git a/plugins/gradle/_gradle b/plugins/gradle/_gradle
index 80723f2fc..647626615 120000..100644
--- a/plugins/gradle/_gradle
+++ b/plugins/gradle/_gradle
@@ -1 +1,420 @@
-gradle.plugin.zsh \ No newline at end of file
+#compdef gradle gradlew gw
+#
+# Taken from https://github.com/gradle/gradle-completion
+# Copyright (c) 2017 Eric Wendelin
+#
+# 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.
+# Terms
+
+__gradle-set-project-root-dir() {
+ local dir=`pwd`
+ project_root_dir=`pwd`
+ while [[ $dir != '/' ]]; do
+ if [[ -f "$dir/settings.gradle" || -f "$dir/settings.gradle.kts" || -f "$dir/gradlew" ]]; then
+ project_root_dir=$dir
+ return 0
+ fi
+ dir="$(dirname "$dir")"
+ done
+ return 1
+}
+
+__gradle-init-cache-dir() {
+ cache_dir="$HOME/.gradle/completion"
+ mkdir -p $cache_dir
+}
+
+__gradle-set-settings-file() {
+ # In order of precedence: --settings-file=filename, settings.gradle, settings.gradle.kts
+
+ local default_gradle_settings_file="$project_root_dir/settings.gradle"
+ if [[ ! -f $default_gradle_settings_file ]]; then
+ default_gradle_settings_file="$project_root_dir/settings.gradle.kts"
+ fi
+ gradle_settings_file=${${(v)opt_args[(i)-c|--settings-file]}:-$default_gradle_settings_file}
+}
+
+__gradle-set-build-file() {
+ __gradle-set-settings-file
+ # In order of precedence: --build-file=filename, rootProject.buildFileName, build.gradle, build.gradle.kts
+
+ local default_gradle_build_file_name="build.gradle"
+ if [[ -r $gradle_settings_file ]]; then
+ default_gradle_build_file_name=${$(grep "^rootProject\.buildFileName" $gradle_settings_file | \
+ sed -n -e "s/rootProject\.buildFileName = [\'\"]\(.*\)[\'\"]/\1/p")}
+
+ default_gradle_build_file_name="${default_gradle_build_file:-build.gradle}"
+ fi
+
+ local default_gradle_build_file="$project_root_dir/$default_gradle_build_file_name"
+ if [[ ! -f $default_gradle_build_file ]]; then
+ default_gradle_build_file="$project_root_dir/build.gradle.kts"
+ fi
+
+ # If a build file is specified after '-b' or '--build-file', use this file.
+ gradle_build_file=${${(v)opt_args[(i)-b|--build-file]}:-$default_gradle_build_file}
+}
+
+__gradle-set-cache-name() {
+ # Cache name is constructed from the absolute path of the build file.
+ cache_name=${${gradle_build_file:a}//[^[:alnum:]]/_}
+}
+
+__gradle-set-files-checksum() {
+ # Cache MD5 sum of all Gradle scripts and modified timestamps
+ if builtin command -v md5 > /dev/null; then
+ gradle_files_checksum=( $(md5 -q -s "$(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null)") )
+ elif builtin command -v md5sum > /dev/null; then
+ gradle_files_checksum=( $(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null | md5sum | awk '{print $1}') )
+ else
+ _message 'Cannot generate completions as neither md5 nor md5sum exist on \$PATH'
+ return 1
+ fi
+}
+
+__gradle-generate-script-cache() {
+ # Invalidate cache after 3 weeks by default
+ local cache_ttl_mins=${$(echo $GRADLE_CACHE_TTL_MINUTES):-30240}
+ local script_exclude_pattern=${$(echo $GRADLE_COMPLETION_EXCLUDE_PATTERN):-"/(.git|build|integTest|samples|templates|smokeTest|testFixtures|out)/"}
+ if [[ ! $(find $cache_dir/$cache_name -mmin -$cache_ttl_mins 2>/dev/null) ]]; then
+ zle -R "Generating Gradle build script cache"
+ # Cache all Gradle scripts
+ local -a gradle_build_scripts
+ gradle_build_scripts=( $(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | egrep -v "$script_exclude_pattern") )
+ printf "%s\n" "${gradle_build_scripts[@]}" >| $cache_dir/$cache_name
+ fi
+}
+
+__gradle-generate-tasks-cache() {
+ __gradle-set-files-checksum
+
+ # Use Gradle wrapper when it exists.
+ local gradle_cmd="gradle"
+ if [[ -x "$project_root_dir/gradlew" ]]; then
+ gradle_cmd="$project_root_dir/gradlew"
+ fi
+
+ zle -R "Generating Gradle task cache from $gradle_build_file"
+
+ # Run gradle to retrieve possible tasks and cache.
+ # Reuse Gradle Daemon if IDLE but don't start a new one.
+ local gradle_tasks_output
+ if [[ ! -z "$($gradle_cmd --status 2>/dev/null | grep IDLE)" ]]; then
+ gradle_tasks_output="$($gradle_cmd --daemon --build-file $gradle_build_file -q tasks --all 2>/dev/null)"
+ else
+ gradle_tasks_output="$($gradle_cmd --no-daemon --build-file $gradle_build_file -q tasks --all 2>/dev/null)"
+ fi
+ local gradle_all_tasks="" root_tasks="" subproject_tasks="" output_line
+ local -a match
+ for output_line in ${(f)"$(printf "%s\n" "${gradle_tasks_output[@]}")"}; do
+ if [[ $output_line =~ ^([[:lower:]][[:alnum:][:punct:]]*)([[:space:]]-[[:space:]]([[:print:]]*))? ]]; then
+ local task_name="${match[1]}"
+ local task_description="${match[3]}"
+ # Completion for subproject tasks with ':' prefix
+ if [[ $task_name =~ ^([[:alnum:][:punct:]]+):([[:alnum:]]+) ]]; then
+ gradle_all_tasks+="${task_name//:/\\:}:$task_description\n\\:${task_name//:/\\:}:$task_description\n"
+ subproject_tasks+="${match[2]}\n"
+ else
+ gradle_all_tasks+="${task_name//:/\\:}:$task_description\n"
+ root_tasks+="$task_name\n"
+ fi
+ fi
+ done
+
+ # subproject tasks can be referenced implicitly from root project
+ if [[ $GRADLE_COMPLETION_UNQUALIFIED_TASKS == "true" ]]; then
+ local -a implicit_tasks
+ implicit_tasks=( $(comm -23 <(echo $subproject_tasks | sort) <(echo $root_tasks | sort)) )
+ for task in $(printf "%s\n" "${implicit_tasks[@]}"); do
+ gradle_all_tasks+="$task\n"
+ done
+ fi
+
+ echo $gradle_all_tasks >| $cache_dir/$gradle_files_checksum
+ echo $gradle_files_checksum >| $cache_dir/$cache_name.md5
+}
+
+__gradle-completion-init() {
+ local cache_dir cache_name gradle_build_file gradle_files_checksum project_root_dir
+ __gradle-init-cache-dir
+ __gradle-set-project-root-dir
+ __gradle-set-build-file
+ if [[ -f $gradle_build_file ]]; then
+ __gradle-set-cache-name
+ __gradle-generate-script-cache
+ __gradle-set-files-checksum
+ __gradle-generate-tasks-cache
+ fi
+ return 0
+}
+
+__gradle_tasks() {
+ local cache_dir cache_name gradle_build_file gradle_files_checksum project_root_dir
+
+ __gradle-init-cache-dir
+ __gradle-set-project-root-dir
+ __gradle-set-build-file
+ if [[ -f $gradle_build_file ]]; then
+ __gradle-set-cache-name
+ __gradle-generate-script-cache
+ __gradle-set-files-checksum
+
+ # The cache key is md5 sum of all gradle scripts, so it's valid if it exists.
+ if [[ -f $cache_dir/$cache_name.md5 ]]; then
+ local cached_checksum="$(cat $cache_dir/$cache_name.md5)"
+ local -a cached_tasks
+ if [[ -z $cur ]]; then
+ cached_tasks=(${(f)"$(cat $cache_dir/$cached_checksum)"})
+ else
+ cached_tasks=(${(f)"$(grep "^${cur//:/\\\\:}" $cache_dir/$cached_checksum)"})
+ fi
+ _describe 'all tasks' cached_tasks && ret=0
+ else
+ __gradle-generate-tasks-cache
+ fi
+
+ # Regenerate tasks cache in the background
+ if [[ $gradle_files_checksum != "$(cat $cache_dir/$cache_name.md5)" || ! -f $cache_dir/$gradle_files_checksum || $(wc -c < $cache_dir/$gradle_files_checksum) -le 1 ]]; then
+ $(__gradle-generate-tasks-cache 1>&2 2>/dev/null &)
+ fi
+ else
+ _describe 'built-in tasks' '(
+ "buildEnvironment:Displays all buildscript dependencies declared in root project."
+ "components:Displays the components produced by root project."
+ "dependencies:Displays all dependencies declared in root project."
+ "dependencyInsight:Displays the insight into a specific dependency in root project."
+ "dependentComponents:Displays the dependent components of components in root project."
+ "help:Displays a help message."
+ "init:Initializes a new Gradle build."
+ "model:Displays the configuration model of root project."
+ "projects:Displays the sub-projects of root project."
+ "properties:Displays the properties of root project."
+ "tasks:Displays the tasks runnable from root project."
+ "wrapper:Generates Gradle wrapper files."
+ )' && ret=0
+ fi
+}
+
+__gradle_subcommand() {
+ integer ret=1
+
+ case "$words[1]" in
+ (dependencies)
+ _arguments \
+ '--configuration=[The configuration to generate the report for.]:dependency configuration:_gradle_dependency_configurations' && ret=0
+ ;;
+ (dependencyInsight)
+ _arguments \
+ '--dependency=[Shows the details of given dependency.]' \
+ '--configuration=[Looks for the dependency in given configuration.]:dependency configuration:_gradle_dependency_configurations' && ret=0
+ ;;
+ (help)
+ _arguments \
+ '--task[The task to show help for.]' && ret=0
+ ;;
+ (init)
+ _arguments \
+ '--dsl=[DSL to be used in generated scripts.]:dsl:(groovy kotlin)' \
+ '--package=[Package for the generated source.]' \
+ '--project-name=[Name of the generated project.]' \
+ '--test-framework=[Test framework to be used.]:test framework:(junit kotlintest scalatest spock testng)' \
+ '--type=[Project type to generate.]:project type:(basic cpp-application cpp-library groovy-application groovy-library java-application java-library kotlin-application kotlin-library pom scala-library)' && ret=0
+ ;;
+ (tasks)
+ _arguments \
+ '--all[List all tasks, including subproject tasks.]' \
+ '--group=[Show tasks only from given task group.]' && ret=0
+ ;;
+ (test)
+ _arguments -C \
+ '--debug-jvm[Enable debugging for the test process. The process is started suspended and listening on port 5005. Requires the "java" plugin.]' \
+ '--fail-fast[Stops test execution after the first failed test. Requires the "java" plugin.]' \
+ '--tests=[Sets test class or method name to be included, * is supported. Requires the "java" plugin.]' \
+ '(-)*:: :->task-or-option' && ret=0
+ ;;
+ (wrapper)
+ _arguments \
+ '--distribution-type=[Binary-only or all with docs and sources]:*:distribution type:(bin all)' \
+ '--gradle-version=[Set Gradle version for wrapper]' \
+ '--gradle-distribution-sha256-sum=[SHA-256 checksum]' \
+ '--gradle-distribution-url=[Set Gradle distribution URL]' && ret=0
+ ;;
+ (*)
+ _arguments -C \
+ {-a,--no-rebuild}'[Do not rebuild project dependencies.]' \
+ '(--no-build-cache)--build-cache[Enable the Gradle build cache.]' \
+ {-b,--build-file}'[Specifies the build file.]:build script:_files -g \*.gradle' \
+ {-C,--cache}'[Specifies how compiled build scripts should be cached.]:cache policy:(on rebuild)' \
+ {-c,--settings-file}'[Specifies the settings file.]:settings file:_files -g \*.gradle' \
+ '(--no-configure-on-demand)--configure-on-demand[Only relevant projects are configured in this build run.]' \
+ '--console=[Specifies which type of console output to generate.]:console output type:(plain auto rich verbose)' \
+ '--continue[Continues task execution after a task failure.]' \
+ '-Dorg.gradle.cache.reserved.mb=[Reserve Gradle Daemon memory for operations.]' \
+ '-Dorg.gradle.caching=[Set true to enable Gradle build cache.]:enable build cache:(true false)' \
+ '-Dorg.gradle.console=[Set type of console output to generate.]:console output type:(plain auto rich verbose)' \
+ '-Dorg.gradle.daemon.debug=[Set true to debug Gradle Daemon.]:enable daemon debug:(true false)' \
+ '-Dorg.gradle.daemon.idletimeout=[Kill Gradle Daemon after # idle millis.]' \
+ '-Dorg.gradle.debug=[Set true to debug Gradle Client.]' \
+ '-Dorg.gradle.jvmargs=[Set JVM arguments.]' \
+ '-Dorg.gradle.java.home=[Set JDK home dir.]' \
+ '-Dorg.gradle.logging.level=[Set default Gradle log level.]:log level:(quiet warn lifecycle info debug)' \
+ '-Dorg.gradle.parallel=[Set true to enable parallel project builds.]:enable parallel build:(true false)' \
+ '-Dorg.gradle.priority=[Set priority for Gradle worker processes.]:priority:(low normal)' \
+ '-Dorg.gradle.warning.mode=[Set types of warnings to log.]:warning level:(all summary none)' \
+ '-Dorg.gradle.workers.max=[Set the number of workers Gradle is allowed to use.]' \
+ '(-i --info -w --warn -q --quiet)'{-d,--debug}'[Log in debug mode (includes normal stacktrace).]' \
+ '(--no-daemon)--daemon[Uses the Gradle daemon to run the build. Starts the daemon if not running.]' \
+ '--foreground[Starts the Gradle daemon in the foreground.]' \
+ {-g,--gradle-user-home}'[Specifies the gradle user home directory.]:file:_directories' \
+ \*--include-build'[Includes the specified build in the composite.]:file:_directories' \
+ \*{-I,--init-script}'[Specifies an initialization script.]:init script:_files -g \*.gradle' \
+ '(-d --debug -w --warn -q --quiet)'{-i,--info}'[Set log level to info.]' \
+ '--max-workers[Set the maximum number of concurrent workers that Gradle may use.]:number workers' \
+ {-m,--dry-run}'[Runs the builds with all task actions disabled.]' \
+ '--no-color[Do not use color in the console output. (Removed in Gradle 3.0)]' \
+ '(--build-cache)--no-build-cache[Do not use the Gradle build cache.]' \
+ '(--configure-on-demand)--no-configure-on-demand[Disables configuration on demand.]' \
+ '(--daemon)--no-daemon[Do not use the Gradle daemon to run the build.]' \
+ '(--parallel)--no-parallel[Disables parallel execution to build projects.]' \
+ '(--scan)--no-scan[Do not create a build scan.]' \
+ '--offline[The build should operate without accessing network resources.]' \
+ \*{-P+,--project-prop}'[Set project property for the build script (e.g. -Pmyprop=myvalue).]:project property (prop=val):' \
+ {-p,--project-dir}'[Specifies the start directory for Gradle.]:start directory:_directories' \
+ '(--no-parallel)--parallel[Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]' \
+ '--profile[Profiles build execution time and generates a report in the <build_dir>/reports/profile directory.]' \
+ '--priority[Set priority for Gradle worker processes.]:priority:(low normal)' \
+ '--project-cache-dir[Specifies the project-specific cache directory.]:cache directory:_directories' \
+ '(-d --debug -w --warn -i --info)'{-q,--quiet}'[Log errors only.]' \
+ '--recompile-scripts[Force build script recompiling.]' \
+ '--refresh[Refresh the state of resources of the type(s) specified.]:refresh policy:(dependencies)' \
+ '--refresh-dependencies[Refresh the state of dependencies.]' \
+ '--rerun-tasks[Ignore previously cached task results.]' \
+ '(--no-scan)--scan[Create a build scan.]' \
+ '(-S --full-stacktrace)'{-s,--stacktrace}'[Print out the stacktrace for all exceptions.]' \
+ '(-s --stacktrace)'{-S,--full-stacktrace}'[Print out the full (very verbose) stacktrace for all exceptions.]' \
+ '--system-prop[system property (prop=val)]' \
+ {-t,--continuous}'[Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.]' \
+ {-u,--no-search-upward}"[Don't search in parent folders for a settings.gradle file.]" \
+ '(--write-locks)--update-locks[Perform a partial update of the dependency lock.]' \
+ '(-d --debug -q --quiet -i --info)'{-w,--warn}'[Log warnings and errors only.]' \
+ '--warning-mode=[Set types of warnings to log.]:warning mode:(all summary none)' \
+ '(--update-locks)--write-locks[Persists dependency resolution for locked configurations.]' \
+ {-x,--exclude-task}'[Specify a task to be excluded from execution.]' && ret=0
+ ;;
+ esac
+
+ return ret
+}
+
+(( $+functions[_gradle_dependency_configurations] )) ||
+_gradle_dependency_configurations() {
+ local configurations
+ configurations=(
+ 'compileClasspath'
+ 'runtimeClasspath'
+ 'testCompileClasspath'
+ 'testRuntimeClasspath'
+ )
+ _describe -t 'dependency configurations' "dependency configuration" configurations
+}
+
+_gradle() {
+ local cur=${words[CURRENT]}
+ local curcontext="$curcontext" state
+ integer ret=1
+ typeset -A opt_args
+
+ _arguments -C \
+ '(-)'{-\?,-h,--help}'[Shows a help message.]' \
+ {-a,--no-rebuild}'[Do not rebuild project dependencies.]' \
+ '(--no-build-cache)--build-cache[Enable the Gradle build cache.]' \
+ {-b,--build-file}'[Specifies the build file.]:build script:_files -g \*.gradle' \
+ {-C,--cache}'[Specifies how compiled build scripts should be cached.]:cache policy:(on rebuild)' \
+ {-c,--settings-file}'[Specifies the settings file.]:settings file:_files -g \*.gradle:->argument-expected' \
+ '(--no-configure-on-demand)--configure-on-demand[Only relevant projects are configured in this build run.]' \
+ '--console=[Specifies which type of console output to generate.]:console output type:(plain auto rich verbose)' \
+ '--continue[Continues task execution after a task failure.]' \
+ '-Dorg.gradle.cache.reserved.mb=[Reserve Gradle Daemon memory for operations.]' \
+ '-Dorg.gradle.caching=[Set true to enable Gradle build cache.]' \
+ '-Dorg.gradle.console=[Set type of console output to generate.]:console output type:(plain auto rich verbose)' \
+ '-Dorg.gradle.daemon.debug=[Set true to debug Gradle Daemon.]' \
+ '-Dorg.gradle.daemon.idletimeout=[Kill Gradle Daemon after # idle millis.]' \
+ '-Dorg.gradle.debug=[Set true to debug Gradle Client.]' \
+ '-Dorg.gradle.jvmargs=[Set JVM arguments.]' \
+ '-Dorg.gradle.java.home=[Set JDK home dir.]' \
+ '-Dorg.gradle.logging.level=[Set default Gradle log level.]:log level:(quiet warn lifecycle info debug)' \
+ '-Dorg.gradle.parallel=[Set true to enable parallel project builds.]:(true false)' \
+ '-Dorg.gradle.priority=[Set priority for Gradle worker processes.]:priority:(low normal)' \
+ '-Dorg.gradle.warning.mode=[Set types of warnings to log.]:warning level:(all summary none)' \
+ '-Dorg.gradle.workers.max=[Set the number of workers Gradle is allowed to use.]' \
+ '(-i --info -w --warn -q --quiet)'{-d,--debug}'[Log in debug mode (includes normal stacktrace).]' \
+ '(--no-daemon)--daemon[Uses the Gradle daemon to run the build. Starts the daemon if not running.]' \
+ '--foreground[Starts the Gradle daemon in the foreground.]' \
+ {-g,--gradle-user-home}'[Specifies the gradle user home directory.]:home directory:_directories:->argument-expected' \
+ '(-)--gui[Launches the Gradle GUI. (Removed in Gradle 4.0)]' \
+ \*--include-build'[Includes the specified build in the composite.]:file:_directories:->argument-expected' \
+ \*{-I,--init-script}'[Specifies an initialization script.]:init script:_files -g \*.gradle:->argument-expected' \
+ '(-d --debug -w --warn -q --quiet)'{-i,--info}'[Set log level to info.]' \
+ '--max-workers[Set the maximum number of concurrent workers that Gradle may use.]:number workers:->argument-expected' \
+ {-m,--dry-run}'[Runs the builds with all task actions disabled.]' \
+ '--no-color[Do not use color in the console output. (Removed in Gradle 3.0)]' \
+ '(--build-cache)--no-build-cache[Do not use the Gradle build cache.]' \
+ '(--configure-on-demand)--no-configure-on-demand[Disables configuration on demand.]' \
+ '(--daemon)--no-daemon[Do not use the Gradle daemon to run the build.]' \
+ '(--parallel)--no-parallel[Disables parallel execution to build projects.]' \
+ '(--scan)--no-scan[Do not create a build scan.]' \
+ '--offline[The build should operate without accessing network resources.]' \
+ \*{-P+,--project-prop}'[Set project property for the build script (e.g. -Pmyprop=myvalue).]:project property (prop=val):->argument-expected' \
+ {-p,--project-dir}'[Specifies the start directory for Gradle.]:start directory:_directories:->argument-expected' \
+ '(--no-parallel)--parallel[Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]' \
+ '--priority=[Set priority for Gradle worker processes.]:priority:(low normal)' \
+ '--profile[Profiles build execution time and generates a report in the <build_dir>/reports/profile directory.]' \
+ '--project-cache-dir=[Specifies the project-specific cache directory.]:cache directory:_directories:->argument-expected' \
+ '(-d --debug -w --warn -i --info)'{-q,--quiet}'[Log errors only.]' \
+ '--recompile-scripts[Force build script recompiling.]' \
+ '--refresh[Refresh the state of resources of the type(s) specified.]:refresh policy:(dependencies)' \
+ '--refresh-dependencies[Refresh the state of dependencies.]' \
+ '--rerun-tasks[Ignore previously cached task results.]' \
+ '(--no-scan)--scan[Create a build scan.]' \
+ '(-S --full-stacktrace)'{-s,--stacktrace}'[Print out the stacktrace for all exceptions.]' \
+ '(-s --stacktrace)'{-S,--full-stacktrace}'[Print out the full (very verbose) stacktrace for all exceptions.]' \
+ '(-)--status[Shows status of running and recently stopped Gradle Daemons.]' \
+ '(-)--stop[Stops all Gradle daemons.]' \
+ '--system-prop[system property (prop=val)]' \
+ {-t,--continuous}'[Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.]' \
+ {-u,--no-search-upward}"[Don't search in parent folders for a settings.gradle file.]" \
+ '(--write-locks)--update-locks[Perform a partial update of the dependency lock.]' \
+ '(-)'{-v,--version}'[Print version info.]' \
+ '(-d --debug -q --quiet -i --info)'{-w,--warn}'[Log warnings and errors only.]' \
+ '--warning-mode=[Set types of warnings to log.]:warning mode:(all summary none)' \
+ '(--update-locks)--write-locks[Persists dependency resolution for locked configurations.]' \
+ {-x,--exclude-task}'[Specify a task to be excluded from execution.]' \
+ '(-)*:: :->task-or-option' && ret=0
+
+ if [[ $words[CURRENT] != -* && $state != "argument-expected" ]]; then
+ __gradle_tasks && ret=0
+ else
+ curcontext=${curcontext%:*:*}:gradle-$words[1]:
+ __gradle_subcommand && ret=0
+ fi
+
+ return ret
+}
+
+_gradle "$@"
diff --git a/plugins/gradle/_gradlew b/plugins/gradle/_gradlew
deleted file mode 120000
index 80723f2fc..000000000
--- a/plugins/gradle/_gradlew
+++ /dev/null
@@ -1 +0,0 @@
-gradle.plugin.zsh \ No newline at end of file
diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh
index c651b91ca..5bca364d1 100644
--- a/plugins/gradle/gradle.plugin.zsh
+++ b/plugins/gradle/gradle.plugin.zsh
@@ -1,184 +1,26 @@
-##############################################################################
-# A descriptive listing of core Gradle commands
-############################################################################
-
-gradle-or-gradlew() {
- if [ -f ./gradlew ] ; then
- echo "executing gradlew instead of gradle";
- ./gradlew "$@";
- else
- command gradle "$@";
- fi
-}
-
-alias gradle=gradle-or-gradlew;
-
-function _gradle_core_commands() {
- local ret=1 state
- _arguments ':subcommand:->subcommand' && ret=0
-
- case $state in
- subcommand)
- subcommands=(
- "properties:Display all project properties"
- "tasks:Calculate and display all tasks"
- "dependencies:Calculate and display all dependencies"
- "projects:Discover and display all sub-projects"
- "build:Build the project"
- "help:Display help"
- )
- _describe -t subcommands 'gradle subcommands' subcommands && ret=0
- esac
-
- return ret
-}
-
-function _gradle_arguments() {
- _arguments -C \
- '-a[Do not rebuild project dependencies]' \
- '-b[Specifies the build file]' \
- '-c[Specifies the settings file]' \
- '-d[Log at the debug level]' \
- '-g[Specifies the Gradle user home directory]' \
- '-h[Shows a help message]' \
- '-i[Set log level to INFO]' \
- '-m[Runs the build with all task actions disabled]' \
- '-p[Specifies the start directory for Gradle]' \
- '-q[Log errors only]' \
- '-s[Print out the stacktrace also for user exceptions]' \
- '-t[Continuous mode. Automatically re-run build after changes]' \
- '-u[Don''t search in parent directories for a settings.gradle file]' \
- '-v[Prints Gradle version info]' \
- '-x[Specify a task to be excluded]' \
- '-D[Set a system property]' \
- '-I[Specifies an initialization script]' \
- '-P[Sets a project property of the root project]' \
- '-S[Print out the full (very verbose) stacktrace]' \
- '--build-file[Specifies the build file]' \
- '--configure-on-demand[Only relevant projects are configured]' \
- '--console[Type of console output to generate (plain, auto, or rich)]' \
- '--continue[Continues task execution after a task failure]' \
- '--continuous[Continuous mode. Automatically re-run build after changes]' \
- '--daemon[Use the Gradle Daemon]' \
- '--debug[Log at the debug level]' \
- '--dry-run[Runs the build with all task actions disabled]' \
- '--exclude-task[Specify a task to be excluded]' \
- '--full-stacktrace[Print out the full (very verbose) stacktrace]' \
- '--gradle-user-home[Specifies the Gradle user home directory]' \
- '--gui[Launches the Gradle GUI app (Deprecated)]' \
- '--help[Shows a help message]' \
- '--include-build[Run the build as a composite, including the specified build]' \
- '--info[Set log level to INFO]' \
- '--init-script[Specifies an initialization script]' \
- '--max-workers[Set the maximum number of workers that Gradle may use]' \
- '--no-daemon[Do not use the Gradle Daemon]' \
- '--no-rebuild[Do not rebuild project dependencies]' \
- '--no-search-upwards[Don''t search in parent directories for a settings.gradle file]' \
- '--offline[Build without accessing network resources]' \
- '--parallel[Build projects in parallel]' \
- '--profile[Profile build time and create report]' \
- '--project-cache-dir[Specifies the project-specific cache directory]' \
- '--project-dir[Specifies the start directory for Gradle]' \
- '--project-prop[Sets a project property of the root project]' \
- '--quiet[Log errors only]' \
- '--recompile-scripts[Forces scripts to be recompiled, bypassing caching]' \
- '--refresh-dependencies[Refresh the state of dependencies]' \
- '--rerun-task[Specifies that any task optimization is ignored]' \
- '--settings-file[Specifies the settings file]' \
- '--stacktrace[Print out the stacktrace also for user exceptions]' \
- '--status[Print Gradle Daemon status]' \
- '--stop[Stop all Gradle Daemons]' \
- '--system-prop[Set a system property]' \
- '--version[Prints Gradle version info]' \
- '*::command:->command' \
- && return 0
-}
-
-
-##############################################################################
-# Examine the build.gradle file to see if its timestamp has changed;
-# and if so, regenerate the .gradle_tasks cache file
-############################################################################
-_gradle_does_task_list_need_generating () {
- [[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache || build.gradle.kts -nt .gradletasknamecache ]]
-}
-
-##############
-# Parse the tasks from `gradle(w) tasks --all` and return them to the calling function.
-# All lines in the output from gradle(w) that are between /^-+$/ and /^\s*$/
-# are considered to be tasks. If and when gradle adds support for listing tasks
-# for programmatic parsing, this method can be deprecated.
-##############
-_gradle_parse_tasks () {
- lines_might_be_tasks=false
- task_name_buffer=""
- while read -r line; do
- if [[ $line =~ ^-+$ ]]; then
- lines_might_be_tasks=true
- # Empty buffer, because it contains items that are not tasks
- task_name_buffer=""
- elif [[ $line =~ ^\s*$ ]]; then
- if [[ "$lines_might_be_tasks" = true ]]; then
- # If a newline is found, echo the buffer to the calling function
- while read -r task; do
- echo $task | awk '/[a-zA-Z0-9:-]+/ {print $1}'
- done <<< "$task_name_buffer"
- # Empty buffer, because we are done with the tasks
- task_name_buffer=""
- fi
- lines_might_be_tasks=false
- elif [[ "$lines_might_be_tasks" = true ]]; then
- task_name_buffer="${task_name_buffer}\n${line}"
- fi
- done <<< "$1"
-}
-
-
-##############
-# Gradle tasks from subprojects are allowed to be executed without specifying
-# the subproject; that task will then be called on all subprojects.
-# gradle(w) tasks --all only lists tasks per subproject, but when autocompleting
-# we often want to be able to run a specific task on all subprojects, e.g.
-# "gradle clean".
-# This function uses the list of tasks from "gradle tasks --all", and for each
-# line grabs everything after the last ":" and combines that output with the original
-# output. The combined list is returned as the result of this function.
-##############
-_gradle_parse_and_extract_tasks () {
- # All tasks
- tasks=$(_gradle_parse_tasks "$1")
- # Task name without sub project(s) prefix
- simple_tasks=$(echo $tasks | awk 'BEGIN { FS = ":" } { print $NF }')
- echo "$tasks\n$simple_tasks"
-}
-
-##############################################################################
-# Discover the gradle tasks by running "gradle tasks --all"
-############################################################################
-_gradle_tasks () {
- if [[ -f build.gradle || -f build.gradle.kts || -f settings.gradle || -f settings.gradle.kts ]]; then
- _gradle_arguments
- if _gradle_does_task_list_need_generating; then
- _gradle_parse_and_extract_tasks "$(gradle tasks --all)" > .gradletasknamecache
- fi
- compadd -X "==== Gradle Tasks ====" $(cat .gradletasknamecache)
- fi
-}
-
-_gradlew_tasks () {
- if [[ -f build.gradle || -f build.gradle.kts || -f settings.gradle || -f settings.gradle.kts ]]; then
- _gradle_arguments
- if _gradle_does_task_list_need_generating; then
- _gradle_parse_and_extract_tasks "$(./gradlew tasks --all)" > .gradletasknamecache
+# Looks for a gradlew file in the current working directory
+# or any of its parent directories, and executes it if found.
+# Otherwise it will call gradle directly.
+function gradle-or-gradlew() {
+ # find project root
+ # taken from https://github.com/gradle/gradle-completion
+ local dir="$PWD" project_root="$PWD"
+ while [[ "$dir" != / ]]; do
+ if [[ -f "$dir/settings.gradle" || -f "$dir/settings.gradle.kts" || -f "$dir/gradlew" ]]; then
+ project_root="$dir"
+ break
fi
- compadd -X "==== Gradlew Tasks ====" $(cat .gradletasknamecache)
+ dir="${dir:h}"
+ done
+
+ # if gradlew found, run it instead of gradle
+ if [[ -f "$project_root/gradlew" ]]; then
+ echo "executing gradlew instead of gradle"
+ "$project_root/gradlew" "$@"
+ else
+ command gradle "$@"
fi
}
-
-##############################################################################
-# Register the completions against the gradle and gradlew commands
-############################################################################
-compdef _gradle_tasks gradle
-compdef _gradlew_tasks gradlew
-compdef _gradlew_tasks gw
+alias gradle=gradle-or-gradlew
+compdef _gradle gradle-or-gradlew
diff --git a/plugins/grails/README.md b/plugins/grails/README.md
index 64b4a9f07..5d9ebd77d 100644
--- a/plugins/grails/README.md
+++ b/plugins/grails/README.md
@@ -14,58 +14,3 @@ It looks for scripts in the following paths:
- `~/.grails/scripts`
- `./scripts`
- `./plugins/*/scripts`
-
-## Grails Commands
-- `add-proxy`
-- `alias`
-- `bootstrap`
-- `bug-report`
-- `clean`
-- `clean-all`
-- `clear-proxy`
-- `compile`
-- `console`
-- `create-app`
-- `create-controller`
-- `create-domain-class`
-- `create-filters`
-- `create-integration-test`
-- `create-multi-project-build`
-- `create-plugin`
-- `create-pom`
-- `create-script`
-- `create-service`
-- `create-tag-lib`
-- `create-unit-test`
-- `dependency-report`
-- `doc`
-- `help`
-- `init`
-- `install-app-templates`
-- `install-dependency`
-- `install-plugin`
-- `install-templates`
-- `integrate-with`
-- `interactive`
-- `list-plugin-updates`
-- `list-plugins`
-- `migrate-docs`
-- `package`
-- `package-plugin`
-- `plugin-info`
-- `refresh-dependencies`
-- `remove-proxy`
-- `run-app`
-- `run-script`
-- `run-war`
-- `set-grails-version`
-- `set-proxy`
-- `set-version`
-- `shell`
-- `stats`
-- `stop-app`
-- `test-app`
-- `uninstall-plugin`
-- `url-mappings-report`
-- `war`
-- `wrapper`
diff --git a/plugins/history-substring-search/README.md b/plugins/history-substring-search/README.md
index 0ffb21351..6d8b56425 100644
--- a/plugins/history-substring-search/README.md
+++ b/plugins/history-substring-search/README.md
@@ -1,25 +1,44 @@
-zsh-history-substring-search
-==============================================================================
+# zsh-history-substring-search
This is a clean-room implementation of the [Fish shell][1]'s history search
-feature, where you can type in any part of any previously entered command
-and press the UP and DOWN arrow keys to cycle through the matching commands.
-You can also use K and J in VI mode or ^P and ^N in EMACS mode for the same.
-
-[1]: https://fishshell.com
-[2]: https://www.zsh.org/mla/users/2009/msg00818.html
-[3]: https://sourceforge.net/projects/fizsh/
-[4]: https://github.com/ohmyzsh/ohmyzsh/pull/215
+feature, where you can type in any part of any command from history and then
+press chosen keys, such as the UP and DOWN arrows, to cycle through matches.
+
+[1]: http://fishshell.com
+[2]: http://www.zsh.org/mla/users/2009/msg00818.html
+[3]: http://sourceforge.net/projects/fizsh/
+[4]: https://github.com/robbyrussell/oh-my-zsh/pull/215
[5]: https://github.com/zsh-users/zsh-history-substring-search
[6]: https://github.com/zsh-users/zsh-syntax-highlighting
-------------------------------------------------------------------------------
+
Requirements
------------------------------------------------------------------------------
* [ZSH](http://zsh.sourceforge.net) 4.3 or newer
+Install
------------------------------------------------------------------------------
+
+Using the [Homebrew]( https://brew.sh ) package manager:
+
+ brew install zsh-history-substring-search
+ echo 'source /usr/local/share/zsh-history-substring-search/zsh-history-substring-search.zsh' >> ~/.zshrc
+
+Using [Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh):
+
+1. Clone this repository in oh-my-zsh's plugins directory:
+
+ git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
+
+2. Activate the plugin in `~/.zshrc`:
+
+ plugins=( [plugins...] history-substring-search)
+
+3. Source `~/.zshrc` to take changes into account:
+
+ source ~/.zshrc
+
Usage
------------------------------------------------------------------------------
@@ -33,117 +52,147 @@ Usage
% source zsh-syntax-highlighting.zsh
% source zsh-history-substring-search.zsh
-2. Bind keyboard shortcuts to this script's functions:
+2. Bind keyboard shortcuts to this script's functions.
+
+ Users typically bind their UP and DOWN arrow keys to this script, thus:
+ * Run `cat -v` in your favorite terminal emulator to observe key codes.
+      (**NOTE:** In some cases, `cat -v` shows the wrong key codes. If the
+ key codes shown by `cat -v` don't work for you, press `<C-v><UP>` and
+ `<C-v><DOWN>` at your ZSH command line prompt for correct key codes.)
+ * Press the UP arrow key and observe what is printed in your terminal.
+ * Press the DOWN arrow key and observe what is printed in your terminal.
+ * Press the Control and C keys simultaneously to terminate the `cat -v`.
+ * Use your observations from the previous steps to create key bindings.
+ For example, if you observed `^[[A` for UP and `^[[B` for DOWN, then:
+
+ bindkey '^[[A' history-substring-search-up
+ bindkey '^[[B' history-substring-search-down
- # bind UP and DOWN arrow keys
- zmodload zsh/terminfo
- bindkey "$terminfo[kcuu1]" history-substring-search-up
- bindkey "$terminfo[kcud1]" history-substring-search-down
+ However, if the observed values don't work, you can try using terminfo:
- # bind UP and DOWN arrow keys (compatibility fallback
- # for Ubuntu 12.04, Fedora 21, and MacOSX 10.9 users)
- bindkey '^[[A' history-substring-search-up
- bindkey '^[[B' history-substring-search-down
+ bindkey "$terminfo[kcuu1]" history-substring-search-up
+ bindkey "$terminfo[kcud1]" history-substring-search-down
- # bind P and N for EMACS mode
- bindkey -M emacs '^P' history-substring-search-up
- bindkey -M emacs '^N' history-substring-search-down
+ You might also want to bind the Control-P/N keys for use in EMACS mode:
- # bind k and j for VI mode
- bindkey -M vicmd 'k' history-substring-search-up
- bindkey -M vicmd 'j' history-substring-search-down
+ bindkey -M emacs '^P' history-substring-search-up
+ bindkey -M emacs '^N' history-substring-search-down
+
+ You might also want to bind the `k` and `j` keys for use in VI mode:
+
+ bindkey -M vicmd 'k' history-substring-search-up
+ bindkey -M vicmd 'j' history-substring-search-down
3. Type any part of any previous command and then:
- * Press the UP arrow key to select the nearest command that (1) contains
- your query and (2) is older than the current command in the command
- history.
+ * Press the `history-substring-search-up` key, which was configured in
+ step 2 above, to select the nearest command that (1) contains your query
+ and (2) is also older than the current command in your command history.
- * Press the DOWN arrow key to select the nearest command that (1)
- contains your query and (2) is newer than the current command in the
- command history.
+ * Press the `history-substring-search-down` key, which was configured in
+ step 2 above, to select the nearest command that (1) contains your query
+ and (2) is also newer than the current command in your command history.
- * Press ^U (the Control and U keys simultaneously) to abort the search.
+ * Press `^U` the Control and U keys simultaneously to abort the search.
4. If a matching command spans more than one line of text, press the LEFT
arrow key to move the cursor away from the end of the command, and then:
- * Press the UP arrow key to move the cursor to the line above. When the
- cursor reaches the first line of the command, pressing the UP arrow
- key again will cause this script to perform another search.
+ * Press the `history-substring-search-up` key, which was configured in
+ step 2 above, to move the cursor to the line above the cursored line.
+ When the cursor reaches the first line of the command, pressing the
+ `history-substring-search-up` key again will cause this script to
+ perform another search.
+
+ * Press the `history-substring-search-down` key, which was configured in
+ step 2 above, to move the cursor to the line below the cursored line.
+ When the cursor reaches the last line of the command, pressing the
+ `history-substring-search-down` key, which was configured in step 2
+ above, again will cause this script to perform another search.
- * Press the DOWN arrow key to move the cursor to the line below. When
- the cursor reaches the last line of the command, pressing the DOWN
- arrow key again will cause this script to perform another search.
-------------------------------------------------------------------------------
Configuration
------------------------------------------------------------------------------
This script defines the following global variables. You may override their
default values only after having loaded this script into your ZSH session.
-* HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND is a global variable that defines
+* `HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND` is a global variable that defines
how the query should be highlighted inside a matching command. Its default
value causes this script to highlight using bold, white text on a magenta
background. See the "Character Highlighting" section in the zshzle(1) man
page to learn about the kinds of values you may assign to this variable.
-* HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND is a global variable that
+* `HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND` is a global variable that
defines how the query should be highlighted when no commands in the
history match it. Its default value causes this script to highlight using
bold, white text on a red background. See the "Character Highlighting"
section in the zshzle(1) man page to learn about the kinds of values you
may assign to this variable.
-* HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS is a global variable that defines
+* `HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS` is a global variable that defines
how the command history will be searched for your query. Its default value
causes this script to perform a case-insensitive search. See the "Globbing
Flags" section in the zshexpn(1) man page to learn about the kinds of
values you may assign to this variable.
-To always receive _unique_ search results, use `setopt HIST_IGNORE_ALL_DUPS`.
-Alternatively, use `setopt HIST_FIND_NO_DUPS` which makes this plugin skip
-duplicate _adjacent_ search results as you cycle through them---however, this
-does not guarantee that search results are unique: if your search results were
-"Dog", "Dog", "HotDog", "Dog", then cycling them gives "Dog", "HotDog", "Dog".
-Notice that the "Dog" search result appeared twice as you cycled through them!
-If you wish to avoid this limitation, then use `setopt HIST_IGNORE_ALL_DUPS`.
+* `HISTORY_SUBSTRING_SEARCH_FUZZY` is a global variable that defines
+ how the command history will be searched for your query. If set to a non-empty
+ value, causes this script to perform a fuzzy search by words, matching in
+ given order e.g. `ab c` will match `*ab*c*`
+
+* `HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE` is a global variable that defines
+ whether all search results returned are _unique_. If set to a non-empty
+ value, then only unique search results are presented. This behaviour is off
+ by default. An alternative way to ensure that search results are unique is
+ to use `setopt HIST_IGNORE_ALL_DUPS`. If this configuration variable is off
+ and `setopt HIST_IGNORE_ALL_DUPS` is unset, then `setopt HIST_FIND_NO_DUPS`
+ is still respected and it makes this script skip duplicate _adjacent_ search
+ results as you cycle through them, but this does not guarantee that search
+ results are unique: if your search results were "Dog", "Dog", "HotDog",
+ "Dog", then cycling them gives "Dog", "HotDog", "Dog". Notice that the "Dog"
+ search result appeared twice as you cycled through them. If you wish to
+ receive globally unique search results only once, then use this
+ configuration variable, or use `setopt HIST_IGNORE_ALL_DUPS`.
+
-------------------------------------------------------------------------------
History
------------------------------------------------------------------------------
-This script was originally written by [Peter Stephenson][2], who published it
-to the ZSH users mailing list (thereby making it public domain) in September
-2009. It was later revised by Guido van Steen and released under the BSD
-license (see below) as part of [the fizsh project][3] in January 2011.
+* September 2009: [Peter Stephenson][2] originally wrote this script and it
+ published to the zsh-users mailing list.
+
+* January 2011: Guido van Steen (@guidovansteen) revised this script and
+ released it under the 3-clause BSD license as part of [fizsh][3], the
+ Friendly Interactive ZSHell.
+
+* January 2011: Suraj N. Kurapati (@sunaku) extracted this script from
+ [fizsh][3] 1.0.1, refactored it heavily, and finally repackaged it as an
+ [oh-my-zsh plugin][4] and as an independently loadable [ZSH script][5].
-It was later extracted from fizsh release 1.0.1, refactored heavily, and
-repackaged as both an [oh-my-zsh plugin][4] and as an independently loadable
-[ZSH script][5] by Suraj N. Kurapati in 2011.
+* July 2011: Guido van Steen, Suraj N. Kurapati, and Sorin Ionescu
+ (@sorin-ionescu) [further developed it][4] with Vincent Guerci (@vguerci).
-It was [further developed][4] by Guido van Steen, Suraj N. Kurapati, Sorin
-Ionescu, and Vincent Guerci in 2011.
+* March 2016: Geza Lore (@gezalore) greatly refactored it in pull request #55.
------------------------------------------------------------------------------
Oh My Zsh Distribution Notes
------------------------------------------------------------------------------
-What you are looking at now is Oh My Zsh's repackaging of zsh-history-substring-search
+What you are looking at now is Oh My Zsh's repackaging of zsh-history-substring-search
as an OMZ module inside the Oh My Zsh distribution.
-The upstream repo, zsh-users/zsh-history-substring-search, can be found on GitHub at
+The upstream repo, zsh-users/zsh-history-substring-search, can be found on GitHub at
https://github.com/zsh-users/zsh-history-substring-search.
This downstream copy was last updated from the following upstream commit:
- SHA: 2c295432175990c1bb4e90bc13f609daa67a25d6
- Commit date: 2015-09-28 10:47:34 -0700
+ SHA: 0f80b8eb3368b46e5e573c1d91ae69eb095db3fb
+ Commit date: 2019-05-12 17:35:54 -0700
Everything above this section is a copy of the original upstream's README, so things
may differ slightly when you're using this inside OMZ. In particular, you do not
-need to set up key bindings for the up and down arrows yourself in `~/.zshrc`; the OMZ
+need to set up key bindings for the up and down arrows yourself in `~/.zshrc`; the OMZ
plugin does that for you. You may still want to set up additional emacs- or vi-specific
bindings as mentioned above.
diff --git a/plugins/history-substring-search/history-substring-search.plugin.zsh b/plugins/history-substring-search/history-substring-search.plugin.zsh
index 7883a65f3..d2c749bc3 100644
--- a/plugins/history-substring-search/history-substring-search.plugin.zsh
+++ b/plugins/history-substring-search/history-substring-search.plugin.zsh
@@ -1,20 +1,9 @@
-# This file integrates the zsh-history-substring-search script into oh-my-zsh.
-
-source "${0:r:r}.zsh"
-
-if test "$CASE_SENSITIVE" = true; then
- unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS
-fi
-
-if test "$DISABLE_COLOR" = true; then
- unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
- unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
-fi
+0=${(%):-%N}
+source ${0:A:h}/history-substring-search.zsh
# Bind terminal-specific up and down keys
-# Bind in both emacs and vi modes so it works in both, and is not
-# sensitive to whether this is loaded before or after the vi-mode plugin
+
if [[ -n "$terminfo[kcuu1]" ]]; then
bindkey -M emacs "$terminfo[kcuu1]" history-substring-search-up
bindkey -M viins "$terminfo[kcuu1]" history-substring-search-up
diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh
index 3b8afd317..a791cc4da 100644
--- a/plugins/history-substring-search/history-substring-search.zsh
+++ b/plugins/history-substring-search/history-substring-search.zsh
@@ -6,6 +6,8 @@
# Copyright (c) 2011 Suraj N. Kurapati
# Copyright (c) 2011 Sorin Ionescu
# Copyright (c) 2011 Vincent Guerci
+# Copyright (c) 2016 Geza Lore
+# Copyright (c) 2017 Bengt Brodersen
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -38,12 +40,30 @@
##############################################################################
#-----------------------------------------------------------------------------
-# configuration variables
+# declare global configuration variables
#-----------------------------------------------------------------------------
-HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold'
-HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'
-HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'
+typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold'
+typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'
+typeset -g HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'
+typeset -g HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=''
+typeset -g HISTORY_SUBSTRING_SEARCH_FUZZY=''
+
+#-----------------------------------------------------------------------------
+# declare internal global variables
+#-----------------------------------------------------------------------------
+
+typeset -g BUFFER MATCH MBEGIN MEND CURSOR
+typeset -g _history_substring_search_refresh_display
+typeset -g _history_substring_search_query_highlight
+typeset -g _history_substring_search_result
+typeset -g _history_substring_search_query
+typeset -g -a _history_substring_search_query_parts
+typeset -g -a _history_substring_search_raw_matches
+typeset -g -i _history_substring_search_raw_match_index
+typeset -g -a _history_substring_search_matches
+typeset -g -i _history_substring_search_match_index
+typeset -g -A _history_substring_search_unique_filter
#-----------------------------------------------------------------------------
# the main ZLE widgets
@@ -180,62 +200,104 @@ _history-substring-search-begin() {
_history_substring_search_query_highlight=
#
- # Continue using the previous $_history_substring_search_result by default,
- # unless the current query was cleared or a new/different query was entered.
+ # If the buffer is the same as the previously displayed history substring
+ # search result, then just keep stepping through the match list. Otherwise
+ # start a new search.
#
- if [[ -z $BUFFER || $BUFFER != $_history_substring_search_result ]]; then
- #
- # For the purpose of highlighting we will also keep
- # a version without doubly-escaped meta characters.
- #
- _history_substring_search_query=$BUFFER
+ if [[ -n $BUFFER && $BUFFER == ${_history_substring_search_result:-} ]]; then
+ return;
+ fi
+ #
+ # Clear the previous result.
+ #
+ _history_substring_search_result=''
+
+ if [[ -z $BUFFER ]]; then
#
- # $BUFFER contains the text that is in the command-line currently.
- # we put an extra "\\" before meta characters such as "\(" and "\)",
- # so that they become "\\\(" and "\\\)".
+ # If the buffer is empty, we will just act like up-history/down-history
+ # in ZSH, so we do not need to actually search the history. This should
+ # speed things up a little.
#
- _history_substring_search_query_escaped=${BUFFER//(#m)[\][()|\\*?#<>~^]/\\$MATCH}
+ _history_substring_search_query=
+ _history_substring_search_query_parts=()
+ _history_substring_search_raw_matches=()
+ else
#
- # Find all occurrences of the search query in the history file.
- #
- # (k) returns the "keys" (history index numbers) instead of the values
- # (Oa) reverses the order, because (R) returns results reversed.
+ # For the purpose of highlighting we keep a copy of the original
+ # query string.
#
- _history_substring_search_matches=(${(kOa)history[(R)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)*${_history_substring_search_query_escaped}*]})
+ _history_substring_search_query=$BUFFER
#
- # Define the range of values that $_history_substring_search_match_index
- # can take: [0, $_history_substring_search_matches_count_plus].
+ # compose search pattern
#
- _history_substring_search_matches_count=$#_history_substring_search_matches
- _history_substring_search_matches_count_plus=$(( _history_substring_search_matches_count + 1 ))
- _history_substring_search_matches_count_sans=$(( _history_substring_search_matches_count - 1 ))
+ if [[ -n $HISTORY_SUBSTRING_SEARCH_FUZZY ]]; then
+ #
+ # `=` split string in arguments
+ #
+ _history_substring_search_query_parts=(${=_history_substring_search_query})
+ else
+ _history_substring_search_query_parts=(${==_history_substring_search_query})
+ fi
#
- # If $_history_substring_search_match_index is equal to
- # $_history_substring_search_matches_count_plus, this indicates that we
- # are beyond the beginning of $_history_substring_search_matches.
+ # Escape and join query parts with wildcard character '*' as seperator
+ # `(j:CHAR:)` join array to string with CHAR as seperator
#
- # If $_history_substring_search_match_index is equal to 0, this indicates
- # that we are beyond the end of $_history_substring_search_matches.
+ local search_pattern="*${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*"
+
#
- # If we have initially pressed "up" we have to initialize
- # $_history_substring_search_match_index to
- # $_history_substring_search_matches_count_plus so that it will be
- # decreased to $_history_substring_search_matches_count.
+ # Find all occurrences of the search pattern in the history file.
#
- # If we have initially pressed "down" we have to initialize
- # $_history_substring_search_match_index to
- # $_history_substring_search_matches_count so that it will be increased to
- # $_history_substring_search_matches_count_plus.
+ # (k) returns the "keys" (history index numbers) instead of the values
+ # (R) returns values in reverse older, so the index of the youngest
+ # matching history entry is at the head of the list.
#
- if [[ $WIDGET == history-substring-search-down ]]; then
- _history_substring_search_match_index=$_history_substring_search_matches_count
- else
- _history_substring_search_match_index=$_history_substring_search_matches_count_plus
- fi
+ _history_substring_search_raw_matches=(${(k)history[(R)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)${search_pattern}]})
+ fi
+
+ #
+ # In order to stay as responsive as possible, we will process the raw
+ # matches lazily (when the user requests the next match) to choose items
+ # that need to be displayed to the user.
+ # _history_substring_search_raw_match_index holds the index of the last
+ # unprocessed entry in _history_substring_search_raw_matches. Any items
+ # that need to be displayed will be added to
+ # _history_substring_search_matches.
+ #
+ # We use an associative array (_history_substring_search_unique_filter) as
+ # a 'set' data structure to ensure uniqueness of the results if desired.
+ # If an entry (key) is in the set (non-empty value), then we have already
+ # added that entry to _history_substring_search_matches.
+ #
+ _history_substring_search_raw_match_index=0
+ _history_substring_search_matches=()
+ _history_substring_search_unique_filter=()
+
+ #
+ # If $_history_substring_search_match_index is equal to
+ # $#_history_substring_search_matches + 1, this indicates that we
+ # are beyond the end of $_history_substring_search_matches and that we
+ # have also processed all entries in
+ # _history_substring_search_raw_matches.
+ #
+ # If $#_history_substring_search_match_index is equal to 0, this indicates
+ # that we are beyond the beginning of $_history_substring_search_matches.
+ #
+ # If we have initially pressed "up" we have to initialize
+ # $_history_substring_search_match_index to 0 so that it will be
+ # incremented to 1.
+ #
+ # If we have initially pressed "down" we have to initialize
+ # $_history_substring_search_match_index to 1 so that it will be
+ # decremented to 0.
+ #
+ if [[ $WIDGET == history-substring-search-down ]]; then
+ _history_substring_search_match_index=1
+ else
+ _history_substring_search_match_index=0
fi
}
@@ -255,16 +317,21 @@ _history-substring-search-end() {
_zsh_highlight
# highlight the search query inside the command line
- if [[ -n $_history_substring_search_query_highlight && -n $_history_substring_search_query ]]; then
- #
- # The following expression yields a variable $MBEGIN, which
- # indicates the begin position + 1 of the first occurrence
- # of _history_substring_search_query_escaped in $BUFFER.
- #
- : ${(S)BUFFER##(#m$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)($_history_substring_search_query##)}
- local begin=$(( MBEGIN - 1 ))
- local end=$(( begin + $#_history_substring_search_query ))
- region_highlight+=("$begin $end $_history_substring_search_query_highlight")
+ if [[ -n $_history_substring_search_query_highlight ]]; then
+ # highlight first matching query parts
+ local highlight_start_index=0
+ local highlight_end_index=0
+ local query_part
+ for query_part in $_history_substring_search_query_parts; do
+ local escaped_query_part=${query_part//(#m)[\][()|\\*?#<>~^]/\\$MATCH}
+ # (i) get index of pattern
+ local query_part_match_index="${${BUFFER:$highlight_start_index}[(i)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)${escaped_query_part}]}"
+ if [[ $query_part_match_index -le ${#BUFFER:$highlight_start_index} ]]; then
+ highlight_start_index=$(( $highlight_start_index + $query_part_match_index ))
+ highlight_end_index=$(( $highlight_start_index + ${#query_part} ))
+ region_highlight+=("$(($highlight_start_index - 1)) $(($highlight_end_index - 1)) $_history_substring_search_query_highlight")
+ fi
+ done
fi
# For debugging purposes:
@@ -378,12 +445,143 @@ _history-substring-search-down-history() {
return 1
}
+_history_substring_search_process_raw_matches() {
+ #
+ # Process more outstanding raw matches and append any matches that need to
+ # be displayed to the user to _history_substring_search_matches.
+ # Return whether there were any more results appended.
+ #
+
+ #
+ # While we have more raw matches. Process them to see if there are any more
+ # matches that need to be displayed to the user.
+ #
+ while [[ $_history_substring_search_raw_match_index -lt $#_history_substring_search_raw_matches ]]; do
+ #
+ # Move on to the next raw entry and get its history index.
+ #
+ _history_substring_search_raw_match_index+=1
+ local index=${_history_substring_search_raw_matches[$_history_substring_search_raw_match_index]}
+
+ #
+ # If HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE is set to a non-empty value,
+ # then ensure that only unique matches are presented to the user.
+ # When HIST_IGNORE_ALL_DUPS is set, ZSH already ensures a unique history,
+ # so in this case we do not need to do anything.
+ #
+ if [[ ! -o HIST_IGNORE_ALL_DUPS && -n $HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE ]]; then
+ #
+ # Get the actual history entry at the new index, and check if we have
+ # already added it to _history_substring_search_matches.
+ #
+ local entry=${history[$index]}
+
+ if [[ -z ${_history_substring_search_unique_filter[$entry]} ]]; then
+ #
+ # This is a new unique entry. Add it to the filter and append the
+ # index to _history_substring_search_matches.
+ #
+ _history_substring_search_unique_filter[$entry]=1
+ _history_substring_search_matches+=($index)
+
+ #
+ # Indicate that we did find a match.
+ #
+ return 0
+ fi
+
+ else
+ #
+ # Just append the new history index to the processed matches.
+ #
+ _history_substring_search_matches+=($index)
+
+ #
+ # Indicate that we did find a match.
+ #
+ return 0
+ fi
+
+ done
+
+ #
+ # We are beyond the end of the list of raw matches. Indicate that no
+ # more matches are available.
+ #
+ return 1
+}
+
+_history-substring-search-has-next() {
+ #
+ # Predicate function that returns whether any more older matches are
+ # available.
+ #
+
+ if [[ $_history_substring_search_match_index -lt $#_history_substring_search_matches ]]; then
+ #
+ # We did not reach the end of the processed list, so we do have further
+ # matches.
+ #
+ return 0
+
+ else
+ #
+ # We are at the end of the processed list. Try to process further
+ # unprocessed matches. _history_substring_search_process_raw_matches
+ # returns whether any more matches were available, so just return
+ # that result.
+ #
+ _history_substring_search_process_raw_matches
+ return $?
+ fi
+}
+
+_history-substring-search-has-prev() {
+ #
+ # Predicate function that returns whether any more younger matches are
+ # available.
+ #
+
+ if [[ $_history_substring_search_match_index -gt 1 ]]; then
+ #
+ # We did not reach the beginning of the processed list, so we do have
+ # further matches.
+ #
+ return 0
+
+ else
+ #
+ # We are at the beginning of the processed list. We do not have any more
+ # matches.
+ #
+ return 1
+ fi
+}
+
+_history-substring-search-found() {
+ #
+ # A match is available. The index of the match is held in
+ # $_history_substring_search_match_index
+ #
+ # 1. Make $BUFFER equal to the matching history entry.
+ #
+ # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
+ # to highlight the current buffer.
+ #
+ BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]]
+ _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
+}
+
_history-substring-search-not-found() {
#
- # Nothing matched the search query, so put it back into the $BUFFER while
- # highlighting it accordingly so the user can revise it and search again.
+ # No more matches are available.
+ #
+ # 1. Make $BUFFER equal to $_history_substring_search_query so the user can
+ # revise it and search again.
+ #
+ # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
+ # to highlight the current buffer.
#
- _history_substring_search_old_buffer=$BUFFER
BUFFER=$_history_substring_search_query
_history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
}
@@ -392,91 +590,84 @@ _history-substring-search-up-search() {
_history_substring_search_refresh_display=1
#
- # Highlight matches during history-substring-up-search:
+ # Select history entry during history-substring-down-search:
#
- # The following constants have been initialized in
+ # The following variables have been initialized in
# _history-substring-search-up/down-search():
#
- # $_history_substring_search_matches is the current list of matches
- # $_history_substring_search_matches_count is the current number of matches
- # $_history_substring_search_matches_count_plus is the current number of matches + 1
- # $_history_substring_search_matches_count_sans is the current number of matches - 1
+ # $_history_substring_search_matches is the current list of matches that
+ # need to be displayed to the user.
# $_history_substring_search_match_index is the index of the current match
+ # that is being displayed to the user.
#
# The range of values that $_history_substring_search_match_index can take
- # is: [0, $_history_substring_search_matches_count_plus]. A value of 0
- # indicates that we are beyond the end of
+ # is: [0, $#_history_substring_search_matches + 1]. A value of 0
+ # indicates that we are beyond the beginning of
# $_history_substring_search_matches. A value of
- # $_history_substring_search_matches_count_plus indicates that we are beyond
- # the beginning of $_history_substring_search_matches.
+ # $#_history_substring_search_matches + 1 indicates that we are beyond
+ # the end of $_history_substring_search_matches and that we have also
+ # processed all entries in _history_substring_search_raw_matches.
+ #
+ # If $_history_substring_search_match_index equals
+ # $#_history_substring_search_matches and
+ # $_history_substring_search_raw_match_index is not greater than
+ # $#_history_substring_search_raw_matches, then we need to further process
+ # $_history_substring_search_raw_matches to see if there are any more
+ # entries that need to be displayed to the user.
#
# In _history-substring-search-up-search() the initial value of
- # $_history_substring_search_match_index is
- # $_history_substring_search_matches_count_plus. This value is set in
- # _history-substring-search-begin(). _history-substring-search-up-search()
- # will initially decrease it to $_history_substring_search_matches_count.
+ # $_history_substring_search_match_index is 0. This value is set in
+ # _history-substring-search-begin(). _history-substring-search-up-search()
+ # will initially increment it to 1.
#
- if [[ $_history_substring_search_match_index -ge 2 ]]; then
- #
- # Highlight the next match:
- #
- # 1. Decrease the value of $_history_substring_search_match_index.
- #
- # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
- # to highlight the current buffer.
- #
- (( _history_substring_search_match_index-- ))
- BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]]
- _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
- elif [[ $_history_substring_search_match_index -eq 1 ]]; then
- #
- # We will move beyond the end of $_history_substring_search_matches:
- #
- # 1. Decrease the value of $_history_substring_search_match_index.
- #
- # 2. Save the current buffer in $_history_substring_search_old_buffer,
- # so that it can be retrieved by
- # _history-substring-search-down-search() later.
+ if [[ $_history_substring_search_match_index -gt $#_history_substring_search_matches ]]; then
#
- # 3. Make $BUFFER equal to $_history_substring_search_query.
+ # We are beyond the end of $_history_substring_search_matches. This
+ # can only happen if we have also exhausted the unprocessed matches in
+ # _history_substring_search_raw_matches.
#
- # 4. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
- # to highlight the current buffer.
+ # 1. Update display to indicate search not found.
#
- (( _history_substring_search_match_index-- ))
_history-substring-search-not-found
+ return
+ fi
- elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count_plus ]]; then
- #
- # We were beyond the beginning of $_history_substring_search_matches but
- # UP makes us move back to $_history_substring_search_matches:
- #
- # 1. Decrease the value of $_history_substring_search_match_index.
+ if _history-substring-search-has-next; then
#
- # 2. Restore $BUFFER from $_history_substring_search_old_buffer.
+ # We do have older matches.
#
- # 3. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
- # to highlight the current buffer.
+ # 1. Move index to point to the next match.
+ # 2. Update display to indicate search found.
#
- (( _history_substring_search_match_index-- ))
- BUFFER=$_history_substring_search_old_buffer
- _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
+ _history_substring_search_match_index+=1
+ _history-substring-search-found
else
#
- # We are at the beginning of history and there are no further matches.
+ # We do not have older matches.
#
+ # 1. Move the index beyond the end of
+ # _history_substring_search_matches.
+ # 2. Update display to indicate search not found.
+ #
+ _history_substring_search_match_index+=1
_history-substring-search-not-found
- return
fi
#
# When HIST_FIND_NO_DUPS is set, meaning that only unique command lines from
# history should be matched, make sure the new and old results are different.
- # But when HIST_IGNORE_ALL_DUPS is set, ZSH already ensures a unique history.
#
- if [[ ! -o HIST_IGNORE_ALL_DUPS && -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then
+ # However, if the HIST_IGNORE_ALL_DUPS shell option, or
+ # HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE is set, then we already have a
+ # unique history, so in this case we do not need to do anything.
+ #
+ if [[ -o HIST_IGNORE_ALL_DUPS || -n $HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE ]]; then
+ return
+ fi
+
+ if [[ -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then
#
# Repeat the current search so that a different (unique) match is found.
#
@@ -488,92 +679,75 @@ _history-substring-search-down-search() {
_history_substring_search_refresh_display=1
#
- # Highlight matches during history-substring-up-search:
+ # Select history entry during history-substring-down-search:
#
- # The following constants have been initialized in
+ # The following variables have been initialized in
# _history-substring-search-up/down-search():
#
- # $_history_substring_search_matches is the current list of matches
- # $_history_substring_search_matches_count is the current number of matches
- # $_history_substring_search_matches_count_plus is the current number of matches + 1
- # $_history_substring_search_matches_count_sans is the current number of matches - 1
+ # $_history_substring_search_matches is the current list of matches that
+ # need to be displayed to the user.
# $_history_substring_search_match_index is the index of the current match
+ # that is being displayed to the user.
#
# The range of values that $_history_substring_search_match_index can take
- # is: [0, $_history_substring_search_matches_count_plus]. A value of 0
- # indicates that we are beyond the end of
+ # is: [0, $#_history_substring_search_matches + 1]. A value of 0
+ # indicates that we are beyond the beginning of
# $_history_substring_search_matches. A value of
- # $_history_substring_search_matches_count_plus indicates that we are beyond
- # the beginning of $_history_substring_search_matches.
+ # $#_history_substring_search_matches + 1 indicates that we are beyond
+ # the end of $_history_substring_search_matches and that we have also
+ # processed all entries in _history_substring_search_raw_matches.
#
# In _history-substring-search-down-search() the initial value of
- # $_history_substring_search_match_index is
- # $_history_substring_search_matches_count. This value is set in
- # _history-substring-search-begin().
- # _history-substring-search-down-search() will initially increase it to
- # $_history_substring_search_matches_count_plus.
+ # $_history_substring_search_match_index is 1. This value is set in
+ # _history-substring-search-begin(). _history-substring-search-down-search()
+ # will initially decrement it to 0.
#
- if [[ $_history_substring_search_match_index -le $_history_substring_search_matches_count_sans ]]; then
- #
- # Highlight the next match:
- #
- # 1. Increase $_history_substring_search_match_index by 1.
- #
- # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
- # to highlight the current buffer.
- #
- (( _history_substring_search_match_index++ ))
- BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]]
- _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
- elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count ]]; then
- #
- # We will move beyond the beginning of $_history_substring_search_matches:
- #
- # 1. Increase $_history_substring_search_match_index by 1.
+ if [[ $_history_substring_search_match_index -lt 1 ]]; then
#
- # 2. Save the current buffer in $_history_substring_search_old_buffer, so
- # that it can be retrieved by _history-substring-search-up-search()
- # later.
+ # We are beyond the beginning of $_history_substring_search_matches.
#
- # 3. Make $BUFFER equal to $_history_substring_search_query.
+ # 1. Update display to indicate search not found.
#
- # 4. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
- # to highlight the current buffer.
- #
- (( _history_substring_search_match_index++ ))
_history-substring-search-not-found
+ return
+ fi
- elif [[ $_history_substring_search_match_index -eq 0 ]]; then
- #
- # We were beyond the end of $_history_substring_search_matches but DOWN
- # makes us move back to the $_history_substring_search_matches:
+ if _history-substring-search-has-prev; then
#
- # 1. Increase $_history_substring_search_match_index by 1.
+ # We do have younger matches.
#
- # 2. Restore $BUFFER from $_history_substring_search_old_buffer.
+ # 1. Move index to point to the previous match.
+ # 2. Update display to indicate search found.
#
- # 3. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
- # to highlight the current buffer.
- #
- (( _history_substring_search_match_index++ ))
- BUFFER=$_history_substring_search_old_buffer
- _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
+ _history_substring_search_match_index+=-1
+ _history-substring-search-found
else
#
- # We are at the end of history and there are no further matches.
+ # We do not have younger matches.
+ #
+ # 1. Move the index beyond the beginning of
+ # _history_substring_search_matches.
+ # 2. Update display to indicate search not found.
#
+ _history_substring_search_match_index+=-1
_history-substring-search-not-found
- return
fi
#
# When HIST_FIND_NO_DUPS is set, meaning that only unique command lines from
# history should be matched, make sure the new and old results are different.
- # But when HIST_IGNORE_ALL_DUPS is set, ZSH already ensures a unique history.
#
- if [[ ! -o HIST_IGNORE_ALL_DUPS && -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then
+ # However, if the HIST_IGNORE_ALL_DUPS shell option, or
+ # HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE is set, then we already have a
+ # unique history, so in this case we do not need to do anything.
+ #
+ if [[ -o HIST_IGNORE_ALL_DUPS || -n $HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE ]]; then
+ return
+ fi
+
+ if [[ -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then
#
# Repeat the current search so that a different (unique) match is found.
#
diff --git a/plugins/history/README.md b/plugins/history/README.md
index dd9286894..a9d480f46 100644
--- a/plugins/history/README.md
+++ b/plugins/history/README.md
@@ -1,15 +1,17 @@
-## history
+# history plugin
Provides a couple of convenient aliases for using the `history` command to examine your command line history.
-### Requirements
+To use it, add `history` to the plugins array in your zshrc file:
-* None.
+```zsh
+plugins=(... history)
+```
-### Usage
+## Aliases
-* If `h` is called, your command history is listed. Equivalent to using `history`
-
-* If `hsi` is called with an argument, a **case insensitive** `grep` search is performed on your command history, looking for commands that match the argument provided
-
-* If `hsi` is called without an argument you will help on `grep` arguments \ No newline at end of file
+| Alias | Command | Description |
+|-------|----------------------|------------------------------------------------------------------|
+| `h` | `history` | Prints your command history |
+| `hs` | `history \| grep` | Use grep to search your command history |
+| `hsi` | `history \| grep -i` | Use grep to do a case-insensitive search of your command history |
diff --git a/plugins/history/history.plugin.zsh b/plugins/history/history.plugin.zsh
index 0f4aa4b10..9cee48fe4 100644
--- a/plugins/history/history.plugin.zsh
+++ b/plugins/history/history.plugin.zsh
@@ -1,8 +1,3 @@
alias h='history'
-
-function hs
-{
- history | grep $*
-}
-
-alias hsi='hs -i'
+alias hs='history | grep'
+alias hsi='history | grep -i'
diff --git a/plugins/httpie/README.md b/plugins/httpie/README.md
index f22d3a64e..25bdd0c7d 100644
--- a/plugins/httpie/README.md
+++ b/plugins/httpie/README.md
@@ -11,5 +11,4 @@ plugins=(... httpie)
It uses completion from [zsh-completions](https://github.com/zsh-users/zsh-completions).
-
**Maintainer:** [lululau](https://github.com/lululau)
diff --git a/plugins/jira/README.md b/plugins/jira/README.md
index 091dccb97..a211e34e0 100644
--- a/plugins/jira/README.md
+++ b/plugins/jira/README.md
@@ -23,6 +23,9 @@ jira reported [username] # queries for issues reported by a user
jira assigned [username] # queries for issues assigned to a user
jira myissues # queries for you own issues
jira branch # opens an existing issue matching the current branch name
+ # The branch name may have prefixes ending in "/": "feature/MP-1234",
+ # and also suffixes starting with "_": "MP-1234_fix_dashboard"
+ # In both these cases, the issue opened will be "MP-1234"
jira ABC-123 # opens an existing issue
jira ABC-123 m # opens an existing issue for adding a comment
```
diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh
index e706948e9..cb46f540b 100644
--- a/plugins/jira/jira.plugin.zsh
+++ b/plugins/jira/jira.plugin.zsh
@@ -63,25 +63,33 @@ function jira() {
else
# Anything that doesn't match a special action is considered an issue name
# but `branch` is a special case that will parse the current git branch
+ local issue_arg issue
if [[ "$action" == "branch" ]]; then
- local issue_arg=$(git rev-parse --abbrev-ref HEAD)
- local issue="${jira_prefix}${issue_arg}"
+ # Get name of the branch
+ issue_arg=$(git rev-parse --abbrev-ref HEAD)
+ # Strip prefixes like feature/ or bugfix/
+ issue_arg=${issue_arg##*/}
+ # Strip suffixes starting with _
+ issue_arg=(${(s:_:)issue_arg})
+ issue_arg=${issue_arg[1]}
+ if [[ "$issue_arg" = ${jira_prefix}* ]]; then
+ issue="${issue_arg}"
+ else
+ issue="${jira_prefix}${issue_arg}"
+ fi
else
- local issue_arg=$action
- local issue="${jira_prefix}${issue_arg}"
+ issue_arg=${(U)action}
+ issue="${jira_prefix}${issue_arg}"
fi
- local url_fragment=''
+
+ local url_fragment
if [[ "$2" == "m" ]]; then
url_fragment="#add-comment"
echo "Add comment to issue #$issue"
else
echo "Opening issue #$issue"
fi
- if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then
- open_command "${jira_url}/issues/${issue}${url_fragment}"
- else
- open_command "${jira_url}/browse/${issue}${url_fragment}"
- fi
+ open_command "${jira_url}/browse/${issue}${url_fragment}"
fi
}
diff --git a/plugins/jsontools/README.md b/plugins/jsontools/README.md
index 4faf58b98..2a5a76139 100644
--- a/plugins/jsontools/README.md
+++ b/plugins/jsontools/README.md
@@ -2,41 +2,47 @@
Handy command line tools for dealing with json data.
-## Tools
+To use it, add `jsontools` to the plugins array in your zshrc file:
-- **pp_json** - pretty prints json
-- **is_json** - returns true if valid json; false otherwise
-- **urlencode_json** - returns a url encoded string for the given json
-- **urldecode_json** - returns decoded json for the given url encoded string
+```zsh
+plugins=(... jsontools)
+```
## Usage
-Usage is simple...just take your json data and pipe it into the appropriate jsontool.
-```sh
-<json data> | <jsontools tool>
-```
-## Examples
-##### pp_json
+Usage is simple... just take your json data and pipe it into the appropriate jsontool:
+
+- `pp_json`: pretty prints json.
+- `is_json`: returns true if valid json; false otherwise.
+- `urlencode_json`: returns a url encoded string for the given json.
+- `urldecode_json`: returns decoded json for the given url encoded string.
+
+### Examples
+
+- **pp_json**:
```sh
# curl json data and pretty print the results
curl https://coderwall.com/bobwilliams.json | pp_json
```
-##### is_json
+- **is_json**:
+
```sh
# pretty print the contents of an existing json file
less data.json | is_json
```
-##### urlencode_json
+- **urlencode_json**:
+
```sh
# json data directly from the command line
echo '{"b":2, "a":1}' | urlencode_json
```
-##### urldecode_json
+- **urldecode_json**:
+
```sh
# url encoded string to decode
echo '%7B%22b%22:2,%20%22a%22:1%7D%0A' | urldecode_json
-``` \ No newline at end of file
+```
diff --git a/plugins/keychain/keychain.plugin.zsh b/plugins/keychain/keychain.plugin.zsh
index def97d8d1..1babf5a30 100644
--- a/plugins/keychain/keychain.plugin.zsh
+++ b/plugins/keychain/keychain.plugin.zsh
@@ -1,3 +1,6 @@
+# Define SHORT_HOST if not defined (%m = host name up to first .)
+SHORT_HOST=${SHORT_HOST:-${(%):-%m}}
+
function _start_agent() {
local agents
local -a identities
diff --git a/plugins/kitchen/_kitchen b/plugins/kitchen/_kitchen
index 29a3125e4..d93d93d78 100644
--- a/plugins/kitchen/_kitchen
+++ b/plugins/kitchen/_kitchen
@@ -67,7 +67,7 @@ _kitchen() {
_kitchen_commands() {
local commands
- commands=("${(@f)$(_call_program commands $service help | sed -n 's/^ kitchen \([[:alpha:]]*\) [ [].*# \(.*\)$/\1:\2/p')}")
+ commands=("${(@f)$(_call_program commands $service help | sed -n 's/^ kitchen \([[:alpha:]]*\) [ A-Z[].*# \(.*\)$/\1:\2/p')}")
_describe -t commands 'kitchen commands' commands
}
diff --git a/plugins/knife/_knife b/plugins/knife/_knife
index 06b12a3b0..09757ebaa 100644
--- a/plugins/knife/_knife
+++ b/plugins/knife/_knife
@@ -34,7 +34,7 @@ _knife() {
case $state in
knifecmd)
- compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" diff exec environment index node recipe role search ssh status upload vault windows $cloudproviders
+ compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" diff exec environment index node recipe role search solo ssh status upload vault windows $cloudproviders
;;
knifesubcmd)
case $words[2] in
@@ -65,6 +65,9 @@ _knife() {
role)
compadd -Q "$@" "bulk delete" create delete edit "from file" list show
;;
+ solo)
+ compadd "$@" bootstrap clean cook init prepare
+ ;;
upload)
_arguments '*:file or directory:_files -g "*"'
;;
@@ -102,6 +105,12 @@ _knife() {
bag)
compadd -Q "$@" show edit list "from file" create delete
;;
+ bootstrap|clean|cook|prepare)
+ compadd "$@" nodes/*.json(N:t:r)
+ ;;
+ init)
+ compadd "$@" ./*(/N:t)
+ ;;
*)
_arguments '3:Subsubcommands:($(_knife_options2))'
;;
diff --git a/plugins/kube-ps1/README.md b/plugins/kube-ps1/README.md
index fdc1a94e8..a14337278 100644
--- a/plugins/kube-ps1/README.md
+++ b/plugins/kube-ps1/README.md
@@ -1,106 +1,246 @@
-# Kubernetes prompt for zsh
+kube-ps1: Kubernetes prompt for bash and zsh
+============================================
-A Kubernetes zsh prompt that displays the current cluster cluster
-and the namespace.
+A script that lets you add the current Kubernetes context and namespace
+configured on `kubectl` to your Bash/Zsh prompt strings (i.e. the `$PS1`).
-Inspired by several tools used to simplify usage of kubectl
+Inspired by several tools used to simplify usage of `kubectl`.
-NOTE: If you are not using zsh, check out [kube-ps1](https://github.com/jonmosco/kube-ps1)
-designed for bash as well as zsh.
+![prompt](img/screenshot2.png)
-## Requirements
-
-The default prompt assumes you have the kubectl command line utility installed. It
-can be obtained here:
+![prompt_sol_light](img/screenshot-sol-light.png)
-[Install and Set up kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
+![prompt_img](img/screenshot-img.png)
-If using this with OpenShift, the oc tool needs installed. It can be obtained from here:
+![prompt demo](img/kube-ps1.gif)
-[OC Client Tools](https://www.openshift.org/download.html)
+## Installing
-## Helper utilities
+### MacOS
-There are several great tools that make using kubectl very enjoyable.
+Homebrew package manager:
-[kubectx and kubenx](https://github.com/ahmetb/kubectx) are great for
-fast switching between clusters and namespaces.
+```
+$ brew update
+$ brew install kube-ps1
+```
+### From Source
-## Prompt Structure
+1. Clone this repository
+2. Source the kube-ps1.sh in your `~/.zshrc` or your `~/.bashrc`
-The prompt layout is:
+### Arch Linux
+AUR Package available at [https://aur.archlinux.org/packages/kube-ps1/](https://aur.archlinux.org/packages/kube-ps1/).
+#### Zsh
+```sh
+source /path/to/kube-ps1.sh
+PROMPT='$(kube_ps1)'$PROMPT
```
-(<symbol>|<cluster>:<namespace>)
+#### Bash
+```sh
+source /path/to/kube-ps1.sh
+PS1='[\u@\h \W $(kube_ps1)]\$ '
```
-## Enabling
+### Zsh Plugin Managers
-In order to use kube-ps1 with Oh My Zsh, you'll need to enable them in the
-.zshrc file. You'll find the zshrc file in your $HOME directory. Open it with
-your favorite text editor and you'll see a spot to list all the plugins you
-want to load.
+#### Using [zplugin](https://github.com/zdharma/zplugin)
-```shell
-vim $HOME/.zshrc
+Update `.zshrc` with:
+```sh
+zplugin light jonmosco/kube-ps1
+PROMPT='$(kube_ps1)'$PROMPT
```
-Add kube-ps1 to the list of enabled plugins and enable it on the prompt:
+## Requirements
-```shell
-plugins=(
- git
- kube-ps1
-)
+The default prompt assumes you have the `kubectl` command line utility installed.
+Official installation instructions and binaries are available:
-# After the "source Oh My Zsh" line
-PROMPT=$PROMPT'$(kube_ps1) '
-# Or in double quotes, don't forget to escape
-PROMPT=$PROMPT"\$(kube_ps1) "
+[Install and Set up kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
+
+If using this with OpenShift, the `oc` tool needs installed. It can be obtained
+from brew ports:
+
+```
+brew install openshift-cli
```
+or the source can be downloaded:
+
+[OC Client Tools](https://www.openshift.org/download.html)
-Note: The `PROMPT` example above was tested with the theme `robbyrussell`.
+Set the binary to `oc` with the following environment variable:
-## Enabling / Disabling on the current shell
+```
+KUBE_PS1_BINARY=oc
+```
-Sometimes the kubernetes information can be anoying, you can easily
-switch it on and off with the following commands:
+If neither binary is available, the prompt will print the following:
-```shell
-kubeon
```
+(<symbol>|BINARY-N/A:N/A)
+```
+
+## Helper utilities
+
+There are several great tools that make using kubectl very enjoyable:
+
+- [`kubectx` and `kubens`](https://github.com/ahmetb/kubectx) are great for
+fast switching between clusters and namespaces.
+
+## Tmux port
+
+I have begun porting kube-ps1 to tmux as a status line plugin. If you prefer
+tmux, and like the functionality provided by kube-ps1, checkout the
+[kube-tmux](https://github.com/jonmosco/kube-tmux) project
+
+## Prompt Structure
+
+The default prompt layout is:
-```shell
-kubeoff
+```
+(<symbol>|<context>:<namespace>)
```
-## Colors
+If the current-context is not set, kube-ps1 will return the following:
-Blue was used as the prefix to match the Kubernetes color as closely as
-possible. Red was chosen as the cluster name to stand out, and cyan
-for the namespace. Check the customization section for changing them.
+```
+(<symbol>|N/A:N/A)
+```
+
+## Enabling/Disabling
+
+If you want to stop showing Kubernetes status on your prompt string temporarily
+run `kubeoff`. To disable the prompt for all shell sessions, run `kubeoff -g`.
+You can enable it again in the current shell by running `kubeon`, and globally
+with `kubeon -g`.
+
+```
+kubeon : turn on kube-ps1 status for this shell. Takes precedence over
+ global setting for current session
+kubeon -g : turn on kube-ps1 status globally
+kubeoff : turn off kube-ps1 status for this shell. Takes precedence over
+ global setting for current session
+kubeoff -g : turn off kube-ps1 status globally
+```
## Customization
-The default settings can be overridden in ~/.zshrc
+The default settings can be overridden in `~/.bashrc` or `~/.zshrc` by setting
+the following environment variables:
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `KUBE_PS1_BINARY` | `kubectl` | Default Kubernetes binary |
+| `KUBE_PS1_NS_ENABLE` | `true` | Display the namespace. If set to `false`, this will also disable `KUBE_PS1_DIVIDER` |
| `KUBE_PS1_PREFIX` | `(` | Prompt opening character |
| `KUBE_PS1_SYMBOL_ENABLE` | `true ` | Display the prompt Symbol. If set to `false`, this will also disable `KUBE_PS1_SEPARATOR` |
| `KUBE_PS1_SYMBOL_DEFAULT` | `⎈ ` | Default prompt symbol. Unicode `\u2388` |
| `KUBE_PS1_SYMBOL_USE_IMG` | `false` | ☸️ , Unicode `\u2638` as the prompt symbol |
-| `KUBE_PS1_NS_ENABLE` | `true` | Display the namespace. If set to `false`, this will also disable `KUBE_PS1_DIVIDER` |
-| `KUBE_PS1_SEPERATOR` | `\|` | Separator between symbol and cluster name |
-| `KUBE_PS1_DIVIDER` | `:` | Separator between cluster and namespace |
+| `KUBE_PS1_SEPARATOR` | &#124; | Separator between symbol and context name |
+| `KUBE_PS1_DIVIDER` | `:` | Separator between context and namespace |
| `KUBE_PS1_SUFFIX` | `)` | Prompt closing character |
-| `KUBE_PS1_COLOR_SYMBOL` | `"%F{blue}"` | Custom color for the symbol |
-| `KUBE_PS1_COLOR_CONTEXT` | `"%F{red}"` | Custom color for the context |
-| `KUBE_PS1_COLOR_NS` | `"%F{cyan}"` | Custom color for the namespace |
-| `KUBE_PS1_ENABLED` | `true` | Set to false to start disabled on any new shell, `kubeon`/`kubeoff` will flip this value on the current shell |
+| `KUBE_PS1_CLUSTER_FUNCTION` | No default, must be user supplied | Function to customize how cluster is displayed |
+| `KUBE_PS1_NAMESPACE_FUNCTION` | No default, must be user supplied | Function to customize how namespace is displayed |
+
+For terminals that do not support UTF-8, the symbol will be replaced with the
+string `k8s`.
+
+To disable a feature, set it to an empty string:
+
+```
+KUBE_PS1_SEPARATOR=''
+```
+
+## Colors
+
+The default colors are set with the following environment variables:
+
+| Variable | Default | Meaning |
+| :------- | :-----: | ------- |
+| `KUBE_PS1_SYMBOL_COLOR` | `blue` | Set default color of the Kubernetes symbol |
+| `KUBE_PS1_CTX_COLOR` | `red` | Set default color of the context |
+| `KUBE_PS1_NS_COLOR` | `cyan` | Set default color of the namespace |
+| `KUBE_PS1_BG_COLOR` | `null` | Set default color of the prompt background |
+
+Blue was used for the default symbol to match the Kubernetes color as closely
+as possible. Red was chosen as the context name to stand out, and cyan for the
+namespace.
+
+Set the variable to an empty string if you do not want color for each
+prompt section:
+
+```
+KUBE_PS1_CTX_COLOR=''
+```
+
+Names are usable for the following colors:
+
+```
+black, red, green, yellow, blue, magenta, cyan
+```
+
+256 colors are available by specifying the numerical value as the variable
+argument.
+
+## Customize display of cluster name and namespace
+
+You can change how the cluster name and namespace are displayed using the
+`KUBE_PS1_CLUSTER_FUNCTION` and `KUBE_PS1_NAMESPACE_FUNCTION` variables
+respectively.
+
+For the following examples let's assume the following:
+
+cluster name: `sandbox.k8s.example.com`
+namespace: `alpha`
+
+If you're using domain style cluster names, your prompt will get quite long
+very quickly. Let's say you only want to display the first portion of the
+cluster name (`sandbox`), you could do that by adding the following:
+
+```sh
+function get_cluster_short() {
+ echo "$1" | cut -d . -f1
+}
+
+KUBE_PS1_CLUSTER_FUNCTION=get_cluster_short
+```
+
+The same pattern can be followed to customize the display of the namespace.
+Let's say you would prefer the namespace to be displayed in all uppercase
+(`ALPHA`), here's one way you could do that:
+
+```sh
+function get_namespace_upper() {
+ echo "$1" | tr '[:lower:]' '[:upper:]'
+}
+
+export KUBE_PS1_NAMESPACE_FUNCTION=get_namespace_upper
+```
+
+In both cases, the variable is set to the name of the function, and you must have defined the function in your shell configuration before kube_ps1 is called. The function must accept a single parameter and echo out the final value.
+
+### Bug Reports and shell configuration
+
+Due to the vast ways of customizing the shell, please try the prompt with a
+minimal configuration before submitting a bug report.
+
+This can be done as follows for each shell before loading kube-ps1:
+
+Bash:
+```bash
+bash --norc
+```
+
+Zsh:
+```bash
+zsh -f
+or
+zsh --no-rcs
+```
## Contributors
-- Jared Yanovich
-- Pedro Moranga
+* [Ahmet Alp Balkan](https://github.com/ahmetb)
+* Jared Yanovich
diff --git a/plugins/kube-ps1/kube-ps1.plugin.zsh b/plugins/kube-ps1/kube-ps1.plugin.zsh
index 3cb21284a..0f68ca938 100644
--- a/plugins/kube-ps1/kube-ps1.plugin.zsh
+++ b/plugins/kube-ps1/kube-ps1.plugin.zsh
@@ -1,16 +1,15 @@
-#!/bin/zsh
+#!/bin/bash
# Kubernetes prompt helper for bash/zsh
-# ported to oh-my-zsh
# Displays current context and namespace
-# Copyright 2018 Jon Mosco
+# Copyright 2019 Jon Mosco
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
-# https://www.apache.org/licenses/LICENSE-2.0
+# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@@ -21,39 +20,150 @@
# Debug
[[ -n $DEBUG ]] && set -x
-setopt PROMPT_SUBST
-autoload -U add-zsh-hook
-add-zsh-hook precmd _kube_ps1_update_cache
-zmodload zsh/stat
-zmodload zsh/datetime
-
# Default values for the prompt
-# Override these values in ~/.zshrc
+# Override these values in ~/.zshrc or ~/.bashrc
KUBE_PS1_BINARY="${KUBE_PS1_BINARY:-kubectl}"
KUBE_PS1_SYMBOL_ENABLE="${KUBE_PS1_SYMBOL_ENABLE:-true}"
-KUBE_PS1_SYMBOL_DEFAULT="${KUBE_PS1_SYMBOL_DEFAULT:-\u2388 }"
+KUBE_PS1_SYMBOL_DEFAULT=${KUBE_PS1_SYMBOL_DEFAULT:-$'\u2388 '}
KUBE_PS1_SYMBOL_USE_IMG="${KUBE_PS1_SYMBOL_USE_IMG:-false}"
KUBE_PS1_NS_ENABLE="${KUBE_PS1_NS_ENABLE:-true}"
+KUBE_PS1_CONTEXT_ENABLE="${KUBE_PS1_CONTEXT_ENABLE:-true}"
+KUBE_PS1_PREFIX="${KUBE_PS1_PREFIX-(}"
KUBE_PS1_SEPARATOR="${KUBE_PS1_SEPARATOR-|}"
KUBE_PS1_DIVIDER="${KUBE_PS1_DIVIDER-:}"
-KUBE_PS1_PREFIX="${KUBE_PS1_PREFIX-(}"
KUBE_PS1_SUFFIX="${KUBE_PS1_SUFFIX-)}"
+KUBE_PS1_SYMBOL_COLOR="${KUBE_PS1_SYMBOL_COLOR-blue}"
+KUBE_PS1_CTX_COLOR="${KUBE_PS1_CTX_COLOR-red}"
+KUBE_PS1_NS_COLOR="${KUBE_PS1_NS_COLOR-cyan}"
+KUBE_PS1_BG_COLOR="${KUBE_PS1_BG_COLOR}"
+KUBE_PS1_KUBECONFIG_CACHE="${KUBECONFIG}"
+KUBE_PS1_DISABLE_PATH="${HOME}/.kube/kube-ps1/disabled"
KUBE_PS1_LAST_TIME=0
-KUBE_PS1_ENABLED=true
+KUBE_PS1_CLUSTER_FUNCTION="${KUBE_PS1_CLUSTER_FUNCTION}"
+KUBE_PS1_NAMESPACE_FUNCTION="${KUBE_PS1_NAMESPACE_FUNCTION}"
+
+# Determine our shell
+if [ "${ZSH_VERSION-}" ]; then
+ KUBE_PS1_SHELL="zsh"
+elif [ "${BASH_VERSION-}" ]; then
+ KUBE_PS1_SHELL="bash"
+fi
+
+_kube_ps1_init() {
+ [[ -f "${KUBE_PS1_DISABLE_PATH}" ]] && KUBE_PS1_ENABLED=off
-KUBE_PS1_COLOR_SYMBOL="%{$fg[blue]%}"
-KUBE_PS1_COLOR_CONTEXT="%{$fg[red]%}"
-KUBE_PS1_COLOR_NS="%{$fg[cyan]%}"
+ case "${KUBE_PS1_SHELL}" in
+ "zsh")
+ _KUBE_PS1_OPEN_ESC="%{"
+ _KUBE_PS1_CLOSE_ESC="%}"
+ _KUBE_PS1_DEFAULT_BG="%k"
+ _KUBE_PS1_DEFAULT_FG="%f"
+ setopt PROMPT_SUBST
+ autoload -U add-zsh-hook
+ add-zsh-hook precmd _kube_ps1_update_cache
+ zmodload -F zsh/stat b:zstat
+ zmodload zsh/datetime
+ ;;
+ "bash")
+ _KUBE_PS1_OPEN_ESC=$'\001'
+ _KUBE_PS1_CLOSE_ESC=$'\002'
+ _KUBE_PS1_DEFAULT_BG=$'\033[49m'
+ _KUBE_PS1_DEFAULT_FG=$'\033[39m'
+ [[ $PROMPT_COMMAND =~ _kube_ps1_update_cache ]] || PROMPT_COMMAND="_kube_ps1_update_cache;${PROMPT_COMMAND:-:}"
+ ;;
+ esac
+}
+
+_kube_ps1_color_fg() {
+ local KUBE_PS1_FG_CODE
+ case "${1}" in
+ black) KUBE_PS1_FG_CODE=0;;
+ red) KUBE_PS1_FG_CODE=1;;
+ green) KUBE_PS1_FG_CODE=2;;
+ yellow) KUBE_PS1_FG_CODE=3;;
+ blue) KUBE_PS1_FG_CODE=4;;
+ magenta) KUBE_PS1_FG_CODE=5;;
+ cyan) KUBE_PS1_FG_CODE=6;;
+ white) KUBE_PS1_FG_CODE=7;;
+ # 256
+ [0-9]|[1-9][0-9]|[1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-6]) KUBE_PS1_FG_CODE="${1}";;
+ *) KUBE_PS1_FG_CODE=default
+ esac
+
+ if [[ "${KUBE_PS1_FG_CODE}" == "default" ]]; then
+ KUBE_PS1_FG_CODE="${_KUBE_PS1_DEFAULT_FG}"
+ return
+ elif [[ "${KUBE_PS1_SHELL}" == "zsh" ]]; then
+ KUBE_PS1_FG_CODE="%F{$KUBE_PS1_FG_CODE}"
+ elif [[ "${KUBE_PS1_SHELL}" == "bash" ]]; then
+ if tput setaf 1 &> /dev/null; then
+ KUBE_PS1_FG_CODE="$(tput setaf ${KUBE_PS1_FG_CODE})"
+ elif [[ $KUBE_PS1_FG_CODE -ge 0 ]] && [[ $KUBE_PS1_FG_CODE -le 256 ]]; then
+ KUBE_PS1_FG_CODE="\033[38;5;${KUBE_PS1_FG_CODE}m"
+ else
+ KUBE_PS1_FG_CODE="${_KUBE_PS1_DEFAULT_FG}"
+ fi
+ fi
+ echo ${_KUBE_PS1_OPEN_ESC}${KUBE_PS1_FG_CODE}${_KUBE_PS1_CLOSE_ESC}
+}
+
+_kube_ps1_color_bg() {
+ local KUBE_PS1_BG_CODE
+ case "${1}" in
+ black) KUBE_PS1_BG_CODE=0;;
+ red) KUBE_PS1_BG_CODE=1;;
+ green) KUBE_PS1_BG_CODE=2;;
+ yellow) KUBE_PS1_BG_CODE=3;;
+ blue) KUBE_PS1_BG_CODE=4;;
+ magenta) KUBE_PS1_BG_CODE=5;;
+ cyan) KUBE_PS1_BG_CODE=6;;
+ white) KUBE_PS1_BG_CODE=7;;
+ # 256
+ [0-9]|[1-9][0-9]|[1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-6]) KUBE_PS1_BG_CODE="${1}";;
+ *) KUBE_PS1_BG_CODE=$'\033[0m';;
+ esac
+
+ if [[ "${KUBE_PS1_BG_CODE}" == "default" ]]; then
+ KUBE_PS1_FG_CODE="${_KUBE_PS1_DEFAULT_BG}"
+ return
+ elif [[ "${KUBE_PS1_SHELL}" == "zsh" ]]; then
+ KUBE_PS1_BG_CODE="%K{$KUBE_PS1_BG_CODE}"
+ elif [[ "${KUBE_PS1_SHELL}" == "bash" ]]; then
+ if tput setaf 1 &> /dev/null; then
+ KUBE_PS1_BG_CODE="$(tput setab ${KUBE_PS1_BG_CODE})"
+ elif [[ $KUBE_PS1_BG_CODE -ge 0 ]] && [[ $KUBE_PS1_BG_CODE -le 256 ]]; then
+ KUBE_PS1_BG_CODE="\033[48;5;${KUBE_PS1_BG_CODE}m"
+ else
+ KUBE_PS1_BG_CODE="${DEFAULT_BG}"
+ fi
+ fi
+ echo ${OPEN_ESC}${KUBE_PS1_BG_CODE}${CLOSE_ESC}
+}
_kube_ps1_binary_check() {
- command -v "$1" >/dev/null
+ command -v $1 >/dev/null
}
_kube_ps1_symbol() {
[[ "${KUBE_PS1_SYMBOL_ENABLE}" == false ]] && return
- KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_DEFAULT}"
- KUBE_PS1_SYMBOL_IMG="\u2638 "
+ case "${KUBE_PS1_SHELL}" in
+ bash)
+ if ((BASH_VERSINFO[0] >= 4)) && [[ $'\u2388 ' != "\\u2388 " ]]; then
+ KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_DEFAULT}"
+ # KUBE_PS1_SYMBOL=$'\u2388 '
+ KUBE_PS1_SYMBOL_IMG=$'\u2638 '
+ else
+ KUBE_PS1_SYMBOL=$'\xE2\x8E\x88 '
+ KUBE_PS1_SYMBOL_IMG=$'\xE2\x98\xB8 '
+ fi
+ ;;
+ zsh)
+ KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_DEFAULT}"
+ KUBE_PS1_SYMBOL_IMG="\u2638 ";;
+ *)
+ KUBE_PS1_SYMBOL="k8s"
+ esac
if [[ "${KUBE_PS1_SYMBOL_USE_IMG}" == true ]]; then
KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_IMG}"
@@ -73,22 +183,24 @@ _kube_ps1_file_newer_than() {
local file=$1
local check_time=$2
- zmodload -e "zsh/stat"
- if [[ "$?" -eq 0 ]]; then
- mtime=$(stat +mtime "${file}")
+ if [[ "${KUBE_PS1_SHELL}" == "zsh" ]]; then
+ mtime=$(zstat -L +mtime "${file}")
elif stat -c "%s" /dev/null &> /dev/null; then
# GNU stat
- mtime=$(stat -c %Y "${file}")
+ mtime=$(stat -L -c %Y "${file}")
else
# BSD stat
- mtime=$(stat -f %m "$file")
+ mtime=$(stat -L -f %m "$file")
fi
[[ "${mtime}" -gt "${check_time}" ]]
}
_kube_ps1_update_cache() {
- KUBECONFIG="${KUBECONFIG:=$HOME/.kube/config}"
+ local return_code=$?
+
+ [[ "${KUBE_PS1_ENABLED}" == "off" ]] && return $return_code
+
if ! _kube_ps1_binary_check "${KUBE_PS1_BINARY}"; then
# No ability to fetch context/namespace; display N/A.
KUBE_PS1_CONTEXT="BINARY-N/A"
@@ -113,47 +225,147 @@ _kube_ps1_update_cache() {
return
fi
done
+
+ return $return_code
}
-_kube_ps1_get_context_ns() {
+_kube_ps1_get_context() {
+ if [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]]; then
+ KUBE_PS1_CONTEXT="$(${KUBE_PS1_BINARY} config current-context 2>/dev/null)"
+ # Set namespace to 'N/A' if it is not defined
+ KUBE_PS1_CONTEXT="${KUBE_PS1_CONTEXT:-N/A}"
- # Set the command time
- KUBE_PS1_LAST_TIME=$EPOCHSECONDS
+ if [[ ! -z "${KUBE_PS1_CLUSTER_FUNCTION}" ]]; then
+ KUBE_PS1_CONTEXT=$($KUBE_PS1_CLUSTER_FUNCTION $KUBE_PS1_CONTEXT)
+ fi
+ fi
+}
- KUBE_PS1_CONTEXT="$(${KUBE_PS1_BINARY} config current-context 2>/dev/null)"
- if [[ -z "${KUBE_PS1_CONTEXT}" ]]; then
- KUBE_PS1_CONTEXT="N/A"
- KUBE_PS1_NAMESPACE="N/A"
- return
- elif [[ "${KUBE_PS1_NS_ENABLE}" == true ]]; then
+_kube_ps1_get_ns() {
+ if [[ "${KUBE_PS1_NS_ENABLE}" == true ]]; then
KUBE_PS1_NAMESPACE="$(${KUBE_PS1_BINARY} config view --minify --output 'jsonpath={..namespace}' 2>/dev/null)"
# Set namespace to 'default' if it is not defined
KUBE_PS1_NAMESPACE="${KUBE_PS1_NAMESPACE:-default}"
+
+ if [[ ! -z "${KUBE_PS1_NAMESPACE_FUNCTION}" ]]; then
+ KUBE_PS1_NAMESPACE=$($KUBE_PS1_NAMESPACE_FUNCTION $KUBE_PS1_NAMESPACE)
+ fi
fi
}
-# function to disable the prompt on the current shell
-kubeon(){
- KUBE_PS1_ENABLED=true
+_kube_ps1_get_context_ns() {
+ # Set the command time
+ if [[ "${KUBE_PS1_SHELL}" == "bash" ]]; then
+ if ((BASH_VERSINFO[0] >= 4 && BASH_VERSINFO[1] >= 2)); then
+ KUBE_PS1_LAST_TIME=$(printf '%(%s)T')
+ else
+ KUBE_PS1_LAST_TIME=$(date +%s)
+ fi
+ elif [[ "${KUBE_PS1_SHELL}" == "zsh" ]]; then
+ KUBE_PS1_LAST_TIME=$EPOCHSECONDS
+ fi
+
+ _kube_ps1_get_context
+ _kube_ps1_get_ns
}
-# function to disable the prompt on the current shell
-kubeoff(){
- KUBE_PS1_ENABLED=false
+# Set kube-ps1 shell defaults
+_kube_ps1_init
+
+_kubeon_usage() {
+ cat <<"EOF"
+Toggle kube-ps1 prompt on
+
+Usage: kubeon [-g | --global] [-h | --help]
+
+With no arguments, turn off kube-ps1 status for this shell instance (default).
+
+ -g --global turn on kube-ps1 status globally
+ -h --help print this message
+EOF
+}
+
+_kubeoff_usage() {
+ cat <<"EOF"
+Toggle kube-ps1 prompt off
+
+Usage: kubeoff [-g | --global] [-h | --help]
+
+With no arguments, turn off kube-ps1 status for this shell instance (default).
+
+ -g --global turn off kube-ps1 status globally
+ -h --help print this message
+EOF
+}
+
+kubeon() {
+ if [[ "${1}" == '-h' || "${1}" == '--help' ]]; then
+ _kubeon_usage
+ elif [[ "${1}" == '-g' || "${1}" == '--global' ]]; then
+ rm -f -- "${KUBE_PS1_DISABLE_PATH}"
+ elif [[ "$#" -ne 0 ]]; then
+ echo -e "error: unrecognized flag ${1}\\n"
+ _kubeon_usage
+ return
+ fi
+
+ KUBE_PS1_ENABLED=on
+}
+
+kubeoff() {
+ if [[ "${1}" == '-h' || "${1}" == '--help' ]]; then
+ _kubeoff_usage
+ elif [[ "${1}" == '-g' || "${1}" == '--global' ]]; then
+ mkdir -p -- "$(dirname "${KUBE_PS1_DISABLE_PATH}")"
+ touch -- "${KUBE_PS1_DISABLE_PATH}"
+ elif [[ $# -ne 0 ]]; then
+ echo "error: unrecognized flag ${1}" >&2
+ _kubeoff_usage
+ return
+ fi
+
+ KUBE_PS1_ENABLED=off
}
# Build our prompt
-kube_ps1 () {
- local reset_color="%{$reset_color%}"
- [[ ${KUBE_PS1_ENABLED} != 'true' ]] && return
-
- KUBE_PS1="${reset_color}$KUBE_PS1_PREFIX"
- KUBE_PS1+="${KUBE_PS1_COLOR_SYMBOL}$(_kube_ps1_symbol)"
- KUBE_PS1+="${reset_color}$KUBE_PS1_SEPERATOR"
- KUBE_PS1+="${KUBE_PS1_COLOR_CONTEXT}$KUBE_PS1_CONTEXT${reset_color}"
- KUBE_PS1+="$KUBE_PS1_DIVIDER"
- KUBE_PS1+="${KUBE_PS1_COLOR_NS}$KUBE_PS1_NAMESPACE${reset_color}"
- KUBE_PS1+="$KUBE_PS1_SUFFIX"
+kube_ps1() {
+ [[ "${KUBE_PS1_ENABLED}" == "off" ]] && return
+ [[ -z "${KUBE_PS1_CONTEXT}" ]] && [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]] && return
+
+ local KUBE_PS1
+ local KUBE_PS1_RESET_COLOR="${_KUBE_PS1_OPEN_ESC}${_KUBE_PS1_DEFAULT_FG}${_KUBE_PS1_CLOSE_ESC}"
+
+ # Background Color
+ [[ -n "${KUBE_PS1_BG_COLOR}" ]] && KUBE_PS1+="$(_kube_ps1_color_bg ${KUBE_PS1_BG_COLOR})"
+
+ # Prefix
+ [[ -n "${KUBE_PS1_PREFIX}" ]] && KUBE_PS1+="${KUBE_PS1_PREFIX}"
+
+ # Symbol
+ KUBE_PS1+="$(_kube_ps1_color_fg $KUBE_PS1_SYMBOL_COLOR)$(_kube_ps1_symbol)${KUBE_PS1_RESET_COLOR}"
+
+ if [[ -n "${KUBE_PS1_SEPARATOR}" ]] && [[ "${KUBE_PS1_SYMBOL_ENABLE}" == true ]]; then
+ KUBE_PS1+="${KUBE_PS1_SEPARATOR}"
+ fi
+
+ # Context
+ if [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]]; then
+ KUBE_PS1+="$(_kube_ps1_color_fg $KUBE_PS1_CTX_COLOR)${KUBE_PS1_CONTEXT}${KUBE_PS1_RESET_COLOR}"
+ fi
+
+ # Namespace
+ if [[ "${KUBE_PS1_NS_ENABLE}" == true ]]; then
+ if [[ -n "${KUBE_PS1_DIVIDER}" ]] && [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]]; then
+ KUBE_PS1+="${KUBE_PS1_DIVIDER}"
+ fi
+ KUBE_PS1+="$(_kube_ps1_color_fg ${KUBE_PS1_NS_COLOR})${KUBE_PS1_NAMESPACE}${KUBE_PS1_RESET_COLOR}"
+ fi
+
+ # Suffix
+ [[ -n "${KUBE_PS1_SUFFIX}" ]] && KUBE_PS1+="${KUBE_PS1_SUFFIX}"
+
+ # Close Background color if defined
+ [[ -n "${KUBE_PS1_BG_COLOR}" ]] && KUBE_PS1+="${_KUBE_PS1_OPEN_ESC}${_KUBE_PS1_DEFAULT_BG}${_KUBE_PS1_CLOSE_ESC}"
echo "${KUBE_PS1}"
}
diff --git a/plugins/laravel4/README.md b/plugins/laravel4/README.md
index c945601f7..97a6a7899 100644
--- a/plugins/laravel4/README.md
+++ b/plugins/laravel4/README.md
@@ -10,9 +10,9 @@ plugins=(... laravel4)
## Aliases
-| Alias | Command | Description |
-|-----------|-------------------------------------------|-------------------------------------------------------------|
-| la4 | `php artisan` | Main Artisan command |
-| la4dump | `php artisan dump-autoload` | Regenerate framework autoload files |
-| la4cache | `php artisan cache:clear` | Flush the application cache |
-| la4routes | `php artisan routes` | List all registered routes |
+| Alias | Command | Description |
+|-----------|-----------------------------|-------------------------------------|
+| la4 | `php artisan` | Main Artisan command |
+| la4dump | `php artisan dump-autoload` | Regenerate framework autoload files |
+| la4cache | `php artisan cache:clear` | Flush the application cache |
+| la4routes | `php artisan routes` | List all registered routes |
diff --git a/plugins/last-working-dir/README.md b/plugins/last-working-dir/README.md
index 4cc4acab6..ced9e0370 100644
--- a/plugins/last-working-dir/README.md
+++ b/plugins/last-working-dir/README.md
@@ -6,4 +6,10 @@ for new shells, unless:
- The plugin is already loaded.
- The current `$PWD` is not `$HOME`.
-Adds `lwd` function to jump to the last working directory.
+Also adds `lwd` function to jump to the last working directory.
+
+To use it, add `last-working-dir` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... last-working-dir)
+```
diff --git a/plugins/lighthouse/README.md b/plugins/lighthouse/README.md
index 0db29b4e5..55587b20e 100644
--- a/plugins/lighthouse/README.md
+++ b/plugins/lighthouse/README.md
@@ -16,7 +16,8 @@ plugins=(... lighthouse)
file in your directory with the URL to the individual project.
Example:
- ```zsh
+
+ ```console
$ cat .lighthouse-url
https://rails.lighthouseapp.com/projects/8994
@@ -24,3 +25,5 @@ plugins=(... lighthouse)
Opening ticket #23
# The browser goes to https://rails.lighthouseapp.com/projects/8994/tickets/23
```
+
+See a demo: http://screencast.com/t/ZDgwNDUwNT
diff --git a/plugins/lol/README.md b/plugins/lol/README.md
index 1791de493..ea6b0c3b8 100644
--- a/plugins/lol/README.md
+++ b/plugins/lol/README.md
@@ -1,67 +1,55 @@
# lol
-Plugin for adding catspeak aliases, because why not
+Plugin for adding catspeak aliases, because why not.
-## Enabling the plugin
+To use it, add `lol` to the plugins array in your zshrc file:
-1. Open your `.zshrc` file and add `lol` in the plugins section:
-
- ```zsh
- plugins=(
- # all your enabled plugins
- lol
- )
- ```
-
-2. Restart your terminal session or restart the shell:
-
- ```console
- $ exec zsh
- $
- ```
+```zsh
+plugins=(... lol)
+```
## Aliases
-| Alias | Command |
-| ------------ | ---------------------------------------------------------------- |
-| `:3` | `echo` |
-| `alwayz` | `tail -f` |
-| `bringz` | `git pull` |
-| `btw` | `nice` |
-| `byes` | `exit` |
-| `chicken` | `git add` |
-| `cya` | `reboot` |
-| `donotwant` | `rm` |
-| `dowant` | `cp` |
-| `gimmeh` | `touch` |
-| `gtfo` | `mv` |
-| `hackzor` | `git init` |
-| `hai` | `cd` |
-| `icanhas` | `mkdir` |
-| `ihasbucket` | `df -h` |
-| `iminurbase` | `finger` |
-| `inur` | `locate` |
-| `invisible` | `cat` |
-| `iz` | `ls` |
-| `kthxbai` | `halt` |
-| `letcat` | `git checkout` |
-| `moar` | `more` |
-| `nomnom` | `killall` |
-| `nomz` | `ps aux` |
-| `nowai` | `chmod` |
-| `oanward` | `git commit -m` |
-| `obtw` | `nohup` |
-| `onoz` | `cat /var/log/errors.log` |
-| `ooanward` | `git commit -am` |
-| `plz` | `pwd` |
-| `pwned` | `ssh` |
-| `rtfm` | `man` |
-| `rulz` | `git push` |
-| `tldr` | `less` |
-| `violenz` | `git rebase` |
-| `visible` | `echo` |
-| `wtf` | `dmesg` |
-| `yolo` | `git commit -m "$(curl -s http://whatthecommit.com/index.txt)"` |
+| Alias | Command |
+| ------------ | --------------------------------------------------------------- |
+| `:3` | `echo` |
+| `alwayz` | `tail -f` |
+| `bringz` | `git pull` |
+| `btw` | `nice` |
+| `byes` | `exit` |
+| `chicken` | `git add` |
+| `cya` | `reboot` |
+| `donotwant` | `rm` |
+| `dowant` | `cp` |
+| `gimmeh` | `touch` |
+| `gtfo` | `mv` |
+| `hackzor` | `git init` |
+| `hai` | `cd` |
+| `icanhas` | `mkdir` |
+| `ihasbucket` | `df -h` |
+| `iminurbase` | `finger` |
+| `inur` | `locate` |
+| `invisible` | `cat` |
+| `iz` | `ls` |
+| `kthxbai` | `halt` |
+| `letcat` | `git checkout` |
+| `moar` | `more` |
+| `nomnom` | `killall` |
+| `nomz` | `ps aux` |
+| `nowai` | `chmod` |
+| `oanward` | `git commit -m` |
+| `obtw` | `nohup` |
+| `onoz` | `cat /var/log/errors.log` |
+| `ooanward` | `git commit -am` |
+| `plz` | `pwd` |
+| `pwned` | `ssh` |
+| `rtfm` | `man` |
+| `rulz` | `git push` |
+| `tldr` | `less` |
+| `violenz` | `git rebase` |
+| `visible` | `echo` |
+| `wtf` | `dmesg` |
+| `yolo` | `git commit -m "$(curl -s http://whatthecommit.com/index.txt)"` |
## Usage Examples
diff --git a/plugins/man/man.plugin.zsh b/plugins/man/man.plugin.zsh
index 94aa4918d..3ab15d323 100644
--- a/plugins/man/man.plugin.zsh
+++ b/plugins/man/man.plugin.zsh
@@ -13,8 +13,12 @@
# ------------------------------------------------------------------------------
man-command-line() {
- [[ -z $BUFFER ]] && zle up-history
- [[ $BUFFER != man\ * ]] && LBUFFER="man $LBUFFER"
+ # if there is no command typed, use the last command
+ [[ -z "$BUFFER" ]] && zle up-history
+
+ # prepend man to only the first part of the typed command
+ # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags
+ [[ "$BUFFER" != man\ * ]] && BUFFER="man ${${(Az)BUFFER}[1]}"
}
zle -N man-command-line
# Defined shortcut keys: [Esc]man
diff --git a/plugins/mercurial/README.md b/plugins/mercurial/README.md
index f42212d68..80ea2de31 100644
--- a/plugins/mercurial/README.md
+++ b/plugins/mercurial/README.md
@@ -1,60 +1,66 @@
# Mercurial plugin
-### Usage
-Update .zshrc:
-1. Add name to the list of plugins, e.g. `plugins=(... mercurial ...)`
- (that is pretty obvious).
-2. Switch to a theme which uses `hg_prompt_info`.
+This plugin adds some handy aliases for using Mercurial as well as a few
+utility and prompt functions that can be used in a theme.
- Or, customize the `$PROMPT` variable of your current theme to contain current folder mercurial repo info. This can be done by putting a custom version of the theme in `$ZSH_CUSTOM` or by changing `$PROMPT` in `.zshrc` after loading the theme.
+To use it, add `mercurial` to the plugins array in your zshrc file:
- The `robbyrussell` theme is used by default, so you need to modify `$PROMPT` var by adding `$(hg_prompt_info)` after `$(git_prompt_info)`, so it looks like this:
+```zsh
+plugins=(... mercurial)
+```
- ```zsh
- PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(hg_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
- ```
+## Aliases
-3. Initialize additional vars used in plugin. So in short put next in **.zshrc**:
+| Alias | Command |
+|--------|-------------------------------------------------------------------------------------------------------------|
+| `hga` | `hg add` |
+| `hgc` | `hg commit` |
+| `hgca` | `hg commit --amend` |
+| `hgb` | `hg branch` |
+| `hgba` | `hg branches` |
+| `hgbk` | `hg bookmarks` |
+| `hgco` | `hg checkout` |
+| `hgd` | `hg diff` |
+| `hged` | `hg diffmerge` |
+| `hgp` | `hg push` |
+| `hgs` | `hg status` |
+| `hgsl` | `hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n"` |
+| `hgun` | `hg resolve --list` |
+| `hgi` | `hg incoming` |
+| `hgl` | `hg pull -u` |
+| `hglr` | `hg pull --rebase` |
+| `hgo` | `hg outgoing` |
- ```
- ZSH_THEME_HG_PROMPT_PREFIX="%{$fg_bold[magenta]%}hg:(%{$fg[red]%}"
- ZSH_THEME_HG_PROMPT_SUFFIX="%{$reset_color%}"
- ZSH_THEME_HG_PROMPT_DIRTY="%{$fg[magenta]%}) %{$fg[yellow]%}✗%{$reset_color%}"
- ZSH_THEME_HG_PROMPT_CLEAN="%{$fg[magenta]%})"
- ```
+## Prompt usage
-### What's inside?
-#### Adds handy aliases:
-###### general
-* `hgc` - `hg commit`
-* `hgb` - `hg branch`
-* `hgba` - `hg branches`
-* `hgbk` - `hg bookmarks`
-* `hgco` - `hg checkout`
-* `hgd` - `hg diff`
-* `hged` - `hg diffmerge`
+- Switch to a theme which uses `hg_prompt_info`
-###### pull and update
-* `hgi` - `hg incoming`
-* `hgl` - `hg pull -u`
-* `hglr` - `hg pull --rebase`
-* `hgo` - `hg outgoing`
-* `hgp` - `hg push`
-* `hgs` - `hg status`
-* `hgsl` - `hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n"`
+- Or customize the `$PROMPT` variable of your current theme to contain current folder mercurial repo info.
+ This can be done by putting a custom version of the theme in `$ZSH_CUSTOM` or by changing `$PROMPT` in
+ `.zshrc` after loading the theme.
-###### this is the 'git commit --amend' equivalent
-* `hgca` - `hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip`
+ For example, for the `robbyrussell` theme you need to modify `$PROMPT` var by adding `$(hg_prompt_info)`
+ after `$(git_prompt_info)`, so it looks like this:
-###### list unresolved files (since hg does not list unmerged files in the status command)
-* `hgun` - `hg resolve --list`
+ ```zsh
+ PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(hg_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
+ ```
-#### Displays repo branch and directory status in prompt
-This is the same as git plugin does.
+You can also redefine additional vars used in the plugin (after Oh My Zsh is sourced):
-**Note**: Additional changes to **.zshrc**, or using a theme designed to use `hg_prompt_info`, are required in order for this to work.
+```zsh
+ZSH_THEME_HG_PROMPT_PREFIX="%{$fg_bold[magenta]%}hg:(%{$fg[red]%}"
+ZSH_THEME_HG_PROMPT_SUFFIX="%{$reset_color%}"
+ZSH_THEME_HG_PROMPT_DIRTY="%{$fg[magenta]%}) %{$fg[yellow]%}✗%{$reset_color%}"
+ZSH_THEME_HG_PROMPT_CLEAN="%{$fg[magenta]%})"
+```
-### Mantainers
-[ptrv](https://github.com/ptrv) - original creator
+### Display repo branch and directory status in prompt
-[oshybystyi](https://github.com/oshybystyi) - created this README and know how most of code works
+This is the same as git plugin does. **Note**: additional changes to `.zshrc`, or using a theme designed
+to use `hg_prompt_info`, are required in order for this to work.
+
+## Mantainers
+
+- [ptrv](https://github.com/ptrv): original creator
+- [oshybystyi](https://github.com/oshybystyi)
diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh
index 58bc571a0..f13430476 100644
--- a/plugins/mercurial/mercurial.plugin.zsh
+++ b/plugins/mercurial/mercurial.plugin.zsh
@@ -1,23 +1,22 @@
-# Mercurial
+# aliases
alias hga='hg add'
alias hgc='hg commit'
+alias hgca='hg commit --amend'
alias hgb='hg branch'
alias hgba='hg branches'
alias hgbk='hg bookmarks'
alias hgco='hg checkout'
alias hgd='hg diff'
alias hged='hg diffmerge'
+alias hgp='hg push'
+alias hgs='hg status'
+alias hgsl='hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n"'
+alias hgun='hg resolve --list'
# pull and update
alias hgi='hg incoming'
alias hgl='hg pull -u'
alias hglr='hg pull --rebase'
alias hgo='hg outgoing'
-alias hgp='hg push'
-alias hgs='hg status'
-alias hgsl='hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n" '
-alias hgca='hg commit --amend'
-# list unresolved files (since hg does not list unmerged files in the status command)
-alias hgun='hg resolve --list'
function in_hg() {
if [[ -d .hg ]] || $(hg summary > /dev/null 2>&1); then
diff --git a/plugins/meteor/README.md b/plugins/meteor/README.md
index 187a45a62..f7c43b7bd 100644
--- a/plugins/meteor/README.md
+++ b/plugins/meteor/README.md
@@ -1,9 +1,10 @@
-## Introduction
+# meteor plugin
The [meteor plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/meteor) provides many
[useful aliases](#aliases) as well as completion for the `meteor` command.
Enable it by adding `meteor` to the plugins array in your zshrc file:
+
```zsh
plugins=(... meteor)
```
diff --git a/plugins/minikube/minikube.plugin.zsh b/plugins/minikube/minikube.plugin.zsh
index d8ebe79af..f7b365c7f 100644
--- a/plugins/minikube/minikube.plugin.zsh
+++ b/plugins/minikube/minikube.plugin.zsh
@@ -1,6 +1,13 @@
# Autocompletion for Minikube.
#
+if (( $+commands[minikube] )); then
+ __MINICUBE_COMPLETION_FILE="${ZSH_CACHE_DIR}/minicube_completion"
-if [ $commands[minikube] ]; then
- source <(minikube completion zsh)
+ if [[ ! -f $__MINICUBE_COMPLETION_FILE ]]; then
+ minikube completion zsh >! $__MINICUBE_COMPLETION_FILE
+ fi
+
+ [[ -f $__MINICUBE_COMPLETION_FILE ]] && source $__MINICUBE_COMPLETION_FILE
+
+ unset __MINICUBE_COMPLETION_FILE
fi
diff --git a/plugins/mix/_mix b/plugins/mix/_mix
index 61fa1cf25..c0fe68c91 100644
--- a/plugins/mix/_mix
+++ b/plugins/mix/_mix
@@ -34,6 +34,7 @@ _1st_arguments=(
'firmware:Nerves - Build a firmware image for the selected target platform'
'firmware.burn:Nerves - Writes the generated firmware image to an attached SDCard or file'
'firmware.image:Nerves - Create a firmware image file that can be copied byte-for-byte'
+ 'format:Formats the given files and patterns'
'help:Print help information for tasks'
'hex:Print hex help information'
'hex.config:Read or update hex config'
@@ -92,7 +93,7 @@ __task_list ()
local expl
declare -a tasks
- tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server phx.digest phx.digest.clean phx.gen.channel phx.gen.context phx.gen.embedded phx.gen.html phx.gen.json phx.gen.presence phx.gen.schema phx.gen.secret phx.new phx.new.ecto phx.new.web phx.routes phx.server run test)
+ tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build format help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server phx.digest phx.digest.clean phx.gen.channel phx.gen.context phx.gen.embedded phx.gen.html phx.gen.json phx.gen.presence phx.gen.schema phx.gen.secret phx.new phx.new.ecto phx.new.web phx.routes phx.server run test)
_wanted tasks expl 'help' compadd $tasks
}
diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md
index 3bbba5b4f..72cea9cb9 100644
--- a/plugins/mvn/README.md
+++ b/plugins/mvn/README.md
@@ -4,6 +4,7 @@ The mvn plugin provides many [useful aliases](#aliases) as well as completion fo
the [Apache Maven](https://maven.apache.org/) command (`mvn`).
Enable it by adding `mvn` to the plugins array in your zshrc file:
+
```zsh
plugins=(... mvn)
```
diff --git a/plugins/mysql-macports/README.md b/plugins/mysql-macports/README.md
index a4224d9c0..ff4fb3a34 100644
--- a/plugins/mysql-macports/README.md
+++ b/plugins/mysql-macports/README.md
@@ -12,9 +12,9 @@ For instructions on how to install MySQL using MacPorts, read the [MacPorts wiki
## Aliases
-| Alias | Command | Description |
-| ------------ | --------------------------------------------------------- | ------------------------------------------ |
-| mysqlstart | `sudo /opt/local/share/mysql5/mysql/mysql.server start` | Start the MySQL server. |
-| mysqlstop | `sudo /opt/local/share/mysql5/mysql/mysql.server stop` | Stop the MySQL server. |
-| mysqlrestart | `sudo /opt/local/share/mysql5/mysql/mysql.server restart` | Restart the MySQL server. |
-| mysqlstatus | `mysqladmin5 -u root -p ping` | Check whether the MySQL server is running. |
+| Alias | Command | Description |
+| ------------ | ------------------------------------ | ------------------------------------------ |
+| mysqlstart | `sudo /path/to/mysql.server start` | Start the MySQL server. |
+| mysqlstop | `sudo /path/to/mysql.server stop` | Stop the MySQL server. |
+| mysqlrestart | `sudo /path/to/mysql.server restart` | Restart the MySQL server. |
+| mysqlstatus | `mysqladmin5 -u root -p ping` | Check whether the MySQL server is running. |
diff --git a/plugins/node/README.md b/plugins/node/README.md
index c392dc0bf..911b6693b 100644
--- a/plugins/node/README.md
+++ b/plugins/node/README.md
@@ -1,16 +1,19 @@
# node plugin
+This plugin adds `node-docs` function that opens specific section in [Node.js](https://nodejs.org)
+documentation (depending on the installed version).
+
To use it, add `node` to the plugins array of your zshrc file:
+
```zsh
plugins=(... node)
```
-This plugin adds `node-docs` function that open specific section in [Node.js](https://nodejs.org) documentation (depending on the installed version).
-For example:
+## Usage
```zsh
# Opens https://nodejs.org/docs/latest-v10.x/api/fs.html
$ node-docs fs
# Opens https://nodejs.org/docs/latest-v10.x/api/path.html
-$ node-docs path
+$ node-docs path
```
diff --git a/plugins/npm/README.md b/plugins/npm/README.md
index 202e2b0a4..0b1a2280f 100644
--- a/plugins/npm/README.md
+++ b/plugins/npm/README.md
@@ -1,9 +1,10 @@
-## npm plugin
+# npm plugin
The npm plugin provides completion as well as adding many useful aliases.
To use it, add npm to the plugins array of your zshrc file:
-```
+
+```zsh
plugins=(... npm)
```
diff --git a/plugins/nvm/_nvm b/plugins/nvm/_nvm
index 1eec48b0a..e292a8d8c 100644
--- a/plugins/nvm/_nvm
+++ b/plugins/nvm/_nvm
@@ -8,6 +8,7 @@ _1st_arguments=(
'help:show help'
'--version:print out the latest released version of nvm'
'install:download and install a version in <node|iojs|node version number>'
+ 'install-latest-npm:download and install the latest npm version'
'uninstall:uninstall a version'
'use:modify PATH to use <version>. Uses .nvmrc if available'
'exec:run <command> on <version>. Uses .nvmrc if available'
diff --git a/plugins/osx/README.md b/plugins/osx/README.md
index f3881ec6b..50e9e7f21 100644
--- a/plugins/osx/README.md
+++ b/plugins/osx/README.md
@@ -1,8 +1,6 @@
# OSX plugin
-## Description
-
-This plugin provides a few utilities to make it more enjoyable on OSX.
+This plugin provides a few utilities to make it more enjoyable on macOS (previously named OSX).
To start using it, add the `osx` plugin to your plugins array in `~/.zshrc`:
@@ -12,6 +10,27 @@ plugins=(... osx)
Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
+## Commands
+
+| Command | Description |
+| :-------------- | :---------------------------------------------------- |
+| `tab` | Open the current directory in a new tab |
+| `split_tab` | Split the current terminal tab horizontally |
+| `vsplit_tab` | Split the current terminal tab vertically |
+| `ofd` | Open the current directory in a Finder window |
+| `pfd` | Return the path of the frontmost Finder window |
+| `pfs` | Return the current Finder selection |
+| `cdf` | `cd` to the current Finder directory |
+| `pushdf` | `pushd` to the current Finder directory |
+| `quick-look` | Quick-Look a specified file |
+| `man-preview` | Open a specified man page in Preview app |
+| `showfiles` | Show hidden files |
+| `hidefiles` | Hide the hidden files |
+| `itunes` | DEPRECATED. Use `music` from macOS Catalina on |
+| `music` | Control Apple Music. Use `music -h` for usage details |
+| `spotify` | Control Spotify and search by artist, album, track… |
+| `rmdsstore` | Remove .DS\_Store files recursively in a directory |
+
## Acknowledgements
This application makes use of the following third party scripts:
@@ -38,25 +57,3 @@ 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.
-
-
-## Commands
-
-| Command | Description |
-| :-------------- | :---------------------------------------------------- |
-| `tab` | Open the current directory in a new tab |
-| `split_tab` | Split the current terminal tab horizontally |
-| `vsplit_tab` | Split the current terminal tab vertically |
-| `ofd` | Open the current directory in a Finder window |
-| `pfd` | Return the path of the frontmost Finder window |
-| `pfs` | Return the current Finder selection |
-| `cdf` | `cd` to the current Finder directory |
-| `pushdf` | `pushd` to the current Finder directory |
-| `quick-look` | Quick-Look a specified file |
-| `man-preview` | Open a specified man page in Preview app |
-| `showfiles` | Show hidden files |
-| `hidefiles` | Hide the hidden files |
-| `itunes` | DEPRECATED. Use `music` from macOS Catalina on |
-| `music` | Control Apple Music. Use `music -h` for usage details |
-| `spotify` | Control Spotify and search by artist, album, track… |
-| `rmdsstore` | Remove .DS\_Store files recursively in a directory |
diff --git a/plugins/pass/_pass b/plugins/pass/_pass
index 5f3b8f541..75f3feb4f 100644
--- a/plugins/pass/_pass
+++ b/plugins/pass/_pass
@@ -18,6 +18,14 @@
# PASSWORD_STORE_DIR=$HOME/work/pass pass $@
# }
+# If you use multiple repositories, you can configure completion like this:
+#
+# compdef _pass workpass
+# zstyle ':completion::complete:workpass::' prefix "$HOME/work/pass"
+# workpass() {
+# PASSWORD_STORE_DIR=$HOME/work/pass pass $@
+# }
+
_pass () {
local cmd
diff --git a/plugins/perms/README.md b/plugins/perms/README.md
index 324b3f3cc..ae7a36b9d 100644
--- a/plugins/perms/README.md
+++ b/plugins/perms/README.md
@@ -1,9 +1,15 @@
-## Perms
+# Perms plugin
-Plugin to handle some unix filesystem permissions quickly
+Plugin to handle some unix filesystem permissions quickly.
-### Usage
+To use it, add `perms` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... perms)
+```
+
+## Usage
* `set755` recursively sets all given directories (default to .) to octal 755.
* `set644` recursively sets all given files (default to .) to octal 644.
-* `fixperms` is a wrapper around `set755` and `set644` applied to a specified directory or the current directory otherwise. It also prompts prior to execution unlike the other two aliases.
+* `fixperms` is a wrapper around `set755` and `set644` applied to a specified directory or the current directory otherwise. It also prompts prior to execution unlike the other two aliases.
diff --git a/plugins/phing/README.md b/plugins/phing/README.md
index e2ac0bdf5..84d1d182d 100644
--- a/plugins/phing/README.md
+++ b/plugins/phing/README.md
@@ -3,6 +3,7 @@
This plugin adds autocompletion for [`phing`](https://github.com/phingofficial/phing) targets.
To use it, add `phing` to the plugins array of your `.zshrc` file:
-```
-plugins=(... eecms)
+
+```zsh
+plugins=(... phing)
```
diff --git a/plugins/pip/_pip b/plugins/pip/_pip
index 607f68e58..a5adead4a 100644
--- a/plugins/pip/_pip
+++ b/plugins/pip/_pip
@@ -89,6 +89,7 @@ case "$words[1]" in
if [[ "$state" == packages ]]; then
_pip_all
_wanted piplist expl 'packages' compadd -a piplist
+ _files -g "*.(tar.gz|whl)"
fi ;;
uninstall)
_pip_installed
diff --git a/plugins/pylint/README.md b/plugins/pylint/README.md
index 8c1de88ba..31710d8a2 100644
--- a/plugins/pylint/README.md
+++ b/plugins/pylint/README.md
@@ -1,6 +1,7 @@
-# pylint
+# pylint
-This plugin adds code analysis for python through [Pylint](https://www.pylint.org/).
+This plugin adds aliases and autocompletion for [Pylint](https://www.pylint.org/),
+the Python code style checking tool.
To use it, add `pylint` to the plugins array in your zshrc file:
@@ -12,4 +13,4 @@ plugins=(... pylint)
| Alias | Command | Description |
| -------------| -------------------- | -------------------------------------------------------------------------------------------------------------------------|
-| pylint-quick | `pylint --reports=n` | Displays a set of reports each one focusing on a particular aspect of the project, default set `no` for multiple reports | |
+| pylint-quick | `pylint --reports=n` | Displays a set of reports each one focusing on a particular aspect of the project, default set `no` for multiple reports |
diff --git a/plugins/pylint/pylint.plugin.zsh b/plugins/pylint/pylint.plugin.zsh
index 57c7c0ac5..14cea5bef 100644
--- a/plugins/pylint/pylint.plugin.zsh
+++ b/plugins/pylint/pylint.plugin.zsh
@@ -1,3 +1 @@
-# Aliases
alias pylint-quick='pylint --reports=n'
-compdef _pylint-quick pylint-quick='pylint --reports=n'
diff --git a/plugins/python/README.md b/plugins/python/README.md
index e391bcfd4..0180218a2 100644
--- a/plugins/python/README.md
+++ b/plugins/python/README.md
@@ -11,7 +11,8 @@ plugins=(... python)
| Command | Description |
|------------------|---------------------------------------------------------------------------------|
+| `ipython` | Runs the appropriate `ipython` version according to the activated virtualenv |
| `pyfind` | Finds .py files recursively in the current directory |
| `pyclean [dirs]` | Deletes byte-code and cache files from a list of directories or the current one |
| `pygrep <text>` | Looks for `text` in .py files |
-| `ipython` | Runs the appropriate `ipython` version according to the activated virtualenv |
+| `pyuserpaths` | Add --user site-packages to PYTHONPATH, for all installed python versions. |
diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh
index 62855fca2..3e4db1e7d 100644
--- a/plugins/python/python.plugin.zsh
+++ b/plugins/python/python.plugin.zsh
@@ -11,6 +11,35 @@ function pyclean() {
find ${ZSH_PYCLEAN_PLACES} -depth -type d -name ".pytest_cache" -exec rm -r "{}" +
}
+# Add the user installed site-packages paths to PYTHONPATH, only if the
+# directory exists. Also preserve the current PYTHONPATH value.
+# Feel free to autorun this when .zshrc loads.
+function pyuserpaths() {
+ local targets=("python2" "python3") # bins
+
+ # Get existing interpreters.
+ local interps=()
+ for target in $targets; do
+ [ `command -v $target` ] && interps+=($target)
+ done
+
+ # Check for a non-standard install directory.
+ local user_base="${HOME}/.local"
+ [ $PYTHONUSERBASE ] && user_base=$PYTHONUSERBASE
+
+ # Add version specific paths, if:
+ # it exists in the filesystem;
+ # it isn't in PYTHONPATH already.
+ for interp in $interps; do
+ # Get minor release version.
+ local ver=`$interp -V 2>&1`
+ ver=`echo ${ver:7} | cut -d '.' -f 1,2` # The patch version is variable length, truncate it.
+
+ local site_pkgs="${user_base}/lib/python${ver}/site-packages"
+ [[ -d $site_pkgs && ! $PYTHONPATH =~ $site_pkgs ]] && export PYTHONPATH=${site_pkgs}:$PYTHONPATH
+ done
+}
+
# Grep among .py files
alias pygrep='grep -r --include="*.py"'
diff --git a/plugins/rails/README.md b/plugins/rails/README.md
index ad83fffe8..9fb1cecf1 100644
--- a/plugins/rails/README.md
+++ b/plugins/rails/README.md
@@ -80,4 +80,3 @@ separately. For example: `REP rake db:migrate` will migrate the production db.
| `ssp` | `ruby script/spec` |
| `sc` | `ruby script/console` |
| `sd` | `ruby script/server --debugger` |
-
diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh
index ed46d355b..b446b6363 100644
--- a/plugins/rbenv/rbenv.plugin.zsh
+++ b/plugins/rbenv/rbenv.plugin.zsh
@@ -47,11 +47,10 @@ if [[ $FOUND_RBENV -eq 1 ]]; then
}
function rbenv_prompt_info() {
- if [[ -n $(current_gemset) ]] ; then
- echo "$(current_ruby)@$(current_gemset)"
- else
- echo "$(current_ruby)"
- fi
+ local ruby=$(current_ruby) gemset=$(current_gemset)
+ echo -n "${ZSH_THEME_RUBY_PROMPT_PREFIX}"
+ [[ -n "$gemset" ]] && echo -n "${ruby}@${gemset}" || echo -n "${ruby}"
+ echo "${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
}
else
alias rubies="ruby -v"
@@ -59,7 +58,11 @@ else
function current_ruby() { echo "not supported" }
function current_gemset() { echo "not supported" }
function gems() { echo "not supported" }
- function rbenv_prompt_info() { echo "system: $(ruby -v | cut -f-2 -d ' ')" }
+ function rbenv_prompt_info() {
+ echo -n "${ZSH_THEME_RUBY_PROMPT_PREFIX}"
+ echo -n "system: $(ruby -v | cut -f-2 -d ' ')"
+ echo "${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
+ }
fi
unset FOUND_RBENV rbenvdirs dir
diff --git a/plugins/repo/README.md b/plugins/repo/README.md
index 4d9366adf..6abd23319 100644
--- a/plugins/repo/README.md
+++ b/plugins/repo/README.md
@@ -1,7 +1,25 @@
-## repo
-**Maintainer:** [Stibbons](https://github.com/Stibbons)
+# repo plugin
-This plugin mainly add support automatic completion for the repo command line tool:
-https://code.google.com/p/git-repo/
+This plugin mainly adds some aliases and support for automatic completion for
+the [repo command line tool](https://code.google.com/p/git-repo/).
-* `r` aliases `repo`
+To use it, add `repo` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... repo)
+```
+
+## Aliases
+
+| Alias | Command |
+|---------|----------------------------------------|
+| `r` | `repo` |
+| `rra` | `repo rebase --auto-stash` |
+| `rs` | `repo sync` |
+| `rsrra` | `repo sync ; repo rebase --auto-stash` |
+| `ru` | `repo upload` |
+| `rst` | `repo status` |
+| `rsto` | `repo status -o` |
+| `rfa` | `repo forall -c` |
+| `rfap` | `repo forall -p -c` |
+| `rinf` | `repo info` |
diff --git a/plugins/repo/_repo b/plugins/repo/_repo
index 59e39c954..db0ecd14d 100644
--- a/plugins/repo/_repo
+++ b/plugins/repo/_repo
@@ -1,6 +1,5 @@
#compdef repo
-
__git_apply_whitespace_strategies ()
{
declare -a strategies
@@ -269,4 +268,3 @@ __repo_projects_or_all()
_repo "$@"
return $?
-
diff --git a/plugins/repo/repo.plugin.zsh b/plugins/repo/repo.plugin.zsh
index 51cd32fc4..f098993f8 100644
--- a/plugins/repo/repo.plugin.zsh
+++ b/plugins/repo/repo.plugin.zsh
@@ -1,30 +1,10 @@
-# Aliases
alias r='repo'
-compdef _repo r=repo
-
alias rra='repo rebase --auto-stash'
-compdef _repo rra='repo rebase --auto-stash'
-
alias rs='repo sync'
-compdef _repo rs='repo sync'
-
alias rsrra='repo sync ; repo rebase --auto-stash'
-compdef _repo rsrra='repo sync ; repo rebase --auto-stash'
-
alias ru='repo upload'
-compdef _repo ru='repo upload'
-
alias rst='repo status'
-compdef _repo rst='repo status'
-
alias rsto='repo status -o'
-compdef _repo rsto='repo status -o'
-
alias rfa='repo forall -c'
-compdef _repo rfa='repo forall -c'
-
alias rfap='repo forall -p -c'
-compdef _repo rfap='repo forall -p -c'
-
alias rinf='repo info'
-compdef _repo rinf='repo info'
diff --git a/plugins/rvm/README.md b/plugins/rvm/README.md
index 9d6fd8f85..1ed8d46a2 100644
--- a/plugins/rvm/README.md
+++ b/plugins/rvm/README.md
@@ -8,7 +8,8 @@ To use it, add `rvm` to the plugins array in your zshrc file:
plugins=(... rvm)
```
-## Functions
+## Aliases
+
| Alias | Command |
|----------------|----------------------|
| `rb18` | `rvm use ruby-1.8.7` |
diff --git a/plugins/scala/README.md b/plugins/scala/README.md
index 957261d9e..91a322162 100644
--- a/plugins/scala/README.md
+++ b/plugins/scala/README.md
@@ -1,15 +1,16 @@
-## Scala plugin
+# Scala plugin
Completion script for [scala and scalac](https://www.scala-lang.org/) commands.
To use it, add `scala` to the plugins array of your zshrc file:
-```
+
+```zsh
plugins=(... scala)
```
## Aliases
-| Command | Description |
-|------------------|---------------------------------------------------------------------------------|
-| `scala` | Run code in the Scala language |
-| `scalac` | Compiler for the Scala language |
+| Command | Description |
+|----------|---------------------------------|
+| `scala` | Run code in the Scala language |
+| `scalac` | Compiler for the Scala language |
diff --git a/plugins/sdk/README.md b/plugins/sdk/README.md
index b237f3b4c..1eda5d390 100644
--- a/plugins/sdk/README.md
+++ b/plugins/sdk/README.md
@@ -3,6 +3,12 @@
Plugin for SDKMAN, a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems.
Provides autocompletion for all known commands.
+To use it, add `sdk` to your plugins array in your zshrc file:
+
+```zsh
+plugins=(... sdk)
+```
+
## Requirements
- * [SDKMAN](http://sdkman.io/)
+* [SDKMAN](http://sdkman.io/)
diff --git a/plugins/sdk/sdk.plugin.zsh b/plugins/sdk/sdk.plugin.zsh
index d00459b16..e49caaf2f 100644
--- a/plugins/sdk/sdk.plugin.zsh
+++ b/plugins/sdk/sdk.plugin.zsh
@@ -7,10 +7,10 @@
# sdk offline <enable|disable>
#
# commands:
-# install or i <candidate> [version]
+# install or i <candidate> [version] [local-path]
# uninstall or rm <candidate> <version>
# list or ls [candidate]
-# use or u <candidate> [version]
+# use or u <candidate> <version>
# default or d <candidate> [version]
# current or c [candidate]
# upgrade or ug [candidate]
@@ -20,14 +20,15 @@
# offline [enable|disable]
# selfupdate [force]
# update
-# flush <candidates|broadcast|archives|temp>
+# flush <broadcast|archives|temp>
#
# candidate : the SDK to install: groovy, scala, grails, gradle, kotlin, etc.
# use list command for comprehensive list of candidates
# eg: $ sdk list
-#
# version : where optional, defaults to latest stable if not provided
# eg: $ sdk install groovy
+# local-path : optional path to an existing local installation
+# eg: $ sdk install groovy 2.4.13-local /opt/groovy-2.4.13
local _sdk_commands=(
install i
@@ -51,12 +52,13 @@ _listInstalledVersions() {
}
_listInstallableVersions() {
- __sdkman_list_versions $1 | grep "^ " | sed -e "s/\* /*/g" | \
- sed -e "s/>//g" | xargs -n 1 echo | grep -v "^*"
+ # Remove local (+) and installed (*) versions from the list
+ __sdkman_list_versions $1 | sed -e '/^[^ ]/d;s/[+*] [^ ]\+//g;s/>//g'
}
_listAllVersion() {
- __sdkman_list_versions $1 | grep "^ " | sed -e "s/\*/ /g" | sed -e "s/>//g"
+ # Remove (*), (+), and (>) characters from the list
+ __sdkman_list_versions $1 | sed -e '/^[^ ]/d;s/[*+>] //g'
}
_sdk () {
@@ -67,7 +69,7 @@ _sdk () {
compadd -- $SDKMAN_CANDIDATES ;;
offline) compadd -- enable disable ;;
selfupdate) compadd -- force ;;
- flush) compadd -- candidates broadcast archives temp ;;
+ flush) compadd -- broadcast archives temp ;;
esac
;;
4) case "$words[2]" in
diff --git a/plugins/shrink-path/README.md b/plugins/shrink-path/README.md
index b990aea91..33dc3f8ae 100644
--- a/plugins/shrink-path/README.md
+++ b/plugins/shrink-path/README.md
@@ -7,19 +7,26 @@ For this directory tree:
```
/home/
me/
- foo/
+ f o o/ # The prefix f is ambiguous between "f o o" and "f i g".
bar/
quux/
biz/ # The prefix b is ambiguous between bar and biz.
+ f i g/
+ baz/
```
here are the results of calling `shrink_path <option> /home/me/foo/bar/quux`:
```
Option Result
- <none> /h/m/f/ba/q
- -l|--last /h/m/f/ba/quux
+ <none> /h/m/f o/ba/q
+ -l|--last /h/m/f o/ba/q
-s|--short /h/m/f/b/q
- -t|--tilde ~/f/ba/q
+ -t|--tilde ~/f o/ba/q
-f|--fish ~/f/b/quux
+ -g|--glob /h*/m*/f o*/ba*/q*
+ -3 /hom/me/f o/bar/quu
+ -e '$' -3 /hom$/me/f o$/bar/quu$
+ -q /h/m/f\ o/ba/q
+ -g -q /h*/m*/f\ o*/ba*/q*
```
@@ -37,11 +44,16 @@ The following options are available:
```
-f, --fish fish simulation, equivalent to -l -s -t.
+ -g, --glob Add asterisk to allow globbing of shrunk path (equivalent to -e "*")
-l, --last Print the last directory's full name.
- -s, --short Truncate directory names to the first character. Without
+ -s, --short Truncate directory names to the number of characters given by -. Without
-s, names are truncated without making them ambiguous.
-t, --tilde Substitute ~ for the home directory.
-T, --nameddirs Substitute named directories as well.
+ -# Truncate each directly to at least this many characters inclusive of the
+ ellipsis character(s) (defaulting to 1).
+ -e SYMBOL Postfix symbol(s) to indicate that a directory name had been truncated.
+ -q, --quote Quote special characters in the shrunk path
```
The long options can also be set via zstyle, like
@@ -56,6 +68,7 @@ supported.
## License
Copyright (C) 2008 by Daniel Friesel <derf@xxxxxxxxxxxxxxxxxx>
+Copyright (C) 2018-2020 by Pavel N. Krivitsky
License: WTFPL <http://www.wtfpl.net>
diff --git a/plugins/shrink-path/shrink-path.plugin.zsh b/plugins/shrink-path/shrink-path.plugin.zsh
index 86102e651..f0ed65138 100644
--- a/plugins/shrink-path/shrink-path.plugin.zsh
+++ b/plugins/shrink-path/shrink-path.plugin.zsh
@@ -9,11 +9,16 @@
# The following options are available:
#
# -f, --fish fish simulation, equivalent to -l -s -t.
+# -g, --glob Add asterisk to allow globbing of shrunk path (equivalent to -e "*")
# -l, --last Print the last directory's full name.
-# -s, --short Truncate directory names to the first character. Without
+# -s, --short Truncate directory names to the number of characters given by -#. Without
# -s, names are truncated without making them ambiguous.
# -t, --tilde Substitute ~ for the home directory.
# -T, --nameddirs Substitute named directories as well.
+# -# Truncate each directly to at least this many characters inclusive of the
+# ellipsis character(s) (defaulting to 1).
+# -e SYMBOL Postfix symbol(s) to indicate that a directory name had been truncated.
+# -q, --quote Quote special characters in the shrunk path
#
# The long options can also be set via zstyle, like
# zstyle :prompt:shrink_path fish yes
@@ -37,6 +42,9 @@ shrink_path () {
typeset -i short=0
typeset -i tilde=0
typeset -i named=0
+ typeset -i length=1
+ typeset ellipsis=""
+ typeset -i quote=0
if zstyle -t ':prompt:shrink_path' fish; then
lastfull=1
@@ -50,9 +58,15 @@ shrink_path () {
zstyle -t ':prompt:shrink_path' last && lastfull=1
zstyle -t ':prompt:shrink_path' short && short=1
zstyle -t ':prompt:shrink_path' tilde && tilde=1
+ zstyle -t ':prompt:shrink_path' glob && ellipsis='*'
+ zstyle -t ':prompt:shrink_path' quote && quote=1
while [[ $1 == -* ]]; do
case $1 in
+ --)
+ shift
+ break
+ ;;
-f|--fish)
lastfull=1
short=1
@@ -61,10 +75,16 @@ shrink_path () {
-h|--help)
print 'Usage: shrink_path [-f -l -s -t] [directory]'
print ' -f, --fish fish-simulation, like -l -s -t'
+ print ' -g, --glob Add asterisk to allow globbing of shrunk path (equivalent to -e "*")'
print ' -l, --last Print the last directory''s full name'
- print ' -s, --short Truncate directory names to the first character'
+ print ' -s, --short Truncate directory names to the number of characters given by -#. Without'
+ print ' -s, names are truncated without making them ambiguous.'
print ' -t, --tilde Substitute ~ for the home directory'
print ' -T, --nameddirs Substitute named directories as well'
+ print ' -# Truncate each directly to at least this many characters inclusive of the'
+ print ' ellipsis character(s) (defaulting to 1).'
+ print ' -e SYMBOL Postfix symbol(s) to indicate that a directory name had been truncated.'
+ print ' -q, --quote Quote special characters in the shrunk path'
print 'The long options can also be set via zstyle, like'
print ' zstyle :prompt:shrink_path fish yes'
return 0
@@ -76,10 +96,24 @@ shrink_path () {
tilde=1
named=1
;;
+ -[0-9]|-[0-9][0-9])
+ length=${1/-/}
+ ;;
+ -e)
+ shift
+ ellipsis="$1"
+ ;;
+ -g|--glob)
+ ellipsis='*'
+ ;;
+ -q|--quote)
+ quote=1
+ ;;
esac
shift
done
+ typeset -i elllen=${#ellipsis}
typeset -a tree expn
typeset result part dir=${1-$PWD}
typeset -i i
@@ -109,12 +143,22 @@ shrink_path () {
expn=(a b)
part=''
i=0
- until [[ (( ${#expn} == 1 )) || $dir = $expn || $i -gt 99 ]] do
+ until [[ $i -gt 99 || ( $i -ge $((length - ellen)) || $dir == $part ) && ( (( ${#expn} == 1 )) || $dir = $expn ) ]]; do
(( i++ ))
part+=$dir[$i]
expn=($(echo ${part}*(-/)))
- (( short )) && break
+ (( short )) && [[ $i -ge $((length - ellen)) ]] && break
done
+
+ typeset -i dif=$(( ${#dir} - ${#part} - ellen ))
+ if [[ $dif -gt 0 ]]
+ then
+ (( quote )) && part=${(q)part}
+ part+="$ellipsis"
+ else
+ part="$dir"
+ (( quote )) && part=${(q)part}
+ fi
result+="/$part"
cd -q $dir
shift tree
diff --git a/plugins/sprunge/README.md b/plugins/sprunge/README.md
index 2a363d3bd..28ed1834a 100644
--- a/plugins/sprunge/README.md
+++ b/plugins/sprunge/README.md
@@ -3,7 +3,8 @@
This plugin uploads data and fetch URL from the pastebin http://sprunge.us
To enable it, add 'sprunge' to your plugins:
-```
+
+```zsh
plugins=(... sprunge)
```
diff --git a/plugins/stack/stack.plugin.zsh b/plugins/stack/stack.plugin.zsh
index a149208d0..4e812880e 100644
--- a/plugins/stack/stack.plugin.zsh
+++ b/plugins/stack/stack.plugin.zsh
@@ -1,37 +1,2 @@
-function _stack_commands() {
- local ret=1 state
- _arguments ':subcommand:->subcommand' && ret=0
-
- case $state in
- subcommand)
- subcommands=(
- "build:Build the project(s) in this directory/configuration"
- "install:Build executables and install to a user path"
- "test:Build and test the project(s) in this directory/configuration"
- "bench:Build and benchmark the project(s) in this directory/configuration"
- "haddock:Generate haddocks for the project(s) in this directory/configuration"
- "new:Create a brand new project"
- "init:Initialize a stack project based on one or more stack packages"
- "solver:Use a dependency solver to try and determine missing extra-deps"
- "setup:Get the appropriate ghc for your project"
- "path:Print out handy path information"
- "unpack:Unpack one or more packages locally"
- "update:Update the package index"
- "upgrade:Upgrade to the latest stack (experimental)"
- "upload:Upload a package to Hackage"
- "dot:Visualize your project's dependency graph using Graphviz dot"
- "exec:Execute a command"
- "ghc:Run ghc"
- "ghci:Run ghci in the context of project(s)"
- "ide:Run ide-backend-client with the correct arguments"
- "runghc:Run runghc"
- "clean:Clean the local packages"
- "docker:Subcommands specific to Docker use"
- )
- _describe -t subcommands 'stack subcommands' subcommands && ret=0
- esac
-
- return ret
-}
-
-compdef _stack_commands stack
+autoload -U +X bashcompinit && bashcompinit
+source <(stack --bash-completion-script stack)
diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh
index dd5063360..179342595 100644
--- a/plugins/sublime/sublime.plugin.zsh
+++ b/plugins/sublime/sublime.plugin.zsh
@@ -29,6 +29,8 @@ alias stn=create_project
"/usr/local/bin/sublime_text"
"/usr/bin/subl"
"/usr/bin/subl3"
+ "/snap/bin/subl"
+ "/snap/bin/sublime-text.subl"
)
fi
elif [[ "$OSTYPE" = darwin* ]]; then
diff --git a/plugins/sudo/README.md b/plugins/sudo/README.md
index 25eb85829..4f3973ef8 100644
--- a/plugins/sudo/README.md
+++ b/plugins/sudo/README.md
@@ -2,25 +2,13 @@
Easily prefix your current or previous commands with `sudo` by pressing <kbd>esc</kbd> twice
-## Enabling the plugin
+To use it, add `sudo` to the plugins array in your zshrc file:
-1. Open your `.zshrc` file and add `sudo` in the plugins section:
-
- ```zsh
- plugins=(
- # all your enabled plugins
- sudo
- )
- ```
-
-2. Restart your shell or restart your Terminal session:
-
- ```console
- $ exec zsh
- $
- ```
+```zsh
+plugins=(... sudo)
+```
-## Usage examples
+## Usage
### Current typed commands
diff --git a/plugins/supervisor/README.md b/plugins/supervisor/README.md
index 1eacea6d3..a060ff483 100644
--- a/plugins/supervisor/README.md
+++ b/plugins/supervisor/README.md
@@ -5,6 +5,7 @@ Supervisor is a client/server system that allows its users to monitor and contro
of processes on UNIX-like operating systems.
To use it, add `supervisor` to the plugins array in your zshrc file:
+
```zsh
plugins=(... supervisor)
```
diff --git a/plugins/svn-fast-info/README.md b/plugins/svn-fast-info/README.md
index 04c596fd8..771378254 100644
--- a/plugins/svn-fast-info/README.md
+++ b/plugins/svn-fast-info/README.md
@@ -4,6 +4,7 @@ Faster alternative to the main SVN plugin implementation. Works with svn 1.6 and
Use as a drop-in replacement to the svn plugin, not as complementary.
To use it, add `svn-fast-info` to the plugins array in your zshrc file:
+
```zsh
plugins=(... svn-fast-info)
```
diff --git a/plugins/systemd/systemd.plugin.zsh b/plugins/systemd/systemd.plugin.zsh
index f2d1d6f1c..c6fd52990 100644
--- a/plugins/systemd/systemd.plugin.zsh
+++ b/plugins/systemd/systemd.plugin.zsh
@@ -78,7 +78,7 @@ function systemd_prompt_info {
local unit
for unit in $@; do
echo -n "$ZSH_THEME_SYSTEMD_PROMPT_PREFIX"
- [[ -n "$ZSH_THEME_SYSTEMD_PROMPT_CAPS" ]] && echo "${(U)unit}:" || echo "$unit:"
+ [[ -n "$ZSH_THEME_SYSTEMD_PROMPT_CAPS" ]] && echo -n "${(U)unit}:" || echo -n "$unit:"
if systemctl is-active $unit &>/dev/null; then
echo -n "$ZSH_THEME_SYSTEMD_PROMPT_ACTIVE"
else
diff --git a/plugins/taskwarrior/README.md b/plugins/taskwarrior/README.md
index 2a86510dd..e77e4528a 100644
--- a/plugins/taskwarrior/README.md
+++ b/plugins/taskwarrior/README.md
@@ -4,10 +4,15 @@ This plugin adds smart tab completion for [TaskWarrior](https://taskwarrior.org/
It uses the zsh tab completion script (`_task`) shipped with TaskWarrior for the
completion definitions.
-The latest version pulled in from the official project is of January 1st, 2015.
+To use it, add `taskwarrior` to the plugins array in your zshrc file:
+```zsh
+plugins=(... taskwarrior)
+```
## Examples
Typing `task [TAB]` will give you a list of commands, `task 66[TAB]` shows a
list of available modifications for that task, etcetera.
+
+The latest version pulled in from the official project is of January 1st, 2015.
diff --git a/plugins/taskwarrior/_task b/plugins/taskwarrior/_task
index c38d6cad9..e0fea179a 100644
--- a/plugins/taskwarrior/_task
+++ b/plugins/taskwarrior/_task
@@ -1,6 +1,6 @@
#compdef task
#
-# Copyright 2010 - 2016 Johannes Schlatow
+# Copyright 2010 - 2019 Johannes Schlatow
# Copyright 2009 P.C. Shyamshankar
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -24,7 +24,7 @@
# https://www.opensource.org/licenses/mit-license.php
#
typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers
-_task_projects=($(task _projects))
+_task_projects=(${(f)"$(task _projects)"})
_task_tags=($(task _tags))
_task_zshids=( ${(f)"$(task _zshids)"} )
_task_config=($(task _config))
diff --git a/plugins/textmate/README.md b/plugins/textmate/README.md
index 9fd342135..e6c1943f4 100644
--- a/plugins/textmate/README.md
+++ b/plugins/textmate/README.md
@@ -3,7 +3,8 @@
The plugin adds a function for the [TextMate](https://macromates.com) editor.
To use it, add `textmate` to the plugins array of your zshrc file:
-```
+
+```zsh
plugins=(... textmate)
```
diff --git a/plugins/themes/themes.plugin.zsh b/plugins/themes/themes.plugin.zsh
index 1fbde5b64..650856284 100644
--- a/plugins/themes/themes.plugin.zsh
+++ b/plugins/themes/themes.plugin.zsh
@@ -23,5 +23,13 @@ function lstheme {
# Resources:
# http://zsh.sourceforge.net/Doc/Release/Expansion.html#Modifiers
# http://zsh.sourceforge.net/Doc/Release/Expansion.html#Glob-Qualifiers
- print "$ZSH_CUSTOM"/*.zsh-theme(N:t:r) {"$ZSH_CUSTOM","$ZSH"}/themes/*.zsh-theme(N:t:r)
+ {
+ # Show themes inside $ZSH_CUSTOM (in any subfolder)
+ # Strip $ZSH_CUSTOM/themes/ and $ZSH_CUSTOM/ from the name, so that it matches
+ # the value that should be written in $ZSH_THEME to load the theme.
+ print -l "$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::)
+
+ # Show themes inside $ZSH, stripping the head of the path.
+ print -l "$ZSH"/themes/*.zsh-theme(.N:t:r)
+ } | sort -u | fmt -w $COLUMNS
}
diff --git a/plugins/tig/README.md b/plugins/tig/README.md
index bb24cd147..3323fd098 100644
--- a/plugins/tig/README.md
+++ b/plugins/tig/README.md
@@ -1,6 +1,6 @@
# `tig` plugin
-This plugin adds some aliases for people who work with `tig` in
+This plugin adds some aliases for people who work with [`tig`](https://jonas.github.io/tig/) (text-mode interface for Git) in
a regular basis. To use it, add `tig` to your plugins array:
```zsh
diff --git a/plugins/tmux/README.md b/plugins/tmux/README.md
index db57f5be2..2ceaf1ad5 100644
--- a/plugins/tmux/README.md
+++ b/plugins/tmux/README.md
@@ -7,7 +7,8 @@ To use it add `tmux` to the plugins array in your zshrc file.
plugins=(... tmux)
```
-The plugin also supports the following -
+The plugin also supports the following:
+
- determines if tmux is installed or not, if not, prompts user to install tmux
- determines if the terminal supports the 256 colors or not, sets the appropriate configuration variable
- sets the correct local config file to use
@@ -24,7 +25,6 @@ The plugin also supports the following -
| `tkss` | tmux kill-session -t | Terminate named running tmux session |
| `tmux` | `_zsh_tmux_plugin_run` | Start a new tmux session |
-
## Configuration Variables
| Variable | Description |
diff --git a/plugins/tmuxinator/README.md b/plugins/tmuxinator/README.md
index 994d8d46d..8709204a0 100644
--- a/plugins/tmuxinator/README.md
+++ b/plugins/tmuxinator/README.md
@@ -11,9 +11,9 @@ plugins=(... tmuxinator)
## Aliases
-| Alias | Command | Description |
-| ------ | ---------------- | ------------------------ |
-| `txs ` | tmuxinator start | Start Tmuxinator |
-| `txo ` | tmuxinator open | Open project for editing |
-| `txn ` | tmuxinator new | Create project |
-| `txl ` | tmuxinator list | List projects |
+| Alias | Command | Description |
+| ----- | ---------------- | ------------------------ |
+| `txs` | tmuxinator start | Start Tmuxinator |
+| `txo` | tmuxinator open | Open project for editing |
+| `txn` | tmuxinator new | Create project |
+| `txl` | tmuxinator list | List projects |
diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
index 267bcaeb5..2cbfc47d5 100644
--- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
+++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
@@ -5,7 +5,8 @@ function {
/usr/share/virtualenvwrapper/virtualenvwrapper{_lazy,}.sh \
/usr/local/bin/virtualenvwrapper{_lazy,}.sh \
/etc/bash_completion.d/virtualenvwrapper \
- /usr/share/bash-completion/completions/virtualenvwrapper
+ /usr/share/bash-completion/completions/virtualenvwrapper \
+ $HOME/.local/bin/virtualenvwrapper.sh
do
if [[ -f $f ]]; then
source $f
diff --git a/plugins/wakeonlan/README b/plugins/wakeonlan/README.md
index 16fdd4587..3fcb6d7f1 100644
--- a/plugins/wakeonlan/README
+++ b/plugins/wakeonlan/README.md
@@ -1,9 +1,17 @@
+# wakeonlan
+
This plugin provides a wrapper around the "wakeonlan" tool available from most
-distributions' package repositories, or from the following website:
+distributions' package repositories, or from [the following website](https://github.com/jpoliv/wakeonlan).
+
+To use it, add `wakeonlan` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... wakeonlan)
+```
-http://gsd.di.uminho.pt/jpo/software/wakeonlan/
+## Usage
-In order to use this wrapper, create the ~/.wakeonlan directory, and place in
+In order to use this wrapper, create the `~/.wakeonlan` directory, and place in
that directory one file for each device you would like to be able to wake. Give
the file a name that describes the device, such as its hostname. Each file
should contain a line with the mac address of the target device and the network
@@ -12,15 +20,21 @@ broadcast address.
For instance, there might be a file ~/.wakeonlan/leto with the following
contents:
+```
00:11:22:33:44:55:66 192.168.0.255
+```
To wake that device, use the following command:
-# wake leto
+```console
+$ wake leto
+```
The available device names will be autocompleted, so:
-# wake <tab>
+```console
+$ wake <tab>
+```
...will suggest "leto", along with any other configuration files that were
placed in the ~/.wakeonlan directory.
diff --git a/plugins/yii/README.md b/plugins/yii/README.md
index f1b72e916..9636149ca 100644
--- a/plugins/yii/README.md
+++ b/plugins/yii/README.md
@@ -3,7 +3,8 @@
The plugin adds autocomplete commands and subcommands for [yii](https://www.yiiframework.com/).
To use it, add `yii` to the plugins array of your zshrc file:
-```
+
+```zsh
plugins=(... yii)
```
diff --git a/plugins/yii2/yii2.plugin.zsh b/plugins/yii2/yii2.plugin.zsh
index e8993adf4..713f2ef2a 100644
--- a/plugins/yii2/yii2.plugin.zsh
+++ b/plugins/yii2/yii2.plugin.zsh
@@ -26,4 +26,4 @@ _yii2 () {
fi
}
-compdef _yii2 yii \ No newline at end of file
+compdef _yii2 yii
diff --git a/plugins/yum/README.md b/plugins/yum/README.md
index 8043421d8..fec584911 100644
--- a/plugins/yum/README.md
+++ b/plugins/yum/README.md
@@ -4,7 +4,7 @@ This plugin adds useful aliases for common [Yum](http://yum.baseurl.org/) comman
To use it, add `yum` to the plugins array in your zshrc file:
-```
+```zsh
plugins=(... yum)
```
diff --git a/plugins/z/README.md b/plugins/z/README.md
new file mode 100644
index 000000000..ea8d4610a
--- /dev/null
+++ b/plugins/z/README.md
@@ -0,0 +1,23 @@
+# z - jump around
+
+This plugin defines the [z command](https://github.com/rupa/z) that tracks your most visited directories and allows you to access them with very few keystrokes.
+
+### Example
+Assume that you have previously visited directory `~/.oh-my-zsh/plugins`. From any folder in your command line, you can quickly access it by using a regex match to this folder:
+
+```bash
+/usr/bin$ z plug # Even 'z p' might suffice
+~/.oh-my-zsh/plugins$
+```
+
+### Setup
+To enable z, add `z` to your `plugins` array in your zshrc file:
+
+```zsh
+plugins=(... z)
+```
+
+### Further reading
+
+For advanced usage and details of z, see [README](./README) (in man page format, copied from [rupa/z](https://github.com/rupa/z)).
+
diff --git a/plugins/zeus/README.md b/plugins/zeus/README.md
index 84ed70c91..0131f70d5 100644
--- a/plugins/zeus/README.md
+++ b/plugins/zeus/README.md
@@ -1,57 +1,50 @@
-## zeus
-**Maintainer:** [b4mboo](https://github.com/b4mboo)
-
-* `zi` aliases `zeus init`
-* `zinit` aliases `zeus init`
-
-* `zs` aliases `zeus start`
-* `ztart` aliases `zeus start`
-
-* `zc` aliases `zeus console`
-* `zonsole` aliases `zeus console`
-
-* `zsr` aliases `zeus server`
-* `zerver` aliases `zeus server`
-
-* `zr` aliases `zeus rake`
-* `zake` aliases `zeus rake`
-
-* `zg` aliases `zeus generate`
-* `zenerate` aliases `zeus generate`
-
-* `zrn` aliases `zeus runner`
-* `zunner` aliases `zeus runner`
-
-* `zcu` aliases `zeus cucumber`
-* `zucumber` aliases `zeus cucumber`
-* `zwip` aliases `zeus cucumber --profile wip`
-
-* `zspec` aliases `zeus rspec`
-
-* `zt` aliases `zeus test`
-* `zest` aliases `zeus test`
-
-* `zu` aliases `zeus test test/unit/*`
-* `zunits` aliases `zeus test test/unit/*`
-
-* `zf` aliases `zeus test test/functional/*`
-* `zunctional` aliases `zeus test test/functional/*`
-
-* `za` aliases `zeus test test/unit/*; zeus test test/functional/; zeus cucumber`
-* `zall` aliases `zeus test test/unit/*; zeus test test/functional/; zeus cucumber`
-
-* `zsw` aliases `rm .zeus.sock`
-* `zweep` aliases `rm .zeus.sock`
-
-* `zdbr` aliases `zeus rake db:reset db:test:prepare`
-* `zdbreset` aliases `zeus rake db:reset db:test:prepare`
-
-* `zdbm` aliases `zeus rake db:migrate db:test:prepare`
-* `zdbmigrate` aliases `zeus rake db:migrate db:test:prepare`
-
-* `zdbc` aliases `zeus rake db:create`
-
-* `zdbcm` aliases `zeus rake db:create db:migrate db:test:prepare`
-
-## Installation
-Add zeus to the plugins line of your `.zshconfig` file (e.g. `plugins=(rails git zeus)`)
+# zeus plugin
+
+[Zeus](https://github.com/burke/zeus) preloads your Rails environment and forks that
+process whenever needed. This effectively speeds up Rails' boot process to under 1 sec.
+This plugin adds autocompletion for zeus and aliases for common usage.
+
+To use it, add `zeus` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... zeus)
+```
+
+You also need to have the `zeus` gem installed.
+
+| Alias | Command |
+|:-------------|:-------------------------------------------------------------------|
+| _zi_ | `zeus init` |
+| _zinit_ | `zeus init` |
+| _zs_ | `zeus start` |
+| _ztart_ | `zeus start` |
+| _zc_ | `zeus console` |
+| _zonsole_ | `zeus console` |
+| _zsr_ | `zeus server` |
+| _zerver_ | `zeus server` |
+| _zr_ | `noglob zeus rake` |
+| _zake_ | `noglob zeus rake` |
+| _zg_ | `zeus generate` |
+| _zenerate_ | `zeus generate` |
+| _zrn_ | `zeus runner` |
+| _zunner_ | `zeus runner` |
+| _zcu_ | `zeus cucumber` |
+| _zucumber_ | `zeus cucumber` |
+| _zwip_ | `zeus cucumber --profile wip` |
+| _zspec_ | `zeus rspec` |
+| _zt_ | `zeus test` |
+| _zest_ | `zeus test` |
+| _zu_ | `zeus test test/unit/*` |
+| _zunits_ | `zeus test test/unit/*` |
+| _zf_ | `zeus test test/functional/*` |
+| _zunctional_ | `zeus test test/functional/*` |
+| _za_ | `zeus test test/unit/*; zeus test test/functional/; zeus cucumber` |
+| _zall_ | `zeus test test/unit/*; zeus test test/functional/; zeus cucumber` |
+| _zsw_ | `rm .zeus.sock` |
+| _zweep_ | `rm .zeus.sock` |
+| _zdbr_ | `zeus rake db:reset db:test:prepare` |
+| _zdbreset_ | `zeus rake db:reset db:test:prepare` |
+| _zdbm_ | `zeus rake db:migrate db:test:prepare` |
+| _zdbmigrate_ | `zeus rake db:migrate db:test:prepare` |
+| _zdbc_ | `zeus rake db:create` |
+| _zdbcm_ | `zeus rake db:create db:migrate db:test:prepare` |
diff --git a/plugins/zsh_reload/zsh_reload.plugin.zsh b/plugins/zsh_reload/zsh_reload.plugin.zsh
index 51048ba9d..83f8da733 100644
--- a/plugins/zsh_reload/zsh_reload.plugin.zsh
+++ b/plugins/zsh_reload/zsh_reload.plugin.zsh
@@ -3,7 +3,7 @@ src() {
autoload -U compinit zrecompile
compinit -i -d "$cache/zcomp-$HOST"
- for f in ~/.zshrc "$cache/zcomp-$HOST"; do
+ for f in ${ZDOTDIR:-~}/.zshrc "$cache/zcomp-$HOST"; do
zrecompile -p $f && command rm -f $f.zwc.old
done
diff --git a/themes/nebirhos.zsh-theme b/themes/nebirhos.zsh-theme
index e2424465a..fc05e7955 100644
--- a/themes/nebirhos.zsh-theme
+++ b/themes/nebirhos.zsh-theme
@@ -11,7 +11,7 @@ else
fi
# Get the host name (first 4 chars)
-HOST_PROMPT_="%{$fg_bold[red]%}@$HOST ➜ %{$fg_bold[cyan]%}%c "
+HOST_PROMPT_="%{$fg_bold[red]%}@%m ➜ %{$fg_bold[cyan]%}%c "
GIT_PROMPT="%{$fg_bold[blue]%}\$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}"
PROMPT="$HOST_PROMPT_$RUBY_PROMPT_$GIT_PROMPT"
diff --git a/themes/random.zsh-theme b/themes/random.zsh-theme
index 43f6cbb60..6cb7cc579 100644
--- a/themes/random.zsh-theme
+++ b/themes/random.zsh-theme
@@ -3,7 +3,7 @@ typeset -Ua themes
if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = array && ${#ZSH_THEME_RANDOM_CANDIDATES[@]} -gt 0 ]]; then
# Use ZSH_THEME_RANDOM_CANDIDATES if properly defined
- themes=($ZSH_THEME_RANDOM_CANDIDATES)
+ themes=(${(@)ZSH_THEME_RANDOM_CANDIDATES:#random})
else
# Look for themes in $ZSH_CUSTOM and $ZSH and add only the theme name
themes=(
@@ -12,7 +12,7 @@ else
"$ZSH"/themes/*.zsh-theme(N:t:r)
)
# Remove blacklisted themes from the list
- for theme in ${ZSH_THEME_RANDOM_BLACKLIST[@]}; do
+ for theme in random ${ZSH_THEME_RANDOM_BLACKLIST[@]}; do
themes=("${(@)themes:#$theme}")
done
fi
diff --git a/tools/upgrade.sh b/tools/upgrade.sh
index 0dc84e214..10f816080 100644
--- a/tools/upgrade.sh
+++ b/tools/upgrade.sh
@@ -1,23 +1,20 @@
# Use colors, but only if connected to a terminal, and that terminal
# supports them.
-if which tput >/dev/null 2>&1; then
- ncolors=$(tput colors)
-fi
-if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
- RED="$(tput setaf 1)"
- GREEN="$(tput setaf 2)"
- YELLOW="$(tput setaf 3)"
- BLUE="$(tput setaf 4)"
- BOLD="$(tput bold)"
- NORMAL="$(tput sgr0)"
+if [ -t 1 ]; then
+ RED=$(printf '\033[31m')
+ GREEN=$(printf '\033[32m')
+ YELLOW=$(printf '\033[33m')
+ BLUE=$(printf '\033[34m')
+ BOLD=$(printf '\033[1m')
+ RESET=$(printf '\033[m')
else
RED=""
GREEN=""
YELLOW=""
BLUE=""
BOLD=""
- NORMAL=""
+ RESET=""
fi
cd "$ZSH"
@@ -30,6 +27,9 @@ git config core.autocrlf false
git config fsck.zeroPaddedFilemode ignore
git config fetch.fsck.zeroPaddedFilemode ignore
git config receive.fsck.zeroPaddedFilemode ignore
+# autostash on rebase (#7172)
+resetAutoStash=$(git config --bool rebase.autoStash 2>&1)
+git config rebase.autoStash true
# Update upstream remote to ohmyzsh org
remote=$(git remote -v | awk '/https:\/\/github\.com\/robbyrussell\/oh-my-zsh\.git/{ print $1; exit }')
@@ -38,7 +38,7 @@ if [ -n "$remote" ]; then
fi
printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh"
-if git pull --rebase --autostash --stat origin master
+if git pull --rebase --stat origin master
then
printf '%s' "$GREEN"
printf '%s\n' ' __ __ '
@@ -48,8 +48,14 @@ then
printf '%s\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
printf '%s\n' ' /____/ '
printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version."
- printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh"
- printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh"
+ printf "${BLUE}${BOLD}%s${RESET}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh"
+ printf "${BLUE}${BOLD}%s${RESET}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh"
else
- printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?'
+ printf "${RED}%s${RESET}\n" 'There was an error updating. Try again later?'
fi
+
+# Unset git-config values set just for the upgrade
+case "$resetAutoStash" in
+ "") git config --unset rebase.autoStash ;;
+ *) git config rebase.autoStash "$resetAutoStash" ;;
+esac