diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 0c5f3acee..361ed624b 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -1,13 +1,14 @@
# Plugin owners
plugins/archlinux/ @ratijas
+plugins/dbt/ @msempere
+plugins/eza/ @pepoluan
plugins/genpass/ @atoponce
plugins/git-lfs/ @hellovietduc
plugins/gitfast/ @felipec
plugins/react-native @esthor
plugins/sdk/ @rgoldberg
plugins/shell-proxy/ @septs
+plugins/starship/ @axieax
plugins/universalarchive/ @Konfekt
plugins/wp-cli/ @joshmedeski
plugins/zoxide/ @ajeetdsouza
-plugins/starship/ @axieax
-plugins/dbt/ @msempere
diff --git a/.github/dependencies.yml b/.github/dependencies.yml
index 12beaecbb..f760ddcef 100644
--- a/.github/dependencies.yml
+++ b/.github/dependencies.yml
@@ -2,7 +2,7 @@ dependencies:
plugins/gitfast:
repo: felipec/git-completion
branch: master
- version: tag:v2.0
+ version: tag:v2.1
postcopy: |
set -e
rm -rf git-completion.plugin.zsh Makefile README.adoc t tools
@@ -29,3 +29,10 @@ dependencies:
postcopy: |
set -e
test -e dependencies/OMZ-README.md && cat dependencies/OMZ-README.md >> README.md
+ plugins/gradle:
+ repo: gradle/gradle-completion
+ branch: master
+ version: 25da917cf5a88f3e58f05be3868a7b2748c8afe6
+ precopy: |
+ set -e
+ find . ! -name _gradle ! -name LICENSE -delete
diff --git a/README.md b/README.md
index 97514c61d..da31b7439 100644
--- a/README.md
+++ b/README.md
@@ -70,6 +70,7 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twi
- [Custom Plugins And Themes](#custom-plugins-and-themes)
- [Enable GNU ls In macOS And freeBSD Systems](#enable-gnu-ls-in-macos-and-freebsd-systems)
- [Skip Aliases](#skip-aliases)
+ - [Disable async git prompt](#disable-async-git-prompt)
- [Getting Updates](#getting-updates)
- [Updates Verbosity](#updates-verbosity)
- [Manual Updates](#manual-updates)
@@ -388,6 +389,17 @@ Instead, you can now use the following:
zstyle ':omz:lib:directories' aliases no
```
+### Disable async git prompt
+
+Async prompt functions are an experimental feature (included on April 3, 2024) that allows Oh My Zsh to render prompt information
+asyncronously. This can improve prompt rendering performance, but it might not work well with some setups. We hope that's not an
+issue, but if you're seeing problems with this new feature, you can turn it off by setting the following in your .zshrc file,
+before Oh My Zsh is sourced:
+
+```sh
+zstyle ':omz:alpha:lib:git' async-prompt no
+```
+
#### Notice
> This feature is currently in a testing phase and it may be subject to change in the future.
@@ -476,6 +488,10 @@ Oh My Zsh has a vibrant community of happy users and delightful contributors. Wi
Thank you so much!
+
+
+
+
## Follow Us
We're on social media:
diff --git a/custom/example.zsh b/custom/example.zsh
index 21a8d8be7..c194f49d7 100644
--- a/custom/example.zsh
+++ b/custom/example.zsh
@@ -1,12 +1,12 @@
# Put files in this folder to add your own custom functionality.
# See: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization
-#
+#
# Files in the custom/ directory will be:
# - loaded automatically by the init script, in alphabetical order
# - loaded last, after all built-ins in the lib/ directory, to override them
# - ignored by git by default
-#
+#
# Example: add custom/shortcuts.zsh for shortcuts to your local projects
-#
+#
# brainstormr=~/Projects/development/planetargon/brainstormr
# cd $brainstormr
diff --git a/custom/themes/example.zsh-theme b/custom/themes/example.zsh-theme
index 494d029e8..5551207f8 100644
--- a/custom/themes/example.zsh-theme
+++ b/custom/themes/example.zsh-theme
@@ -1,6 +1,6 @@
# Put your custom themes in this folder.
# See: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes
-#
+#
# Example:
PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "
diff --git a/lib/async_prompt.zsh b/lib/async_prompt.zsh
new file mode 100644
index 000000000..db48446e7
--- /dev/null
+++ b/lib/async_prompt.zsh
@@ -0,0 +1,144 @@
+# The async code is taken from
+# https://github.com/zsh-users/zsh-autosuggestions/blob/master/src/async.zsh
+# https://github.com/woefe/git-prompt.zsh/blob/master/git-prompt.zsh
+
+zmodload zsh/system
+autoload -Uz is-at-least
+
+# For now, async prompt function handlers are set up like so:
+# First, define the async function handler and register the handler
+# with _omz_register_handler:
+#
+# function _git_prompt_status_async {
+# # Do some expensive operation that outputs to stdout
+# }
+# _omz_register_handler _git_prompt_status_async
+#
+# Then add a stub prompt function in `$PROMPT` or similar prompt variables,
+# which will show the output of "$_OMZ_ASYNC_OUTPUT[handler_name]":
+#
+# function git_prompt_status {
+# echo -n $_OMZ_ASYNC_OUTPUT[_git_prompt_status_async]
+# }
+#
+# RPROMPT='$(git_prompt_status)'
+#
+# This API is subject to change and optimization. Rely on it at your own risk.
+
+function _omz_register_handler {
+ setopt localoptions noksharrays
+ typeset -ga _omz_async_functions
+ # we want to do nothing if there's no $1 function or we already set it up
+ if [[ -z "$1" ]] || (( ! ${+functions[$1]} )) \
+ || (( ${_omz_async_functions[(Ie)$1]} )); then
+ return
+ fi
+ _omz_async_functions+=("$1")
+ # let's add the hook to async_request if it's not there yet
+ if (( ! ${precmd_functions[(Ie)_omz_async_request]} )) \
+ && (( ${+functions[_omz_async_request]})); then
+ autoload -Uz add-zsh-hook
+ add-zsh-hook precmd _omz_async_request
+ fi
+}
+
+# Set up async handlers and callbacks
+function _omz_async_request {
+ local -i ret=$?
+ typeset -gA _OMZ_ASYNC_FDS _OMZ_ASYNC_PIDS _OMZ_ASYNC_OUTPUT
+
+ # executor runs a subshell for all async requests based on key
+ local handler
+ for handler in ${_omz_async_functions}; do
+ (( ${+functions[$handler]} )) || continue
+
+ local fd=${_OMZ_ASYNC_FDS[$handler]:--1}
+ local pid=${_OMZ_ASYNC_PIDS[$handler]:--1}
+
+ # If we've got a pending request, cancel it
+ if (( fd != -1 && pid != -1 )) && { true <&$fd } 2>/dev/null; then
+ # Close the file descriptor and remove the handler
+ exec {fd}<&-
+ zle -F $fd
+
+ # Zsh will make a new process group for the child process only if job
+ # control is enabled (MONITOR option)
+ if [[ -o MONITOR ]]; then
+ # Send the signal to the process group to kill any processes that may
+ # have been forked by the async function handler
+ kill -TERM -$pid 2>/dev/null
+ else
+ # Kill just the child process since it wasn't placed in a new process
+ # group. If the async function handler forked any child processes they may
+ # be orphaned and left behind.
+ kill -TERM $pid 2>/dev/null
+ fi
+ fi
+
+ # Define global variables to store the file descriptor, PID and output
+ _OMZ_ASYNC_FDS[$handler]=-1
+ _OMZ_ASYNC_PIDS[$handler]=-1
+
+ # Fork a process to fetch the git status and open a pipe to read from it
+ exec {fd}< <(
+ # Tell parent process our PID
+ builtin echo ${sysparams[pid]}
+ # Set exit code for the handler if used
+ () { return $ret }
+ # Run the async function handler
+ $handler
+ )
+
+ # Save FD for handler
+ _OMZ_ASYNC_FDS[$handler]=$fd
+
+ # There's a weird bug here where ^C stops working unless we force a fork
+ # See https://github.com/zsh-users/zsh-autosuggestions/issues/364
+ # and https://github.com/zsh-users/zsh-autosuggestions/pull/612
+ is-at-least 5.8 || command true
+
+ # Save the PID from the handler child process
+ read -u $fd "_OMZ_ASYNC_PIDS[$handler]"
+
+ # When the fd is readable, call the response handler
+ zle -F "$fd" _omz_async_callback
+ done
+}
+
+# Called when new data is ready to be read from the pipe
+function _omz_async_callback() {
+ emulate -L zsh
+
+ local fd=$1 # First arg will be fd ready for reading
+ local err=$2 # Second arg will be passed in case of error
+
+ if [[ -z "$err" || "$err" == "hup" ]]; then
+ # Get handler name from fd
+ local handler="${(k)_OMZ_ASYNC_FDS[(r)$fd]}"
+
+ # Store old output which is supposed to be already printed
+ local old_output="${_OMZ_ASYNC_OUTPUT[$handler]}"
+
+ # Read output from fd
+ IFS= read -r -u $fd -d '' "_OMZ_ASYNC_OUTPUT[$handler]"
+
+ # Repaint prompt if output has changed
+ if [[ "$old_output" != "${_OMZ_ASYNC_OUTPUT[$handler]}" ]]; then
+ zle .reset-prompt
+ zle -R
+ fi
+
+ # Close the fd
+ exec {fd}<&-
+ fi
+
+ # Always remove the handler
+ zle -F "$fd"
+
+ # Unset global FD variable to prevent closing user created FDs in the precmd hook
+ _OMZ_ASYNC_FDS[$handler]=-1
+ _OMZ_ASYNC_PIDS[$handler]=-1
+}
+
+autoload -Uz add-zsh-hook
+add-zsh-hook precmd _omz_async_request
diff --git a/lib/cli.zsh b/lib/cli.zsh
index 561c1b98b..4a8d4d127 100644
--- a/lib/cli.zsh
+++ b/lib/cli.zsh
@@ -448,7 +448,7 @@ function _omz::plugin::load {
if [[ ! -f "$base/_$plugin" && ! -f "$base/$plugin.plugin.zsh" ]]; then
_omz::log warn "'$plugin' is not a valid plugin"
continue
- # It it is a valid plugin, add its directory to $fpath unless it is already there
+ # It is a valid plugin, add its directory to $fpath unless it is already there
elif (( ! ${fpath[(Ie)$base]} )); then
fpath=("$base" $fpath)
fi
@@ -773,7 +773,17 @@ function _omz::theme::use {
}
function _omz::update {
- local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD)
+ # Check if git command is available
+ (( $+commands[git] )) || {
+ _omz::log error "git is not installed. Aborting..."
+ return 1
+ }
+
+ local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)
+ [[ $? -eq 0 ]] || {
+ _omz::log error "\`$ZSH\` is not a git directory. Aborting..."
+ return 1
+ }
# Run update script
zstyle -s ':omz:update' verbose verbose_mode || verbose_mode=default
diff --git a/lib/compfix.zsh b/lib/compfix.zsh
index b09b283f2..2fe9d9e64 100644
--- a/lib/compfix.zsh
+++ b/lib/compfix.zsh
@@ -13,7 +13,7 @@ function handle_completion_insecurities() {
# /usr/share/zsh/5.0.6
#
# Since the ignorable first line is printed to stderr and thus not captured,
- # stderr is squelched to prevent this output from leaking to the user.
+ # stderr is squelched to prevent this output from leaking to the user.
local -aU insecure_dirs
insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} )
diff --git a/lib/diagnostics.zsh b/lib/diagnostics.zsh
index eaeba7d23..d67e6fab4 100644
--- a/lib/diagnostics.zsh
+++ b/lib/diagnostics.zsh
@@ -30,7 +30,7 @@
#
# This is written in a defensive style so it still works (and can detect) cases when
# basic functionality like echo and which have been redefined. In particular, almost
-# everything is invoked with "builtin" or "command", to work in the face of user
+# everything is invoked with "builtin" or "command", to work in the face of user
# redefinitions.
#
# OPTIONS
@@ -59,7 +59,7 @@ function omz_diagnostic_dump() {
emulate -L zsh
builtin echo "Generating diagnostic dump; please be patient..."
-
+
local thisfcn=omz_diagnostic_dump
local -A opts
local opt_verbose opt_noverbose opt_outfile
@@ -90,7 +90,7 @@ function omz_diagnostic_dump() {
builtin echo
builtin echo Diagnostic dump file created at: "$outfile"
builtin echo
- builtin echo To share this with OMZ developers, post it as a gist on GitHub
+ builtin echo To share this with OMZ developers, post it as a gist on GitHub
builtin echo at "https://gist.github.com" and share the link to the gist.
builtin echo
builtin echo "WARNING: This dump file contains all your zsh and omz configuration files,"
@@ -105,8 +105,8 @@ function _omz_diag_dump_one_big_text() {
builtin echo oh-my-zsh diagnostic dump
builtin echo
builtin echo $outfile
- builtin echo
-
+ builtin echo
+
# Basic system and zsh information
command date
command uname -a
@@ -151,7 +151,7 @@ function _omz_diag_dump_one_big_text() {
# Core command definitions
_omz_diag_dump_check_core_commands || return 1
- builtin echo
+ builtin echo
# ZSH Process state
builtin echo Process state:
@@ -167,7 +167,7 @@ function _omz_diag_dump_one_big_text() {
#TODO: Should this include `env` instead of or in addition to `export`?
builtin echo Exported:
builtin echo $(builtin export | command sed 's/=.*//')
- builtin echo
+ builtin echo
builtin echo Locale:
command locale
builtin echo
@@ -181,7 +181,7 @@ function _omz_diag_dump_one_big_text() {
builtin echo
builtin echo 'compaudit output:'
compaudit
- builtin echo
+ builtin echo
builtin echo '$fpath directories:'
command ls -lad $fpath
builtin echo
@@ -224,7 +224,7 @@ function _omz_diag_dump_one_big_text() {
local cfgfile cfgfiles
# Some files for bash that zsh does not use are intentionally included
# to help with diagnosing behavior differences between bash and zsh
- cfgfiles=( /etc/zshenv /etc/zprofile /etc/zshrc /etc/zlogin /etc/zlogout
+ cfgfiles=( /etc/zshenv /etc/zprofile /etc/zshrc /etc/zlogin /etc/zlogout
$zdotdir/.zshenv $zdotdir/.zprofile $zdotdir/.zshrc $zdotdir/.zlogin $zdotdir/.zlogout
~/.zsh.pre-oh-my-zsh
/etc/bashrc /etc/profile ~/.bashrc ~/.profile ~/.bash_profile ~/.bash_logout )
@@ -258,8 +258,8 @@ function _omz_diag_dump_check_core_commands() {
# (For back-compatibility, if any of these are newish, they should be removed,
# or at least made conditional on the version of the current running zsh.)
# "history" is also excluded because OMZ is known to redefine that
- reserved_words=( do done esac then elif else fi for case if while function
- repeat time until select coproc nocorrect foreach end '!' '[[' '{' '}'
+ reserved_words=( do done esac then elif else fi for case if while function
+ repeat time until select coproc nocorrect foreach end '!' '[[' '{' '}'
)
builtins=( alias autoload bg bindkey break builtin bye cd chdir command
comparguments compcall compctl compdescribe compfiles compgroups compquote comptags
@@ -331,7 +331,7 @@ function _omz_diag_dump_os_specific_version() {
case "$OSTYPE" in
darwin*)
osname=$(command sw_vers -productName)
- osver=$(command sw_vers -productVersion)
+ osver=$(command sw_vers -productVersion)
builtin echo "OS Version: $osname $osver build $(sw_vers -buildVersion)"
;;
cygwin)
diff --git a/lib/git.zsh b/lib/git.zsh
index f049f73c2..b257d01a4 100644
--- a/lib/git.zsh
+++ b/lib/git.zsh
@@ -1,3 +1,5 @@
+autoload -Uz is-at-least
+
# The git prompt's git commands are read-only and should not interfere with
# other processes. This environment variable is equivalent to running with `git
# --no-optional-locks`, but falls back gracefully for older versions of git.
@@ -9,14 +11,18 @@ function __git_prompt_git() {
GIT_OPTIONAL_LOCKS=0 command git "$@"
}
-function git_prompt_info() {
+function _omz_git_prompt_info() {
# If we are on a folder not tracked by git, get out.
# Otherwise, check for hide-info at global and local repository level
if ! __git_prompt_git rev-parse --git-dir &> /dev/null \
- || [[ "$(__git_prompt_git config --get oh-my-zsh.hide-info 2>/dev/null)" == 1 ]]; then
+ || [[ "$(__git_prompt_git config --get oh-my-zsh.hide-info 2>/dev/null)" == 1 ]]; then
return 0
fi
+ # Get either:
+ # - the current branch name
+ # - the tag name if we are on a tag
+ # - the short SHA of the current commit
local ref
ref=$(__git_prompt_git symbolic-ref --short HEAD 2> /dev/null) \
|| ref=$(__git_prompt_git describe --tags --exact-match HEAD 2> /dev/null) \
@@ -33,6 +39,52 @@ function git_prompt_info() {
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
}
+# Use async version if setting is enabled or undefined
+if zstyle -T ':omz:alpha:lib:git' async-prompt; then
+ function git_prompt_info() {
+ if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}" ]]; then
+ echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}"
+ fi
+ }
+
+ function git_prompt_status() {
+ if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}" ]]; then
+ echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}"
+ fi
+ }
+
+ # Conditionally register the async handler, only if it's needed in $PROMPT
+ # or any of the other prompt variables
+ function _defer_async_git_register() {
+ # Check if git_prompt_info is used in a prompt variable
+ case "${PS1}:${PS2}:${PS3}:${PS4}:${RPROMPT}:${RPS1}:${RPS2}:${RPS3}:${RPS4}" in
+ *(\$\(git_prompt_info\)|\`git_prompt_info\`)*)
+ _omz_register_handler _omz_git_prompt_info
+ ;;
+ esac
+
+ case "${PS1}:${PS2}:${PS3}:${PS4}:${RPROMPT}:${RPS1}:${RPS2}:${RPS3}:${RPS4}" in
+ *(\$\(git_prompt_status\)|\`git_prompt_status\`)*)
+ _omz_register_handler _omz_git_prompt_status
+ ;;
+ esac
+
+ add-zsh-hook -d precmd _defer_async_git_register
+ unset -f _defer_async_git_register
+ }
+
+ # Register the async handler first. This needs to be done before
+ # the async request prompt is run
+ precmd_functions=(_defer_async_git_register $precmd_functions)
+else
+ function git_prompt_info() {
+ _omz_git_prompt_info
+ }
+ function git_prompt_status() {
+ _omz_git_prompt_status
+ }
+fi
+
# Checks if working tree is dirty
function parse_git_dirty() {
local STATUS
@@ -161,7 +213,7 @@ function git_prompt_long_sha() {
SHA=$(__git_prompt_git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
}
-function git_prompt_status() {
+function _omz_git_prompt_status() {
[[ "$(__git_prompt_git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]] && return
# Maps a git status prefix to an internal constant
diff --git a/lib/history.zsh b/lib/history.zsh
index 794076904..a8431fd5a 100644
--- a/lib/history.zsh
+++ b/lib/history.zsh
@@ -1,19 +1,20 @@
## History wrapper
function omz_history {
- local clear list
- zparseopts -E c=clear l=list
+ # parse arguments and remove from $@
+ local clear list stamp
+ zparseopts -E -D c=clear l=list f=stamp E=stamp i=stamp t:=stamp
if [[ -n "$clear" ]]; then
# if -c provided, clobber the history file
echo -n >| "$HISTFILE"
fc -p "$HISTFILE"
echo >&2 History file deleted.
- elif [[ -n "$list" ]]; then
- # if -l provided, run as if calling `fc' directly
- builtin fc "$@"
+ elif [[ $# -eq 0 ]]; then
+ # if no arguments provided, show full history starting from 1
+ builtin fc $stamp -l 1
else
- # unless a number is provided, show all history events (starting from 1)
- [[ ${@[-1]-} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
+ # otherwise, run `fc -l` with a custom format
+ builtin fc $stamp -l "$@"
fi
}
diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
index d170ffcbf..087bae9bb 100644
--- a/lib/termsupport.zsh
+++ b/lib/termsupport.zsh
@@ -17,7 +17,7 @@ function title {
: ${2=$1}
case "$TERM" in
- cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty|st*|foot*|contour*)
+ cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty*|st*|foot*|contour*)
print -Pn "\e]2;${2:q}\a" # set window name
print -Pn "\e]1;${1:q}\a" # set tab name
;;
@@ -129,7 +129,7 @@ fi
# Don't define the function if we're in an unsupported terminal
case "$TERM" in
# all of these either process OSC 7 correctly or ignore entirely
- xterm*|putty*|rxvt*|konsole*|mlterm*|alacritty|screen*|tmux*) ;;
+ xterm*|putty*|rxvt*|konsole*|mlterm*|alacritty*|screen*|tmux*) ;;
contour*|foot*) ;;
*)
# Terminal.app and iTerm2 process OSC 7 correctly
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
index 137ca3b6f..2fb20298a 100644
--- a/oh-my-zsh.sh
+++ b/oh-my-zsh.sh
@@ -152,7 +152,7 @@ unset zcompdump_revision zcompdump_fpath zcompdump_refresh
# zcompile the completion dump file if the .zwc is older or missing.
if command mkdir "${ZSH_COMPDUMP}.lock" 2>/dev/null; then
zrecompile -q -p "$ZSH_COMPDUMP"
- command rm -rf "$ZSH_COMPDUMP.zwc.old" "${ZSH_COMPDUMP}.lock"
+ command rm -rf "$ZSH_COMPDUMP.zwc.old" "${ZSH_COMPDUMP}.lock"
fi
_omz_source() {
diff --git a/plugins/ansible/README.md b/plugins/ansible/README.md
index e0e6a19bb..dd0e1ce03 100644
--- a/plugins/ansible/README.md
+++ b/plugins/ansible/README.md
@@ -21,7 +21,6 @@ plugins=(... ansible)
| `acon` | command `ansible-console` |
| `ainv` | command `ansible-inventory` |
| `aplaybook` | command `ansible-playbook` |
-| `ainv` | command `ansible-inventory` |
| `adoc` | command `ansible-doc` |
| `agal` | command `ansible-galaxy` |
| `apull` | command `ansible-pull` |
@@ -29,6 +28,6 @@ plugins=(... ansible)
## Maintainer
-### [Deepankumar](https://github.com/deepan10)
+### [Deepankumar](https://github.com/deepan10)
[https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin](https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin)
diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh
index fca6548c0..e20a31156 100644
--- a/plugins/archlinux/archlinux.plugin.zsh
+++ b/plugins/archlinux/archlinux.plugin.zsh
@@ -179,8 +179,8 @@ fi
# Check Arch Linux PGP Keyring before System Upgrade to prevent failure.
function upgrade() {
echo ":: Checking Arch Linux PGP Keyring..."
- local installedver="$(sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
- local currentver="$(sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
+ local installedver="$(LANG= sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
+ local currentver="$(LANG= sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
if [ $installedver != $currentver ]; then
echo " Arch Linux PGP Keyring is out of date."
echo " Updating before full system upgrade."
diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh
index 84333a89f..e385a2de8 100644
--- a/plugins/autojump/autojump.plugin.zsh
+++ b/plugins/autojump/autojump.plugin.zsh
@@ -13,7 +13,9 @@ autojump_paths=(
/opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
/usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
/opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
+ /opt/pkg/share/autojump/autojump.zsh # macOS with pkgsrc
/etc/profiles/per-user/$USER/etc/profile.d/autojump.sh # macOS Nix, Home Manager and flakes
+ /nix/var/nix/gcroots/current-system/sw/share/zsh/site-functions/autojump.zsh # macOS Nix, nix-darwin
)
for file in $autojump_paths; do
diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
index 071dd1f0b..0c43031df 100644
--- a/plugins/aws/aws.plugin.zsh
+++ b/plugins/aws/aws.plugin.zsh
@@ -280,7 +280,7 @@ if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
test -s "${AWS_STATE_FILE}" || return
aws_state=($(cat $AWS_STATE_FILE))
-
+
export AWS_DEFAULT_PROFILE="${aws_state[1]}"
export AWS_PROFILE="$AWS_DEFAULT_PROFILE"
export AWS_EB_PROFILE="$AWS_DEFAULT_PROFILE"
diff --git a/plugins/branch/README.md b/plugins/branch/README.md
index a15dd22df..2b6d12d29 100644
--- a/plugins/branch/README.md
+++ b/plugins/branch/README.md
@@ -39,7 +39,7 @@ index 2fd5f2cd..9d89a464 100644
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
-PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
+PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(branch_prompt_info)'
-
+
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
```
diff --git a/plugins/catimg/README.md b/plugins/catimg/README.md
index 8f2688050..68dc33c1f 100644
--- a/plugins/catimg/README.md
+++ b/plugins/catimg/README.md
@@ -1,6 +1,6 @@
# catimg
-Plugin for displaying images on the terminal using the the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
+Plugin for displaying images on the terminal using the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
To use it, add `catimg` to the plugins array in your zshrc file:
diff --git a/plugins/chruby/chruby.plugin.zsh b/plugins/chruby/chruby.plugin.zsh
index d7a28d4e2..1210897c4 100644
--- a/plugins/chruby/chruby.plugin.zsh
+++ b/plugins/chruby/chruby.plugin.zsh
@@ -2,7 +2,7 @@
_source-from-omz-settings() {
local _chruby_path _chruby_auto
-
+
zstyle -s :omz:plugins:chruby path _chruby_path || return 1
zstyle -s :omz:plugins:chruby auto _chruby_auto || return 1
@@ -23,7 +23,7 @@ _source-from-homebrew() {
if [[ -h /usr/local/opt/chruby ]];then
_brew_prefix="/usr/local/opt/chruby"
else
- # ok , it is not default prefix
+ # ok , it is not default prefix
# this call to brew is expensive ( about 400 ms ), so at least let's make it only once
_brew_prefix=$(brew --prefix chruby)
fi
diff --git a/plugins/cloudfoundry/README.md b/plugins/cloudfoundry/README.md
index 89dd9d1ce..567a9056b 100644
--- a/plugins/cloudfoundry/README.md
+++ b/plugins/cloudfoundry/README.md
@@ -50,7 +50,7 @@ Alternatively, seek out the [online documentation][3]. And don't forget, there a
## Contributors
-Contributed to `oh_my_zsh` by [benwilcock][2].
+Contributed to `oh_my_zsh` by [benwilcock][2].
[1]: https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
[2]: https://github.com/benwilcock
diff --git a/plugins/coffee/README.md b/plugins/coffee/README.md
index 2baade844..c2ab192b6 100644
--- a/plugins/coffee/README.md
+++ b/plugins/coffee/README.md
@@ -24,7 +24,7 @@ Also provides the following aliases:
* **cfc:** Copies the compiled JS to your clipboard. Very useful when you want
to run the code in a JS console.
-* **cfp:** Compiles from your currently copied clipboard. Useful when you want
+* **cfp:** Compiles from your currently copied clipboard. Useful when you want
to compile large/multi-line snippets
* **cfpc:** Paste coffeescript from clipboard, compile to JS, then copy the
diff --git a/plugins/compleat/compleat.plugin.zsh b/plugins/compleat/compleat.plugin.zsh
index 38f1b396a..7fbd2b953 100644
--- a/plugins/compleat/compleat.plugin.zsh
+++ b/plugins/compleat/compleat.plugin.zsh
@@ -7,7 +7,7 @@
if (( ${+commands[compleat]} )); then
local prefix="${commands[compleat]:h:h}"
- local setup="${prefix}/share/compleat-1.0/compleat_setup"
+ local setup="${prefix}/share/compleat-1.0/compleat_setup"
if [[ -f "$setup" ]]; then
if ! bashcompinit >/dev/null 2>&1; then
@@ -15,6 +15,6 @@ if (( ${+commands[compleat]} )); then
bashcompinit -i
fi
- source "$setup"
+ source "$setup"
fi
fi
diff --git a/plugins/copybuffer/copybuffer.plugin.zsh b/plugins/copybuffer/copybuffer.plugin.zsh
index e67f920f0..e636d9730 100644
--- a/plugins/copybuffer/copybuffer.plugin.zsh
+++ b/plugins/copybuffer/copybuffer.plugin.zsh
@@ -1,8 +1,8 @@
-# copy the active line from the command line buffer
+# copy the active line from the command line buffer
# onto the system clipboard
copybuffer () {
- if which clipcopy &>/dev/null; then
+ if builtin which clipcopy &>/dev/null; then
printf "%s" "$BUFFER" | clipcopy
else
zle -M "clipcopy not found. Please make sure you have Oh My Zsh installed correctly."
diff --git a/plugins/dash/README.md b/plugins/dash/README.md
index 0ca3e4e44..970c6541f 100644
--- a/plugins/dash/README.md
+++ b/plugins/dash/README.md
@@ -19,7 +19,7 @@ dash
- Query for something in dash app: `dash query`
```
-dash golang
+dash golang
```
- You can optionally provide a keyword: `dash [keyword:]query`
diff --git a/plugins/docker-compose/_docker-compose b/plugins/docker-compose/_docker-compose
index c6b733500..d0ebfe515 100644
--- a/plugins/docker-compose/_docker-compose
+++ b/plugins/docker-compose/_docker-compose
@@ -128,7 +128,7 @@ __docker-compose_subcommand() {
'--resolve-image-digests[Pin image tags to digests.]' \
'--services[Print the service names, one per line.]' \
'--volumes[Print the volume names, one per line.]' \
- '--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' \ && ret=0
+ '--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' && ret=0
;;
(create)
_arguments \
diff --git a/plugins/docker/docker.plugin.zsh b/plugins/docker/docker.plugin.zsh
index 7e657f2df..b429ae211 100644
--- a/plugins/docker/docker.plugin.zsh
+++ b/plugins/docker/docker.plugin.zsh
@@ -57,6 +57,6 @@ fi
! is-at-least 23.0.0 ${${(s:,:z)"$(command docker --version)"}[3]}; then
command cp "${0:h}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker"
else
- command docker completion zsh >| "$ZSH_CACHE_DIR/completions/_docker"
+ command docker completion zsh | tee "$ZSH_CACHE_DIR/completions/_docker" > /dev/null
fi
} &|
diff --git a/plugins/dotnet/dotnet.plugin.zsh b/plugins/dotnet/dotnet.plugin.zsh
index 40ee7efae..ed7c55024 100644
--- a/plugins/dotnet/dotnet.plugin.zsh
+++ b/plugins/dotnet/dotnet.plugin.zsh
@@ -11,7 +11,7 @@ _dotnet_completion() {
compdef _dotnet_completion dotnet
# Aliases bellow are here for backwards compatibility
-# added by Shaun Tabone (https://github.com/xontab)
+# added by Shaun Tabone (https://github.com/xontab)
alias dn='dotnet new'
alias dr='dotnet run'
diff --git a/plugins/emacs/README.md b/plugins/emacs/README.md
index 8ed4a1473..47c7644ab 100644
--- a/plugins/emacs/README.md
+++ b/plugins/emacs/README.md
@@ -27,4 +27,4 @@ The plugin uses a custom launcher (which we'll call here `$EMACS_LAUNCHER`) that
| eeval | `$EMACS_LAUNCHER --eval` | Same as `M-x eval` but from outside Emacs |
| eframe | `emacsclient --alternate-editor="" --create-frame` | Create new X frame |
| efile | - | Print the path to the file open in the current buffer |
-| ecd | - | Print the directory of the file open in the the current buffer |
+| ecd | - | Print the directory of the file open in the current buffer |
diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh
index 4747f035b..5aa621803 100644
--- a/plugins/emacs/emacs.plugin.zsh
+++ b/plugins/emacs/emacs.plugin.zsh
@@ -60,7 +60,7 @@ function efile {
}
# Write to standard output the directory of the file
-# opened in the the current buffer
+# opened in the current buffer
function ecd {
local file
file="$(efile)" || return $?
diff --git a/plugins/emoji/emoji.plugin.zsh b/plugins/emoji/emoji.plugin.zsh
index f9e476ebf..f7be56cf7 100644
--- a/plugins/emoji/emoji.plugin.zsh
+++ b/plugins/emoji/emoji.plugin.zsh
@@ -24,7 +24,7 @@ unset _omz_emoji_plugin_dir
# This is a combining character that can be placed after any other character to surround
# it in a "keycap" symbol.
-# The digits 0-9 are already in the emoji table as keycap_digit_, keycap_ten, etc.
+# The digits 0-9 are already in the emoji table as keycap_digit_, keycap_ten, etc.
# It's unclear whether this should be in the $emoji array, because those characters are all ones
# which can be displayed on their own.
@@ -63,9 +63,9 @@ function random_emoji() {
[[ $list_size -eq 0 ]] && return 1
local random_index=$(( ( RANDOM % $list_size ) + 1 ))
local name=${names[$random_index]}
- if [[ "$group" == "flags" ]]; then
+ if [[ "$group" == "flags" ]]; then
echo ${emoji_flags[$name]}
- else
+ else
echo ${emoji[$name]}
fi
}
@@ -86,22 +86,22 @@ function display_emoji() {
# terminals treat these emoji chars as single-width.
local counter=1
for i in $names; do
- if [[ "$group" == "flags" ]]; then
+ if [[ "$group" == "flags" ]]; then
printf '%s ' "$emoji_flags[$i]"
- else
- printf '%s ' "$emoji[$i]"
+ else
+ printf '%s ' "$emoji[$i]"
fi
# New line every 20 emoji, to avoid weirdnesses
if (($counter % 20 == 0)); then
- printf "\n"
+ printf "\n"
fi
let counter=$counter+1
done
print
for i in $names; do
- if [[ "$group" == "flags" ]]; then
+ if [[ "$group" == "flags" ]]; then
echo "${emoji_flags[$i]} = $i"
- else
+ else
echo "${emoji[$i]} = $i"
fi
done
diff --git a/plugins/emotty/emotty.plugin.zsh b/plugins/emotty/emotty.plugin.zsh
index 661169a8b..b48d121dc 100644
--- a/plugins/emotty/emotty.plugin.zsh
+++ b/plugins/emotty/emotty.plugin.zsh
@@ -4,7 +4,7 @@
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
# VERSION: 1.0.0
# DEPENDS: emoji plugin
-#
+#
# There are different sets of emoji characters available, to choose a different
# set export emotty_set to the name of the set you would like to use, e.g.:
# % export emotty_set=nature
diff --git a/plugins/encode64/README.md b/plugins/encode64/README.md
index 7cdf8c3f3..e3e25a742 100644
--- a/plugins/encode64/README.md
+++ b/plugins/encode64/README.md
@@ -40,7 +40,7 @@ plugins=(... encode64)
### Encoding a file
-Encode a file's contents to base64 and save output to text file.
+Encode a file's contents to base64 and save output to text file.
**NOTE:** Takes provided file and saves encoded content as new file with `.txt` extension
- From parameter
diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh
index 88d8b0740..1c7599195 100644
--- a/plugins/extract/extract.plugin.zsh
+++ b/plugins/extract/extract.plugin.zsh
@@ -70,7 +70,7 @@ EOF
(*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;;
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;;
(*.gz) (( $+commands[pigz] )) && pigz -cdk "$full_path" > "${file:t:r}" || gunzip -ck "$full_path" > "${file:t:r}" ;;
- (*.bz2) bunzip2 "$full_path" ;;
+ (*.bz2) (( $+commands[pbzip2] )) && pbzip2 -d "$full_path" || bunzip2 "$full_path" ;;
(*.xz) unxz "$full_path" ;;
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$full_path" ;;
(*.lz4) lz4 -d "$full_path" ;;
@@ -87,7 +87,7 @@ EOF
builtin cd -q control; extract ../control.tar.*
builtin cd -q ../data; extract ../data.tar.*
builtin cd -q ..; command rm *.tar.* debian-binary ;;
- (*.zst) unzstd "$full_path" ;;
+ (*.zst) unzstd --stdout "$full_path" > "${file:t:r}" ;;
(*.cab|*.exe) cabextract "$full_path" ;;
(*.cpio|*.obscpio) cpio -idmvF "$full_path" ;;
(*.zpaq) zpaq x "$full_path" ;;
diff --git a/plugins/eza/README.md b/plugins/eza/README.md
new file mode 100644
index 000000000..5de935c2c
--- /dev/null
+++ b/plugins/eza/README.md
@@ -0,0 +1,101 @@
+# eza plugin
+
+This provides aliases that invoke the [`eza`](https://github.com/eza-community/eza) utility rather than `ls`
+
+To use it add `eza` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... eza)
+```
+
+## Configuration
+
+All configurations are done using the `zstyle` command in the `:omz:plugins:eza` namespace.
+
+**NOTE:** The configuring needs to be done prior to OMZ loading the plugins. When the plugin is loaded,
+changing the `zstyle` won't have any effect.
+
+### `dirs-first`
+
+```zsh
+zstyle ':omz:plugins:eza' 'dirs-first' yes|no
+```
+
+If `yes`, directories will be grouped first.
+
+Default: `no`
+
+### `git-status`
+
+```zsh
+zstyle ':omz:plugins:eza' 'git-status' yes|no
+```
+
+If `yes`, always add `--git` flag to indicate git status (if tracked / in a git repo).
+
+Default: `no`
+
+### `header`
+
+```zsh
+zstyle ':omz:plugins:eza' 'header' yes|no
+```
+
+If `yes`, always add `-h` flag to add a header row for each column.
+
+Default: `no`
+
+### `show-group`
+
+```zsh
+zstyle ':omz:plugins:eza' 'show-group' yes|no
+```
+
+If `yes` (default), always add `-g` flag to show the group ownership.
+
+Default: `yes`
+
+### `size-prefix`
+
+```zsh
+zstyle ':omz:plugins:eza' 'size-prefix' (binary|none|si)
+```
+
+Choose the prefix to be used in displaying file size:
+
+- `binary` -- use [binary prefixes](https://en.wikipedia.org/wiki/Binary_prefix) such as "Ki", "Mi", "Gi" and
+ so on
+- `none` -- don't use any prefix, show size in bytes
+- `si` (default) -- use [Metric/S.I. prefixes](https://en.wikipedia.org/wiki/Metric_prefix)
+
+Default: `si`
+
+### `time-style`
+
+```zsh
+zstyle ':omz:plugins:eza' 'time-style' $TIME_STYLE
+```
+
+Sets the `--time-style` option of `eza`. (See `man eza` for the options)
+
+Default: Not set, which means the default behavior of `eza` will take place.
+
+## Aliases
+
+**Notes:**
+
+- Aliases may be modified by Configuration
+- The term "files" without "only" qualifier means both files & directories
+
+| Alias | Command | Description |
+| ------ | ----------------- | -------------------------------------------------------------------------- |
+| `la` | `eza -la` | List all files (except . and ..) as a long list |
+| `ldot` | `eza -ld .*` | List dotfiles only (directories shown as entries instead of recursed into) |
+| `lD` | `eza -lD` | List only directories (excluding dotdirs) as a long list |
+| `lDD` | `eza -laD` | List only directories (including dotdirs) as a long list |
+| `ll` | `eza -l` | List files as a long list |
+| `ls` | `eza` | Plain eza call |
+| `lsd` | `eza -d` | List specified files with directories as entries, in a grid |
+| `lsdl` | `eza -dl` | List specified files with directories as entries, in a long list |
+| `lS` | `eza -l -ssize` | List files as a long list, sorted by size |
+| `lT` | `eza -l -snewest` | List files as a long list, sorted by date (newest last) |
diff --git a/plugins/eza/eza.plugin.zsh b/plugins/eza/eza.plugin.zsh
new file mode 100644
index 000000000..6d7f720bd
--- /dev/null
+++ b/plugins/eza/eza.plugin.zsh
@@ -0,0 +1,62 @@
+if ! (( $+commands[eza] )); then
+ print "zsh eza plugin: eza not found. Please install eza before using this plugin." >&2
+ return 1
+fi
+
+typeset -a _EZA_HEAD
+typeset -a _EZA_TAIL
+
+function _configure_eza() {
+ local _val
+ # Get the head flags
+ if zstyle -T ':omz:plugins:eza' 'show-group'; then
+ _EZA_HEAD+=("g")
+ fi
+ if zstyle -t ':omz:plugins:eza' 'header'; then
+ _EZA_HEAD+=("h")
+ fi
+ zstyle -s ':omz:plugins:eza' 'size-prefix' _val
+ case "${_val:l}" in
+ binary)
+ _EZA_HEAD+=("b")
+ ;;
+ none)
+ _EZA_HEAD+=("B")
+ ;;
+ esac
+ # Get the tail long-options
+ if zstyle -t ':omz:plugins:eza' 'dirs-first'; then
+ _EZA_TAIL+=("--group-directories-first")
+ fi
+ if zstyle -t ':omz:plugins:eza' 'git-status'; then
+ _EZA_TAIL+=("--git")
+ fi
+ zstyle -s ':omz:plugins:eza' 'time-style' _val
+ if [[ $_val ]]; then
+ _EZA_TAIL+=("--time-style='$_val'")
+ fi
+}
+
+_configure_eza
+
+function _alias_eza() {
+ local _head="${(j::)_EZA_HEAD}$2"
+ local _tail="${(j: :)_EZA_TAIL}"
+ alias "$1"="eza${_head:+ -}${_head}${_tail:+ }${_tail}${3:+ }$3"
+}
+
+_alias_eza la la
+_alias_eza ldot ld ".*"
+_alias_eza lD lD
+_alias_eza lDD lDa
+_alias_eza ll l
+_alias_eza ls
+_alias_eza lsd d
+_alias_eza lsdl dl
+_alias_eza lS "l -ssize"
+_alias_eza lT "l -snewest"
+
+unfunction _alias_eza
+unfunction _configure_eza
+unset _EZA_HEAD
+unset _EZA_TAIL
diff --git a/plugins/fancy-ctrl-z/README.md b/plugins/fancy-ctrl-z/README.md
index f1b1dfa5c..82a4fd75e 100644
--- a/plugins/fancy-ctrl-z/README.md
+++ b/plugins/fancy-ctrl-z/README.md
@@ -1,14 +1,14 @@
# Use Ctrl-Z to switch back to Vim
-I frequently need to execute random commands in my shell. To achieve it I pause
+I frequently need to execute random commands in my shell. To achieve it I pause
Vim by pressing Ctrl-z, type command and press fg to switch back to Vim.
-The fg part really hurts me. I just wanted to hit Ctrl-z once again to get back
-to Vim. I could not find a solution, so I developed one on my own that
+The fg part really hurts me. I just wanted to hit Ctrl-z once again to get back
+to Vim. I could not find a solution, so I developed one on my own that
works wonderfully with ZSH.
Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/
-Credits:
+Credits:
- original idea by @sheerun
- added to OMZ by @mbologna
diff --git a/plugins/fastfile/README.md b/plugins/fastfile/README.md
index 32f619ffd..7291fde38 100644
--- a/plugins/fastfile/README.md
+++ b/plugins/fastfile/README.md
@@ -71,13 +71,13 @@ them, add `=` to your zshrc file, before Oh My Zsh is sourced.
For example: `fastfile_var_prefix='@'`.
- `fastfile_var_prefix`: prefix for the global aliases created. Controls the prefix of the
- created global aliases.
+ created global aliases.
**Default:** `§` (section sign), easy to type in a german keyboard via the combination
[`⇧ Shift`+`3`](https://en.wikipedia.org/wiki/German_keyboard_layout#/media/File:KB_Germany.svg),
or using `⌥ Option`+`6` in macOS.
- `fastfile_dir`: directory where the fastfile shortcuts are stored. Needs to end
- with a trailing slash.
+ with a trailing slash.
**Default:** `$HOME/.fastfile/`.
## Author
diff --git a/plugins/forklift/forklift.plugin.zsh b/plugins/forklift/forklift.plugin.zsh
index 85889481b..848aedabf 100644
--- a/plugins/forklift/forklift.plugin.zsh
+++ b/plugins/forklift/forklift.plugin.zsh
@@ -58,7 +58,7 @@ function fl {
tell application forkLiftSetapp
activate
set forkLiftVersion to version
- end tell
+ end tell
else if forkLift3 is not null and application forkLift3 is running then
tell application forkLift3
activate
@@ -84,7 +84,7 @@ function fl {
else if forkLift is not null then
set appName to forkLift
end if
-
+
tell application appName
activate
set forkLiftVersion to version
diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh
index b253a23d2..3d29f1762 100644
--- a/plugins/fzf/fzf.plugin.zsh
+++ b/plugins/fzf/fzf.plugin.zsh
@@ -1,3 +1,14 @@
+function fzf_setup_using_fzf() {
+ (( ${+commands[fzf]} )) || return 1
+
+ # we remove "fzf " prefix, this fixes really old fzf versions behaviour
+ # see https://github.com/ohmyzsh/ohmyzsh/issues/12387
+ local fzf_ver=${"$(fzf --version)"#fzf }
+ is-at-least 0.48.0 ${${(s: :)fzf_ver}[1]} || return 1
+
+ eval "$(fzf --zsh)"
+}
+
function fzf_setup_using_base_dir() {
local fzf_base fzf_shell fzfdirs dir
@@ -8,6 +19,7 @@ function fzf_setup_using_base_dir() {
"${HOME}/.fzf"
"${HOME}/.nix-profile/share/fzf"
"${XDG_DATA_HOME:-$HOME/.local/share}/fzf"
+ "${MSYSTEM_PREFIX}/share/fzf"
"/usr/local/opt/fzf"
"/opt/homebrew/opt/fzf"
"/usr/share/fzf"
@@ -61,7 +73,7 @@ function fzf_setup_using_base_dir() {
function fzf_setup_using_debian() {
if (( ! $+commands[apt] && ! $+commands[apt-get] )); then
- # Not a debian based distro
+ # Not a debian based distro
return 1
fi
@@ -216,7 +228,8 @@ Please add `export FZF_BASE=/path/to/fzf/install/dir` to your .zshrc
EOF
}
-fzf_setup_using_openbsd \
+fzf_setup_using_fzf \
+ || fzf_setup_using_openbsd \
|| fzf_setup_using_debian \
|| fzf_setup_using_opensuse \
|| fzf_setup_using_cygwin \
diff --git a/plugins/gcloud/gcloud.plugin.zsh b/plugins/gcloud/gcloud.plugin.zsh
index cf3d650ea..fa8f884a4 100644
--- a/plugins/gcloud/gcloud.plugin.zsh
+++ b/plugins/gcloud/gcloud.plugin.zsh
@@ -9,6 +9,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
"/usr/local/share/google-cloud-sdk"
"/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
"/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
+ "/opt/homebrew/share/google-cloud-sdk"
"/usr/share/google-cloud-sdk"
"/snap/google-cloud-sdk/current"
"/snap/google-cloud-cli/current"
diff --git a/plugins/git-commit/README.md b/plugins/git-commit/README.md
index a00983935..f812ee23f 100644
--- a/plugins/git-commit/README.md
+++ b/plugins/git-commit/README.md
@@ -1,6 +1,8 @@
# git-commit plugin
-The git-commit plugin adds several [git aliases](https://www.git-scm.com/docs/git-config#Documentation/git-config.txt-alias) for [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) messages.
+The git-commit plugin adds several
+[git aliases](https://www.git-scm.com/docs/git-config#Documentation/git-config.txt-alias) for
+[conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) messages.
To use it, add `git-commit` to the plugins array in your zshrc file:
@@ -11,11 +13,9 @@ plugins=(... git-commit)
## Syntax
```zsh
-git [(-s, --scope) ""] ""
+git [(-s, --scope) ""] [(-a, --attention)] ""
```
-> ⚠️ Single/Double quotes around the scope and message are required
-
Where `type` is one of the following:
- `build`
@@ -34,6 +34,9 @@ Where `type` is one of the following:
> NOTE: the alias for `revert` type is `rev`, as otherwise it conflicts with the git command of the same name.
> It will still generate a commit message in the format `revert: `
+> ⚠️ Enabling this plugin will (potentially) overwrite all `alias.` that you manually set. Use with
+> care!
+
## Examples
| Git alias | Command |
diff --git a/plugins/git-commit/git-commit.plugin.zsh b/plugins/git-commit/git-commit.plugin.zsh
index 3f0c2121d..c4df77c80 100644
--- a/plugins/git-commit/git-commit.plugin.zsh
+++ b/plugins/git-commit/git-commit.plugin.zsh
@@ -1,3 +1,9 @@
+local _rev="$(git -C $ZSH rev-parse HEAD 2> /dev/null)"
+if [[ $_rev == $(git config --global --get oh-my-zsh.git-commit-alias 2> /dev/null) ]]; then
+ return
+fi
+git config --global oh-my-zsh.git-commit-alias "$_rev"
+
local -a _git_commit_aliases
_git_commit_aliases=(
'build'
@@ -14,19 +20,39 @@ _git_commit_aliases=(
'wip'
)
-local alias type
-for type in "${_git_commit_aliases[@]}"; do
+local _alias _type
+for _type in "${_git_commit_aliases[@]}"; do
# an alias can't be named "revert" because the git command takes precedence
# https://stackoverflow.com/a/3538791
- case "$type" in
- revert) alias=rev ;;
- *) alias=$type ;;
+ case "$_type" in
+ revert) _alias=rev ;;
+ *) _alias=$_type ;;
esac
- local func='!a() { if [ "$1" = "-s" ] || [ "$1" = "--scope" ]; then local scope="$2"; shift 2; git commit -m "'$type'(${scope}): ${@}"; else git commit -m "'$type': ${@}"; fi }; a'
- if ! git config --global --get-all alias.${alias} >/dev/null 2>&1; then
- git config --global alias.${alias} "$func"
- fi
+ local _func='!a() {
+local _scope _attention _message
+while [ $# -ne 0 ]; do
+case $1 in
+ -s | --scope )
+ if [ -z $2 ]; then
+ echo "Missing scope!"
+ return 1
+ fi
+ _scope="$2"
+ shift 2
+ ;;
+ -a | --attention )
+ _attention="!"
+ shift 1
+ ;;
+ * )
+ _message="${_message} $1"
+ shift 1
+ ;;
+esac
done
+git commit -m "'$_type'${_scope:+(${_scope})}${_attention}:${_message}"
+}; a'
-unset _git_commit_aliases alias type func
+ git config --global alias.$_alias "$_func"
+done
diff --git a/plugins/git-prompt/README.md b/plugins/git-prompt/README.md
index 05208d72f..8f42c6842 100644
--- a/plugins/git-prompt/README.md
+++ b/plugins/git-prompt/README.md
@@ -9,6 +9,10 @@ To use it, add `git-prompt` to the plugins array in your zshrc file:
plugins=(... git-prompt)
```
+You may also need to [customize your theme](https://github.com/ohmyzsh/ohmyzsh/issues/9395#issuecomment-1027130429)
+to change the way the prompt is built. See the
+[OMZ wiki on customizing themes](https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes).
+
See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
## Requirements
diff --git a/plugins/git/README.md b/plugins/git/README.md
index 4acb0c858..4c005ad2f 100644
--- a/plugins/git/README.md
+++ b/plugins/git/README.md
@@ -111,6 +111,7 @@ plugins=(... git)
| `gfg` | `git ls-files \| grep` |
| `gm` | `git merge` |
| `gma` | `git merge --abort` |
+| `gmc` | `git merge --continue` |
| `gms` | `git merge --squash` |
| `gmom` | `git merge origin/$(git_main_branch)` |
| `gmum` | `git merge upstream/$(git_main_branch)` |
@@ -166,6 +167,7 @@ plugins=(... git)
| `grhk` | `git reset --keep` |
| `grhs` | `git reset --soft` |
| `gpristine` | `git reset --hard && git clean --force -dfx` |
+| `gwipe` | `git reset --hard && git clean --force -df` |
| `groh` | `git reset origin/$(git_current_branch) --hard` |
| `grs` | `git restore` |
| `grss` | `git restore --source` |
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index 692a36a73..146f4a512 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -252,6 +252,7 @@ alias gignored='git ls-files -v | grep "^[[:lower:]]"'
alias gfg='git ls-files | grep'
alias gm='git merge'
alias gma='git merge --abort'
+alias gmc='git merge --continue'
alias gms="git merge --squash"
alias gmom='git merge origin/$(git_main_branch)'
alias gmum='git merge upstream/$(git_main_branch)'
@@ -349,6 +350,7 @@ alias grhh='git reset --hard'
alias grhk='git reset --keep'
alias grhs='git reset --soft'
alias gpristine='git reset --hard && git clean --force -dfx'
+alias gwipe='git reset --hard && git clean --force -df'
alias groh='git reset origin/$(git_current_branch) --hard'
alias grs='git restore'
alias grss='git restore --source'
diff --git a/plugins/gitfast/README.md b/plugins/gitfast/README.md
index fed4b120a..60b84a23c 100644
--- a/plugins/gitfast/README.md
+++ b/plugins/gitfast/README.md
@@ -7,9 +7,3 @@ To use it, add `gitfast` to the plugins array in your zshrc file:
```zsh
plugins=(... gitfast)
```
-
-## Aliases
-
-An earlier version of the plugin also loaded the git plugin. If you want to keep those
-aliases enable the [git plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git)
-as well.
diff --git a/plugins/gitfast/gitfast.plugin.zsh b/plugins/gitfast/gitfast.plugin.zsh
index a6db0c6bd..c456eff7f 100644
--- a/plugins/gitfast/gitfast.plugin.zsh
+++ b/plugins/gitfast/gitfast.plugin.zsh
@@ -1,6 +1,6 @@
# Handle $0 according to the standard:
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
-0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
+0="${ZERO:-${${0:#$ZSH_ARGZERO}:-${(%):-%N}}}"
0="${${(M)0:#/*}:-$PWD/$0}"
source "${0:A:h}/git-prompt.sh"
diff --git a/plugins/gitfast/update b/plugins/gitfast/update
deleted file mode 100755
index feb13ff7e..000000000
--- a/plugins/gitfast/update
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-url="https://raw.githubusercontent.com/felipec/git-completion"
-version="1.3.7"
-
-curl -s -o _git "${url}/v${version}/git-completion.zsh" &&
-curl -s -o git-completion.bash "${url}/v${version}/git-completion.bash" &&
-curl -s -o git-prompt.sh "${url}/v${version}/git-prompt.sh"
diff --git a/plugins/gnu-utils/gnu-utils.plugin.zsh b/plugins/gnu-utils/gnu-utils.plugin.zsh
index 6023bf2b4..adc2bd3bb 100644
--- a/plugins/gnu-utils/gnu-utils.plugin.zsh
+++ b/plugins/gnu-utils/gnu-utils.plugin.zsh
@@ -14,7 +14,7 @@ __gnu_utils() {
local -a gcmds
local gcmd
- # coreutils
+ # coreutils
gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
@@ -41,7 +41,7 @@ __gnu_utils() {
for gcmd in "${gcmds[@]}"; do
# Do nothing if the command isn't found
(( ${+commands[$gcmd]} )) || continue
-
+
# This method allows for builtin commands to be primary but it's
# lost if hash -r or rehash is executed, or if $PATH is updated.
# Thus, a preexec hook is needed, which will only run if whoami
diff --git a/plugins/gradle/LICENSE b/plugins/gradle/LICENSE
new file mode 100644
index 000000000..06edf4af2
--- /dev/null
+++ b/plugins/gradle/LICENSE
@@ -0,0 +1,19 @@
+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.
diff --git a/plugins/gradle/_gradle b/plugins/gradle/_gradle
index f8df928b4..ca13fd0b0 100644
--- a/plugins/gradle/_gradle
+++ b/plugins/gradle/_gradle
@@ -1,28 +1,4 @@
#compdef gradle gradlew gw
-# THE LINE ABOVE MUST BE THE FIRST LINE OF THIS FILE IN ORDER FOR COMPLETION TO WORK
-
-#
-# 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`
@@ -38,7 +14,7 @@ __gradle-set-project-root-dir() {
}
__gradle-init-cache-dir() {
- cache_dir="$HOME/.gradle/completion"
+ cache_dir="${GRADLE_USER_HOME:-$HOME/.gradle}/completion"
mkdir -p $cache_dir
}
@@ -98,7 +74,7 @@ __gradle-generate-script-cache() {
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") )
+ gradle_build_scripts=( $(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | grep -E -v "$script_exclude_pattern") )
printf "%s\n" "${gradle_build_scripts[@]}" >| $cache_dir/$cache_name
fi
}
@@ -125,7 +101,7 @@ __gradle-generate-tasks-cache() {
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
+ if [[ $output_line =~ ^([[:alpha:]][[:alnum:][:punct:]]*)([[:space:]]-[[:space:]]([[:print:]]*))? ]]; then
local task_name="${match[1]}"
local task_description="${match[3]}"
# Completion for subproject tasks with ':' prefix
diff --git a/plugins/grails/grails.plugin.zsh b/plugins/grails/grails.plugin.zsh
index ddc257428..e5dceb530 100644
--- a/plugins/grails/grails.plugin.zsh
+++ b/plugins/grails/grails.plugin.zsh
@@ -7,7 +7,7 @@ _enumerateGrailsScripts() {
then
directories+=(plugins/*/scripts)
fi
-
+
# Enumerate all of the Groovy files
files=()
for dir in $directories;
@@ -17,13 +17,13 @@ _enumerateGrailsScripts() {
files+=($dir/[^_]*.groovy)
fi
done
-
+
# Don't try to basename ()
if [ ${#files} -eq 0 ];
then
return
fi
-
+
scripts=()
for file in $files
do
@@ -42,19 +42,19 @@ _enumerateGrailsScripts() {
done
echo $scripts
}
-
+
_grails() {
if (( CURRENT == 2 )); then
scripts=( $(_enumerateGrailsScripts) )
-
+
if [ ${#scripts} -ne 0 ];
then
_multi_parts / scripts
return
fi
fi
-
+
_files
}
-
+
compdef _grails grails
diff --git a/plugins/history-substring-search/README.md b/plugins/history-substring-search/README.md
index 71a389535..4be744c4c 100644
--- a/plugins/history-substring-search/README.md
+++ b/plugins/history-substring-search/README.md
@@ -57,13 +57,13 @@ Using [antigen](https://github.com/zsh-users/antigen):
1. Add the `antigen bundle` command just before `antigen apply`, like this:
-```
+```
antigen bundle zsh-users/zsh-history-substring-search
antigen apply
```
-
+
2. Then, **after** `antigen apply`, add the key binding configurations, like this:
-
+
```
# zsh-history-substring-search configuration
bindkey '^[[A' history-substring-search-up # or '\eOA'
@@ -120,7 +120,7 @@ Usage
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
- Users have also observed that `[OA` and `[OB` are correct values,
+ Users have also observed that `[OA` and `[OB` are correct values,
_even if_ these were not the observed values. If you are having trouble
with the observed values, give these a try.
diff --git a/plugins/httpie/_httpie b/plugins/httpie/_httpie
index 11bc8e1f8..2c0db229f 100644
--- a/plugins/httpie/_httpie
+++ b/plugins/httpie/_httpie
@@ -1,4 +1,4 @@
-#compdef http
+#compdef http https
# ------------------------------------------------------------------------------
# Copyright (c) 2015 GitHub zsh-users - http://github.com/zsh-users
# All rights reserved.
diff --git a/plugins/ionic/ionic.plugin.zsh b/plugins/ionic/ionic.plugin.zsh
index cf388af1b..e3913b549 100644
--- a/plugins/ionic/ionic.plugin.zsh
+++ b/plugins/ionic/ionic.plugin.zsh
@@ -3,13 +3,13 @@ alias ih="ionic --help"
alias ist="ionic start"
alias ii="ionic info"
alias is="ionic serve"
-alias icba="ionic cordova build android"
-alias icbi="ionic cordova build ios"
-alias icra="ionic cordova run android"
-alias icri="ionic cordova run ios"
-alias icrsa="ionic cordova resources android"
+alias icba="ionic cordova build android"
+alias icbi="ionic cordova build ios"
+alias icra="ionic cordova run android"
+alias icri="ionic cordova run ios"
+alias icrsa="ionic cordova resources android"
alias icrsi="ionic cordova resources ios"
-alias icpaa="ionic cordova platform add android"
+alias icpaa="ionic cordova platform add android"
alias icpai="ionic cordova platform add ios"
alias icpra="ionic cordova platform rm android"
alias icpri="ionic cordova platform rm ios"
diff --git a/plugins/ipfs/_ipfs b/plugins/ipfs/_ipfs
index 8771bc4ba..5b8b05b98 100644
--- a/plugins/ipfs/_ipfs
+++ b/plugins/ipfs/_ipfs
@@ -202,7 +202,7 @@ _ipfs_subcommand(){
_arguments \
'--resolve[Check if the given path can be resolved before publishing. Default: true.]' \
'(-t --lifetime)'{-t,--lifetime}'[Time duration that the record will be valid for. Default: 24h.]' \
- '--allow-offline[When offline, save the IPNS record to the the local datastore without broadcasting to the network instead of simply failing.]' \
+ '--allow-offline[When offline, save the IPNS record to the local datastore without broadcasting to the network instead of simply failing.]' \
'--ttl[Time duration this record should be cached for. Uses the same syntax as the lifetime option. (caution: experimental).]' \
'(-k --key)'{-k,--key}"[Name of the key to be used or a valid PeerID, as listed by 'ipfs key list -l'. Default: self.]" \
'(-Q --quieter)'{-Q,--quieter}'[Write only final hash.]' \
diff --git a/plugins/iterm2/README.md b/plugins/iterm2/README.md
index 3d11622df..86bd77f1d 100644
--- a/plugins/iterm2/README.md
+++ b/plugins/iterm2/README.md
@@ -9,7 +9,7 @@ plugins=(... iterm2)
```
Optionally, the plugin also applies the [Shell Integration Script for iTerm2](https://iterm2.com/documentation-shell-integration.html).
-You can enable the integration with zstyle. It's important to add this line
+You can enable the integration with zstyle. It's important to add this line
before the line sourcing oh-my-zsh:
```
diff --git a/plugins/iterm2/iterm2.plugin.zsh b/plugins/iterm2/iterm2.plugin.zsh
index d00232a30..03a63a70c 100644
--- a/plugins/iterm2/iterm2.plugin.zsh
+++ b/plugins/iterm2/iterm2.plugin.zsh
@@ -8,7 +8,7 @@
if [[ "$OSTYPE" == darwin* ]] && [[ -n "$ITERM_SESSION_ID" ]] ; then
# maybe make it the default in the future and allow opting out?
- if zstyle -t ':omz:plugins:iterm2' shell-integration; then
+ if zstyle -t ':omz:plugins:iterm2' shell-integration; then
# Handle $0 according to the standard:
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
diff --git a/plugins/iterm2/iterm2_shell_integration.zsh b/plugins/iterm2/iterm2_shell_integration.zsh
index 7871ddded..281332e0d 100644
--- a/plugins/iterm2/iterm2_shell_integration.zsh
+++ b/plugins/iterm2/iterm2_shell_integration.zsh
@@ -2,12 +2,12 @@
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/plugins/jira/README.md b/plugins/jira/README.md
index d78ea15a4..1c6930298 100644
--- a/plugins/jira/README.md
+++ b/plugins/jira/README.md
@@ -16,23 +16,26 @@ This plugin supplies one command, `jira`, through which all its features are exp
## Commands
+`jira help` or `jira usage` will print the below usage instructions
+
| Command | Description |
| :------------ | :-------------------------------------------------------- |
| `jira` | Performs the default action |
| `jira new` | Opens a new Jira issue dialogue |
| `jira ABC-123` | Opens an existing issue |
| `jira ABC-123 m` | Opens an existing issue for adding a comment |
-| `jira dashboard [rapid_view]` | # opens your JIRA dashboard |
+| `jira dashboard [rapid_view]` | Opens your JIRA dashboard |
| `jira mine` | Queries for your own issues |
| `jira tempo` | Opens your JIRA Tempo |
| `jira reported [username]` | Queries for issues reported by a user |
| `jira assigned [username]` | Queries for issues assigned to a user |
| `jira branch` | Opens an existing issue matching the current branch name |
+| `jira help` | Prints usage instructions |
### Jira Branch usage notes
-The branch name may have prefixes ending in "/": "feature/MP-1234", and also suffixes
+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"
This is also checks if the prefix is in the name, and adds it if not, so: "MP-1234" opens the issue "MP-1234",
diff --git a/plugins/jira/_jira b/plugins/jira/_jira
index 0e37b7e9d..5f7dcd09d 100644
--- a/plugins/jira/_jira
+++ b/plugins/jira/_jira
@@ -11,6 +11,7 @@ _1st_arguments=(
'assigned:search for issues assigned to a user'
'branch:open the issue named after the git branch of the current directory'
'dumpconfig:display effective jira configuration'
+ 'help:print usage help to stdout'
)
_arguments -C \
diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh
index b6ee9f100..9bcf4cc7b 100644
--- a/plugins/jira/jira.plugin.zsh
+++ b/plugins/jira/jira.plugin.zsh
@@ -2,6 +2,21 @@
#
# See README.md for details
+function _jira_usage() {
+cat < /dev/null; then
- # GNU stat
- mtime=$(stat -L -c %Y "${file}")
+ if [[ "${KUBE_PS1_KUBECONFIG_SYMLINK}" == "true" ]]; then
+ 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}")
+ else
+ # BSD stat
+ mtime=$(stat -f %m "$file")
+ fi
else
- # BSD stat
- mtime=$(stat -L -f %m "$file")
+ if [[ "${KUBE_PS1_SHELL}" == "zsh" ]]; then
+ mtime=$(zstat +mtime "${file}")
+ elif stat -c "%s" /dev/null &> /dev/null; then
+ # GNU stat
+ mtime=$(stat -L -c %Y "${file}")
+ else
+ # BSD stat
+ mtime=$(stat -L -f %m "$file")
+ fi
fi
[[ "${mtime}" -gt "${check_time}" ]]
diff --git a/plugins/laravel/README.md b/plugins/laravel/README.md
index 95f590191..a831a86b6 100644
--- a/plugins/laravel/README.md
+++ b/plugins/laravel/README.md
@@ -10,6 +10,7 @@ plugins=(... laravel)
|:-:|:-:|
| `artisan` | `php artisan` |
| `pas` | `php artisan serve` |
+| `pats` | `php artisan test` |
## Database
diff --git a/plugins/laravel/laravel.plugin.zsh b/plugins/laravel/laravel.plugin.zsh
index a8382d3c9..319946f07 100644
--- a/plugins/laravel/laravel.plugin.zsh
+++ b/plugins/laravel/laravel.plugin.zsh
@@ -4,6 +4,7 @@ alias bob='php artisan bob::build'
# Development
alias pas='php artisan serve'
+alias pats='php artisan test'
# Database
alias pam='php artisan migrate'
diff --git a/plugins/macos/README.md b/plugins/macos/README.md
index 1cb9b395d..2c52ec8a7 100644
--- a/plugins/macos/README.md
+++ b/plugins/macos/README.md
@@ -17,7 +17,7 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
| `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 |
+| `ofd` | Open passed directories (or $PWD by default) in Finder |
| `pfd` | Return the path of the frontmost Finder window |
| `pfs` | Return the current Finder selection |
| `cdf` | `cd` to the current Finder directory |
diff --git a/plugins/macos/macos.plugin.zsh b/plugins/macos/macos.plugin.zsh
index a4347005e..2702a1901 100644
--- a/plugins/macos/macos.plugin.zsh
+++ b/plugins/macos/macos.plugin.zsh
@@ -3,8 +3,15 @@
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
-# Open the current directory in a Finder window
-alias ofd='open_command $PWD'
+# Open in Finder the directories passed as arguments, or the current directory if
+# no directories are passed
+function ofd {
+ if (( ! $# )); then
+ open_command $PWD
+ else
+ open_command $@
+ fi
+}
# Show/hide hidden files in the Finder
alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
diff --git a/plugins/macports/_port b/plugins/macports/_port
index 897598a46..f40f6550b 100644
--- a/plugins/macports/_port
+++ b/plugins/macports/_port
@@ -1,6 +1,6 @@
#compdef port
-local subcmds
+local subcmds
# we cache the list of ports
# we shall use some cache policy to avoid problems with new ports
@@ -31,8 +31,8 @@ subcmds=(
'file'
'help'
'info'
-'install'
-'installed'
+'install'
+'installed'
'list'
'livecheck'
'location'
@@ -51,7 +51,7 @@ subcmds=(
'test'
'unarchive'
'uninstall'
-'upgrade'
+'upgrade'
'variants'
'version'
)
diff --git a/plugins/marked2/README.md b/plugins/marked2/README.md
index 101343abb..2f825bc4a 100644
--- a/plugins/marked2/README.md
+++ b/plugins/marked2/README.md
@@ -1,6 +1,6 @@
## marked2
-Plugin for Marked 2, a previewer for Markdown files on Mac OS X
+Plugin for Marked 2, a previewer for Markdown files on Mac OS X
### Requirements
diff --git a/plugins/marktext/README.md b/plugins/marktext/README.md
index 71d287451..254e4e7ac 100644
--- a/plugins/marktext/README.md
+++ b/plugins/marktext/README.md
@@ -1,6 +1,6 @@
## marktext
-Plugin for MarkText, a previewer for Markdown files on Mac OS X
+Plugin for MarkText, a previewer for Markdown files on Mac OS X
### Requirements
diff --git a/plugins/mise/mise.plugin.zsh b/plugins/mise/mise.plugin.zsh
index 1b4d3ae81..357174d91 100644
--- a/plugins/mise/mise.plugin.zsh
+++ b/plugins/mise/mise.plugin.zsh
@@ -11,6 +11,9 @@ fi
# Load mise hooks
eval "$($__mise activate zsh)"
+# Hook mise into current environment
+eval "$($__mise hook-env -s zsh)"
+
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `mise`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_$__mise" ]]; then
diff --git a/plugins/mongo-atlas/README.md b/plugins/mongo-atlas/README.md
index ef1b5e0d2..94183c544 100644
--- a/plugins/mongo-atlas/README.md
+++ b/plugins/mongo-atlas/README.md
@@ -1,6 +1,6 @@
# MongoDB Atlas plugin
-This plugin adds completion for [Atlas](https://www.mongodb.com/docs/atlas/cli/stable/) a command line interface built specifically for
+This plugin adds completion for [Atlas](https://www.mongodb.com/docs/atlas/cli/stable/) a command line interface built specifically for
MongoDB Atlas.
To use it, add `mongo-atlas` to the plugins array in your zshrc file:
diff --git a/plugins/n98-magerun/n98-magerun.plugin.zsh b/plugins/n98-magerun/n98-magerun.plugin.zsh
index d79aee7eb..2744ad96e 100644
--- a/plugins/n98-magerun/n98-magerun.plugin.zsh
+++ b/plugins/n98-magerun/n98-magerun.plugin.zsh
@@ -1,6 +1,6 @@
# ------------------------------------------------------------------------------
# FILE: n98-magerun.plugin.zsh
-# DESCRIPTION: oh-my-zsh n98-magerun plugin file. Adapted from composer plugin
+# DESCRIPTION: oh-my-zsh n98-magerun plugin file. Adapted from composer plugin
# AUTHOR: Andrew Dwyer (andrewrdwyer at gmail dot com)
# AUTHOR: Jisse Reitsma (jisse at yireo dot com)
# VERSION: 1.1.0
diff --git a/plugins/nmap/nmap.plugin.zsh b/plugins/nmap/nmap.plugin.zsh
index 406870f00..f649dafc2 100644
--- a/plugins/nmap/nmap.plugin.zsh
+++ b/plugins/nmap/nmap.plugin.zsh
@@ -27,6 +27,6 @@ alias nmap_detect_versions="sudo nmap -sV -p1-65535 -O --osscan-guess -T4 -Pn"
alias nmap_check_for_vulns="nmap --script=vuln"
alias nmap_full_udp="sudo nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,443,3389 "
alias nmap_traceroute="sudo nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute "
-alias nmap_full_with_scripts="sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all "
+alias nmap_full_with_scripts="sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all "
alias nmap_web_safe_osscan="sudo nmap -p 80,443 -O -v --osscan-guess --fuzzy "
alias nmap_ping_scan="nmap -n -sP"
diff --git a/plugins/nomad/_nomad b/plugins/nomad/_nomad
index 1c935a02e..87f80aa84 100644
--- a/plugins/nomad/_nomad
+++ b/plugins/nomad/_nomad
@@ -89,7 +89,7 @@ __plan() {
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
'-no-color[Disables colored command output.]' \
- '-diff[Determines whether the diff between the remote job and planned job is shown. Defaults to true.]'
+ '-diff[Determines whether the diff between the remote job and planned job is shown. Defaults to true.]'
}
__run() {
@@ -97,7 +97,7 @@ __run() {
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
'-no-color[Disables colored command output.]' \
- '-check-index[If set, the job is only registered or updated if the the passed job modify index matches the server side version. If a check-index value of zero is passed, the job is only registered if it does not yet exist. If a non-zero value is passed, it ensures that the job is being updated from a known state. The use of this flag is most common in conjunction with plan command.]' \
+ '-check-index[If set, the job is only registered or updated if the passed job modify index matches the server side version. If a check-index value of zero is passed, the job is only registered if it does not yet exist. If a non-zero value is passed, it ensures that the job is being updated from a known state. The use of this flag is most common in conjunction with plan command.]' \
'-detach[Return immediately instead of entering monitor mode. After job submission, the evaluation ID will be printed to the screen, which can be used to examine the evaluation using the eval-status command.]' \
'-output[Output the JSON that would be submitted to the HTTP API without submitting the job.]' \
'-verbose[Show full information.]'
diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh
index 23377b085..c333f76ed 100644
--- a/plugins/npm/npm.plugin.zsh
+++ b/plugins/npm/npm.plugin.zsh
@@ -58,7 +58,7 @@ alias npmt="npm test"
# Run npm scripts
alias npmR="npm run"
-# Run npm publish
+# Run npm publish
alias npmP="npm publish"
# Run npm init
diff --git a/plugins/nvm/README.md b/plugins/nvm/README.md
index b5ef221d3..e88ce0158 100644
--- a/plugins/nvm/README.md
+++ b/plugins/nvm/README.md
@@ -43,8 +43,7 @@ zstyle ':omz:plugins:nvm' lazy-cmd eslint prettier typescript ...
#### `.nvmrc` autoload
-Note: _this option cannot be used at the same time as `lazy`. `autoload` will override it and load `nvm` at
-startup._
+Note: _if used at the same time as `lazy`, `autoload` will start working only after nvm has been lazy-loaded_
If set, the plugin will automatically load a node version when if finds a
[`.nvmrc` file](https://github.com/nvm-sh/nvm#nvmrc) in the current working directory indicating which node
diff --git a/plugins/nvm/_nvm b/plugins/nvm/_nvm
deleted file mode 100644
index e292a8d8c..000000000
--- a/plugins/nvm/_nvm
+++ /dev/null
@@ -1,34 +0,0 @@
-#compdef nvm
-#autoload
-
-[[ -f "$NVM_DIR/nvm.sh" ]] || return 0
-
-local -a _1st_arguments
-_1st_arguments=(
- 'help:show help'
- '--version:print out the latest released version of nvm'
- 'install:download and install a version in '
- 'install-latest-npm:download and install the latest npm version'
- 'uninstall:uninstall a version'
- 'use:modify PATH to use . Uses .nvmrc if available'
- 'exec:run on . Uses .nvmrc if available'
- 'run:run `node` on with as arguments. Uses .nvmrc if available'
- 'current:list installed versions'
- 'ls:list installed versions or versions matching a given description'
- 'version:resolve the given description to a single local version'
- 'version-remote:resolve the given description to a single remote version'
- 'ls-remote:list remote versions available for install'
- 'deactivate:undo effects of `nvm` on current shell'
- 'alias:show or set aliases'
- 'unalias:deletes an alias'
- 'reinstall-packages:reinstall global `npm` packages contained in to current version'
- 'unload:unload `nvm` from shell'
- 'which:display path to installed node version. Uses .nvmrc if available'
-)
-
-_arguments -C '*:: :->subcmds' && return 0
-
-if (( CURRENT == 1 )); then
- _describe -t commands "nvm subcommand" _1st_arguments
- return
-fi
diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh
index 94b666175..c2e8de94b 100644
--- a/plugins/nvm/nvm.plugin.zsh
+++ b/plugins/nvm/nvm.plugin.zsh
@@ -1,3 +1,7 @@
+# Don't try to load nvm if command already available
+# Note: nvm is a function so we need to use `which`
+which nvm &>/dev/null && return
+
# See https://github.com/nvm-sh/nvm#installation-and-update
if [[ -z "$NVM_DIR" ]]; then
if [[ -d "$HOME/.nvm" ]]; then
@@ -12,41 +16,35 @@ if [[ -z "$NVM_DIR" ]]; then
fi
fi
-# Don't try to load nvm if command already available
-# Note: nvm is a function so we need to use `which`
-which nvm &>/dev/null && return
-
-if [[ -z "$NVM_DIR" ]] || [[ ! -f "$NVM_DIR/nvm.sh" ]]; then
+if [[ -z "$NVM_DIR" ]] || [[ ! -f "$NVM_DIR/nvm.sh" ]]; then
return
fi
-if zstyle -t ':omz:plugins:nvm' lazy && \
- ! zstyle -t ':omz:plugins:nvm' autoload; then
- # Call nvm when first using nvm, node, npm, pnpm, yarn or other commands in lazy-cmd
- zstyle -a ':omz:plugins:nvm' lazy-cmd nvm_lazy_cmd
- nvm_lazy_cmd=(nvm node npm npx pnpm yarn $nvm_lazy_cmd) # default values
- eval "
- function $nvm_lazy_cmd {
- for func in $nvm_lazy_cmd; do
- if (( \$+functions[\$func] )); then
- unfunction \$func
- fi
- done
- # Load nvm if it exists in \$NVM_DIR
- [[ -f \"\$NVM_DIR/nvm.sh\" ]] && source \"\$NVM_DIR/nvm.sh\"
- \"\$0\" \"\$@\"
- }
- "
- unset nvm_lazy_cmd
-else
- source "$NVM_DIR/nvm.sh"
-fi
+function _omz_load_nvm_completion {
+ local _nvm_completion
+ # Load nvm bash completion
+ for _nvm_completion in "$NVM_DIR/bash_completion" "$NVM_HOMEBREW/etc/bash_completion.d/nvm"; do
+ if [[ -f "$_nvm_completion" ]]; then
+ # Load bashcompinit
+ autoload -U +X bashcompinit && bashcompinit
+ # Bypass compinit call in nvm bash completion script. See:
+ # https://github.com/nvm-sh/nvm/blob/4436638/bash_completion#L86-L93
+ ZSH_VERSION= source "$_nvm_completion"
+ break
+ fi
+ done
+ unfunction _omz_load_nvm_completion
+}
-# Autoload nvm when finding a .nvmrc file in the current directory
-# Adapted from: https://github.com/nvm-sh/nvm#zsh
-if zstyle -t ':omz:plugins:nvm' autoload; then
+function _omz_setup_autoload {
+ if ! zstyle -t ':omz:plugins:nvm' autoload; then
+ unfunction _omz_setup_autoload
+ return
+ fi
+
+ # Autoload nvm when finding a .nvmrc file in the current directory
+ # Adapted from: https://github.com/nvm-sh/nvm#zsh
function load-nvmrc {
- local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
local nvm_silent=""
zstyle -t ':omz:plugins:nvm' silent-autoload && nvm_silent="--silent"
@@ -59,10 +57,8 @@ if zstyle -t ':omz:plugins:nvm' autoload; then
elif [[ "$nvmrc_node_version" != "$node_version" ]]; then
nvm use $nvm_silent
fi
- elif [[ "$node_version" != "$(nvm version default)" ]]; then
- if [[ -z $nvm_silent ]]; then
- echo "Reverting to nvm default version"
- fi
+ elif [[ -n "$(PWD=$OLDPWD nvm_find_nvmrc)" ]] && [[ "$(nvm version)" != "$(nvm version default)" ]]; then
+ [[ -z $nvm_silent ]] && echo "Reverting to nvm default version"
nvm use default $nvm_silent
fi
@@ -72,18 +68,30 @@ if zstyle -t ':omz:plugins:nvm' autoload; then
add-zsh-hook chpwd load-nvmrc
load-nvmrc
+ unfunction _omz_setup_autoload
+}
+
+if zstyle -t ':omz:plugins:nvm' lazy; then
+ # Call nvm when first using nvm, node, npm, pnpm, yarn or other commands in lazy-cmd
+ zstyle -a ':omz:plugins:nvm' lazy-cmd nvm_lazy_cmd
+ nvm_lazy_cmd=(nvm node npm npx pnpm yarn $nvm_lazy_cmd) # default values
+ eval "
+ function $nvm_lazy_cmd {
+ for func in $nvm_lazy_cmd; do
+ if (( \$+functions[\$func] )); then
+ unfunction \$func
+ fi
+ done
+ # Load nvm if it exists in \$NVM_DIR
+ [[ -f \"\$NVM_DIR/nvm.sh\" ]] && source \"\$NVM_DIR/nvm.sh\"
+ _omz_load_nvm_completion
+ _omz_setup_autoload
+ \"\$0\" \"\$@\"
+ }
+ "
+ unset nvm_lazy_cmd
+else
+ source "$NVM_DIR/nvm.sh"
+ _omz_load_nvm_completion
+ _omz_setup_autoload
fi
-
-# Load nvm bash completion
-for nvm_completion in "$NVM_DIR/bash_completion" "$NVM_HOMEBREW/etc/bash_completion.d/nvm"; do
- if [[ -f "$nvm_completion" ]]; then
- # Load bashcompinit
- autoload -U +X bashcompinit && bashcompinit
- # Bypass compinit call in nvm bash completion script. See:
- # https://github.com/nvm-sh/nvm/blob/4436638/bash_completion#L86-L93
- ZSH_VERSION= source "$nvm_completion"
- break
- fi
-done
-
-unset NVM_HOMEBREW nvm_completion
diff --git a/plugins/otp/README.md b/plugins/otp/README.md
index 8331fd02b..52ad9525b 100644
--- a/plugins/otp/README.md
+++ b/plugins/otp/README.md
@@ -16,7 +16,7 @@ Provided aliases:
email address). Then the OTP key needs to be pasted, followed by a CTRL+D character
inserted on an empty line.
-- `ot`: generates a MFA code based on the given key and copies it to the clipboard
+- `ot`: generates a MFA code based on the given key and copies it to the clipboard
(on Linux it relies on xsel, on MacOS X it uses pbcopy instead).
The plugin uses `$HOME/.otp` to store its internal files.
diff --git a/plugins/per-directory-history/per-directory-history.zsh b/plugins/per-directory-history/per-directory-history.zsh
index b33e0b5dd..926373ae0 100644
--- a/plugins/per-directory-history/per-directory-history.zsh
+++ b/plugins/per-directory-history/per-directory-history.zsh
@@ -21,7 +21,7 @@
#-------------------------------------------------------------------------------
#
# The idea/inspiration for a per directory history is from Stewart MacArthur[1]
-# and Dieter[2], the implementation idea is from Bart Schaefer on the the zsh
+# and Dieter[2], the implementation idea is from Bart Schaefer on the zsh
# mailing list[3]. The implementation is by Jim Hester in September 2012.
#
# [1]: http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html
diff --git a/plugins/pm2/_pm2 b/plugins/pm2/_pm2
index faa6a3404..66320b810 100644
--- a/plugins/pm2/_pm2
+++ b/plugins/pm2/_pm2
@@ -79,7 +79,7 @@ _id_names() {
local app_list
app_list=`pm2 list -m`
- local -a names ids
+ local -a names ids
names=(`echo $app_list | grep '+---' | awk '{print $2}'`)
ids=(`echo $app_list | grep 'pm2 id' | awk '{print $4}'`)
diff --git a/plugins/poetry-env/README.md b/plugins/poetry-env/README.md
index a7d16563e..bd99d2a91 100644
--- a/plugins/poetry-env/README.md
+++ b/plugins/poetry-env/README.md
@@ -1,6 +1,6 @@
# Poetry Environment Plugin
-This plugin automatically changes poetry environment when you cd into or out of the project directory.
+This plugin automatically changes poetry environment when you cd into or out of the project directory.
Note: Script looks for pyproject.toml file to determine poetry if its a poetry environment
To use it, add `poetry-env` to the plugins array in your zshrc file:
diff --git a/plugins/poetry-env/poetry-env.plugin.zsh b/plugins/poetry-env/poetry-env.plugin.zsh
index 86e5fad4e..be46717d8 100644
--- a/plugins/poetry-env/poetry-env.plugin.zsh
+++ b/plugins/poetry-env/poetry-env.plugin.zsh
@@ -1,27 +1,27 @@
-# Automatic poetry environment activation/deactivation
_togglePoetryShell() {
- # deactivate environment if pyproject.toml doesn't exist and not in a subdir
- if [[ ! -f "$PWD/pyproject.toml" ]] ; then
- if [[ "$poetry_active" == 1 ]]; then
- if [[ "$PWD" != "$poetry_dir"* ]]; then
- export poetry_active=0
- deactivate
- return
- fi
- fi
+ # Determine if currently in a Poetry-managed directory
+ local in_poetry_dir=0
+ if [[ -f "$PWD/pyproject.toml" ]] && grep -q 'tool.poetry' "$PWD/pyproject.toml"; then
+ in_poetry_dir=1
fi
- # activate the environment if pyproject.toml exists
- if [[ "$poetry_active" != 1 ]]; then
- if [[ -f "$PWD/pyproject.toml" ]]; then
- if grep -q 'tool.poetry' "$PWD/pyproject.toml"; then
- export poetry_active=1
- export poetry_dir="$PWD"
- source "$(poetry env info --path)/bin/activate"
- fi
+ # Deactivate the current environment if moving out of a Poetry directory or into a different Poetry directory
+ if [[ $poetry_active -eq 1 ]] && { [[ $in_poetry_dir -eq 0 ]] && [[ "$PWD" != "$poetry_dir"* ]]; }; then
+ export poetry_active=0
+ unset poetry_dir
+ deactivate
+ fi
+
+ # Activate the environment if in a Poetry directory and no environment is currently active
+ if [[ $in_poetry_dir -eq 1 ]] && [[ $poetry_active -ne 1 ]]; then
+ venv_dir=$(poetry env info --path 2>/dev/null)
+ if [[ -n "$venv_dir" ]]; then
+ export poetry_active=1
+ export poetry_dir="$PWD"
+ source "${venv_dir}/bin/activate"
fi
fi
}
autoload -U add-zsh-hook
add-zsh-hook chpwd _togglePoetryShell
-_togglePoetryShell
+_togglePoetryShell # Initial call to check the current directory at shell startup
diff --git a/plugins/pyenv/README.md b/plugins/pyenv/README.md
index f1ca3d288..f18fc8cfb 100644
--- a/plugins/pyenv/README.md
+++ b/plugins/pyenv/README.md
@@ -10,7 +10,7 @@ To use it, add `pyenv` to the plugins array in your zshrc file:
plugins=(... pyenv)
```
-If you receive a `Found pyenv, but it is badly configured.` error on startup, you may need to ensure that `pyenv` is initialized before the oh-my-zsh pyenv plugin is loaded. This can be achived by adding the following earlier in the `.zshrc` file than the `plugins=(...)` line:
+If you receive a `Found pyenv, but it is badly configured.` error on startup, you may need to ensure that `pyenv` is initialized before the oh-my-zsh pyenv plugin is loaded. This can be achieved by adding the following earlier in the `.zshrc` file than the `plugins=(...)` line:
```zsh
export PYENV_ROOT="$HOME/.pyenv"
diff --git a/plugins/python/README.md b/plugins/python/README.md
index 7bf1b34ac..c99697b22 100644
--- a/plugins/python/README.md
+++ b/plugins/python/README.md
@@ -22,8 +22,18 @@ plugins=(... python)
## Virtual environments
-The plugin provides two utilities to manage Python venvs:
+The plugin provides three utilities to manage Python 3.3+ [venv](https://docs.python.org/3/library/venv.html)
+virtual environments:
-- `mkv [name]`: make a new virtual environment called `name` (default: `venv`) in current directory.
+- `mkv [name]`: make a new virtual environment called `name` (default: if set `$PYTHON_VENV_NAME`, else
+ `venv`) in the current directory.
-- `vrun [name]`: activate virtual environment called `name` (default: `venv`) in current directory.
+- `vrun [name]`: Activate the virtual environment called `name` (default: if set `$PYTHON_VENV_NAME`, else
+ `venv`) in the current directory.
+
+- `auto_vrun`: Automatically activate the venv virtual environment when entering a directory containing
+ `/bin/activate`, and automatically deactivate it when navigating out of it (including
+ subdirectories!).
+ - To enable the feature, set `export PYTHON_AUTO_VRUN=true` before sourcing oh-my-zsh.
+ - The default virtual environment name is `venv`. To use a different name, set
+ `export PYTHON_VENV_NAME=`. For example: `export PYTHON_VENV_NAME=".venv"`
diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh
index 77d4bf425..f6ea85027 100644
--- a/plugins/python/python.plugin.zsh
+++ b/plugins/python/python.plugin.zsh
@@ -51,11 +51,12 @@ alias pyserver="python3 -m http.server"
## venv utilities
+: ${PYTHON_VENV_NAME:=venv}
# Activate a the python virtual environment specified.
-# If none specified, use 'venv'.
+# If none specified, use $PYTHON_VENV_NAME, else 'venv'.
function vrun() {
- local name="${1:-venv}"
+ local name="${1:-$PYTHON_VENV_NAME}"
local venvpath="${name:P}"
if [[ ! -d "$venvpath" ]]; then
@@ -72,12 +73,26 @@ function vrun() {
echo "Activated virtual environment ${name}"
}
-# Create a new virtual environment, with default name 'venv'.
+# Create a new virtual environment using the specified name.
+# If none specfied, use $PYTHON_VENV_NAME
function mkv() {
- local name="${1:-venv}"
+ local name="${1:-$PYTHON_VENV_NAME}"
local venvpath="${name:P}"
python3 -m venv "${name}" || return
echo >&2 "Created venv in '${venvpath}'"
vrun "${name}"
}
+
+if [[ "$PYTHON_AUTO_VRUN" == "true" ]]; then
+ # Automatically activate venv when changing dir
+ auto_vrun() {
+ if [[ -f "${PYTHON_VENV_NAME}/bin/activate" ]]; then
+ source "${PYTHON_VENV_NAME}/bin/activate" > /dev/null 2>&1
+ else
+ (( $+functions[deactivate] )) && deactivate > /dev/null 2>&1
+ fi
+ }
+ add-zsh-hook chpwd auto_vrun
+ auto_vrun
+fi
diff --git a/plugins/ros/_ros b/plugins/ros/_ros
index 6a04d3c8f..c73a7b353 100644
--- a/plugins/ros/_ros
+++ b/plugins/ros/_ros
@@ -18,7 +18,7 @@ _1st_arguments=(
'config:Get and set options'
'version:Show the roswell version information'
"help:Use \"ros help [command]\" for more information about a command."$'\n\t\t'"Use \"ros help [topic]\" for more information about the topic."
-)
+)
#local expl
diff --git a/plugins/sbt/sbt.plugin.zsh b/plugins/sbt/sbt.plugin.zsh
index 851302c68..1e977140b 100644
--- a/plugins/sbt/sbt.plugin.zsh
+++ b/plugins/sbt/sbt.plugin.zsh
@@ -4,7 +4,7 @@
# AUTHOR: Mirko Caserta (mirko.caserta@gmail.com)
# VERSION: 1.0.2
# ------------------------------------------------------------------------------
-
+
# aliases - mnemonic: prefix is 'sb'
alias sbc='sbt compile'
alias sbcc='sbt clean compile'
diff --git a/plugins/screen/screen.plugin.zsh b/plugins/screen/screen.plugin.zsh
index c1db8ad92..26531c40b 100644
--- a/plugins/screen/screen.plugin.zsh
+++ b/plugins/screen/screen.plugin.zsh
@@ -8,7 +8,7 @@ if [[ "$TERM" == screen* ]]; then
_GET_HOST='echo $HOST | sed "s/\..*//"'
fi
- # use the current user as the prefix of the current tab title
+ # use the current user as the prefix of the current tab title
TAB_TITLE_PREFIX='"`'$_GET_HOST'`:`'$_GET_PATH' | sed "s:..*/::"`$PROMPT_CHAR"'
# when at the shell prompt, show a truncated version of the current path (with
# standard ~ replacement) as the rest of the title.
diff --git a/plugins/shell-proxy/ssh-proxy.py b/plugins/shell-proxy/ssh-proxy.py
index a498c84bc..4b692f9e4 100755
--- a/plugins/shell-proxy/ssh-proxy.py
+++ b/plugins/shell-proxy/ssh-proxy.py
@@ -22,7 +22,8 @@ if parsed.scheme not in proxy_protocols:
def make_argv():
yield "nc"
- if sys.platform == 'linux':
+ if sys.platform in {'linux', 'cygwin'}:
+ # caveats: the built-in netcat of most linux distributions and cygwin support proxy type
# caveats: macOS built-in netcat command not supported proxy-type
yield "-X" # --proxy-type
# Supported protocols are 4 (SOCKS v4), 5 (SOCKS v5) and connect (HTTP proxy).
diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh
index d4b0b6735..6d785d9e1 100644
--- a/plugins/singlechar/singlechar.plugin.zsh
+++ b/plugins/singlechar/singlechar.plugin.zsh
@@ -1,5 +1,5 @@
###########################
-# Settings
+# Settings
# These can be overwritten any time.
# If they are not set yet, they will be
diff --git a/plugins/ssh-agent/README.md b/plugins/ssh-agent/README.md
index 8c118e65b..0afa80cc8 100644
--- a/plugins/ssh-agent/README.md
+++ b/plugins/ssh-agent/README.md
@@ -90,7 +90,7 @@ use the `ssh-add-args` setting. You can pass multiple arguments separated by spa
zstyle :omz:plugins:ssh-agent ssh-add-args -K -c -a /run/user/1000/ssh-auth
```
-These will then be passed the the `ssh-add` call as if written directly. The example
+These will then be passed the `ssh-add` call as if written directly. The example
above will turn into:
```zsh
diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh
index 49ad95a11..1da54d4dd 100644
--- a/plugins/ssh-agent/ssh-agent.plugin.zsh
+++ b/plugins/ssh-agent/ssh-agent.plugin.zsh
@@ -62,7 +62,7 @@ function _add_identities() {
# if id is an absolute path, make file equal to id
[[ "$id" = /* ]] && file="$id" || file="$HOME/.ssh/$id"
# check for filename match, otherwise try for signature match
- if [[ ${loaded_ids[(I)$file]} -le 0 ]]; then
+ if [[ -f $file && ${loaded_ids[(I)$file]} -le 0 ]]; then
sig="$(ssh-keygen -lf "$file" | awk '{print $2}')"
[[ ${loaded_sigs[(I)$sig]} -le 0 ]] && not_loaded+=("$file")
fi
@@ -98,8 +98,10 @@ function _add_identities() {
# Add a nifty symlink for screen/tmux if agent forwarding is enabled
if zstyle -t :omz:plugins:ssh-agent agent-forwarding \
- && [[ -n "$SSH_AUTH_SOCK" && ! -L "$SSH_AUTH_SOCK" ]]; then
- ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen
+ && [[ -n "$SSH_AUTH_SOCK" ]]; then
+ if [[ ! -L "$SSH_AUTH_SOCK" ]]; then
+ ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen
+ fi
else
_start_agent
fi
diff --git a/plugins/ssh/ssh.plugin.zsh b/plugins/ssh/ssh.plugin.zsh
index 085e71fa1..b5b050536 100644
--- a/plugins/ssh/ssh.plugin.zsh
+++ b/plugins/ssh/ssh.plugin.zsh
@@ -4,9 +4,16 @@
# Filter out wildcard host sections.
_ssh_configfile="$HOME/.ssh/config"
if [[ -f "$_ssh_configfile" ]]; then
- _hosts=($(egrep '^Host.*' "$_ssh_configfile" | awk '{print $2}' | grep -v '^*' | sed -e 's/\.*\*$//'))
- zstyle ':completion:*:hosts' hosts $_hosts
- unset _hosts
+ _ssh_hosts=($(
+ egrep '^Host.*' "$_ssh_configfile" |\
+ awk '{for (i=2; i<=NF; i++) print $i}' |\
+ sort |\
+ uniq |\
+ grep -v '^*' |\
+ sed -e 's/\.*\*$//'
+ ))
+ zstyle ':completion:*:hosts' hosts $_ssh_hosts
+ unset _ssh_hosts
fi
unset _ssh_configfile
diff --git a/plugins/starship/starship.plugin.zsh b/plugins/starship/starship.plugin.zsh
index 8c5d9135e..fc415e64c 100644
--- a/plugins/starship/starship.plugin.zsh
+++ b/plugins/starship/starship.plugin.zsh
@@ -1,7 +1,7 @@
-# ignore oh-my-zsh theme
-unset ZSH_THEME
-
if (( $+commands[starship] )); then
+ # ignore oh-my-zsh theme
+ unset ZSH_THEME
+
eval "$(starship init zsh)"
else
echo '[oh-my-zsh] starship not found, please install it from https://starship.rs'
diff --git a/plugins/systemadmin/README.md b/plugins/systemadmin/README.md
index 3a9d9de66..bd6b08760 100644
--- a/plugins/systemadmin/README.md
+++ b/plugins/systemadmin/README.md
@@ -1,7 +1,7 @@
# Systemadmin plugin
This plugin adds a series of aliases and functions which make a System Administrator's life easier.
-
+
To use it, add `systemadmin` to the plugins array in your zshrc file:
```zsh
diff --git a/plugins/terraform/README.md b/plugins/terraform/README.md
index 135fd78ef..2b535517c 100644
--- a/plugins/terraform/README.md
+++ b/plugins/terraform/README.md
@@ -15,19 +15,20 @@ plugins=(... terraform)
## Aliases
-| Alias | Command |
-| ----- | -------------------- |
-| `tf` | `terraform` |
-| `tfa` | `terraform apply` |
-| `tfc` | `terraform console` |
-| `tfd` | `terraform destroy` |
-| `tff` | `terraform fmt` |
-| `tfi` | `terraform init` |
-| `tfo` | `terraform output` |
-| `tfp` | `terraform plan` |
-| `tfv` | `terraform validate` |
-| `tfs` | `terraform state` |
-| `tfsh`| `terraform show` |
+| Alias | Command |
+| ------ | -------------------- |
+| `tf` | `terraform` |
+| `tfa` | `terraform apply` |
+| `tfc` | `terraform console` |
+| `tfd` | `terraform destroy` |
+| `tff` | `terraform fmt` |
+| `tfi` | `terraform init` |
+| `tfo` | `terraform output` |
+| `tfp` | `terraform plan` |
+| `tfv` | `terraform validate` |
+| `tfs` | `terraform state` |
+| `tft` | `terraform test` |
+| `tfsh` | `terraform show` |
## Prompt function
diff --git a/plugins/terraform/_terraform b/plugins/terraform/_terraform
index 625834563..157495814 100644
--- a/plugins/terraform/_terraform
+++ b/plugins/terraform/_terraform
@@ -1,411 +1,545 @@
#compdef terraform
+compdef _terraform terraform
-local -a _terraform_cmds opt_args
-_terraform_cmds=(
- 'apply:Builds or changes infrastructure'
- 'console:Interactive console for Terraform interpolations'
- 'destroy:Destroy Terraform-managed infrastructure'
- 'fmt:Rewrites config files to canonical format'
- 'force-unlock:Manually unlock the terraform state'
- 'get:Download and install modules for the configuration'
- 'graph:Create a visual graph of Terraform resources'
- 'import:Import existing infrastructure into Terraform'
- 'init:Initialize a Terraform working directory'
+(( ${+functions[_terraform_commands]} )) || _terraform_commands() {
+ local -a _terraform_cmds
+ _terraform_cmds=(
+ 'apply:Create or update infrastructure'
+ 'console:Try Terraform expressions at an interactive command prompt'
+ 'destroy:Destroy previously-created infrastructure'
+ 'fmt:Reformat your configuration in the standard style'
+ 'force-unlock:Release a stuck lock on the current workspace'
+ 'get:Install or upgrade remote Terraform modules'
+ 'graph:Generate a Graphviz graph of the steps in an operation'
+ 'import:Associate existing infrastructure with a Terraform resource'
+ 'init:Prepare your working directory for other commands'
'login:Obtain and save credentials for a remote host'
'logout:Remove locally-stored credentials for a remote host'
- 'output:Read an output from a state file'
- 'plan:Generate and show an execution plan'
- 'providers:Prints a tree of the providers used in the configuration'
- 'refresh:Update local state file against real resources'
- 'show:Inspect Terraform state or plan'
+ 'metadata:Metadata related commands'
+ 'output:Show output values from your root module'
+ 'plan:Show changes required by the current configuration'
+ 'providers:Show the providers required for this configuration'
+ 'refresh:Update the state to match remote systems'
+ 'show:Show the current state or a saved plan'
'state:Advanced state management'
- 'taint:Manually mark a resource for recreation'
- 'untaint:Manually unmark a resource as tainted'
- 'validate:Validates the Terraform files'
- 'version:Prints the Terraform version'
+ 'taint:Mark a resource instance as not fully functional'
+ 'test:Execute integration tests for Terraform modules'
+ 'untaint:Remove the '\''tainted'\'' state from a resource instance'
+ 'validate:Check whether the configuration is valid'
+ 'version:Show the current Terraform version'
'workspace:Workspace management'
- '0.12upgrade:Rewrites pre-0.12 module source code for v0.12'
- '0.13upgrade:Rewrites pre-0.13 module source code for v0.13'
-)
+ )
+ if (( CURRENT == 1 )); then
+ _describe -t commands 'terraform commands' _terraform_cmds
+ return
+ fi
-__012upgrade() {
+ local curcontext="${curcontext}"
+ cmd="${${_terraform_cmds[(r)$words[1]:*]%%:*}}"
+ curcontext="${curcontext%:*:*}:terraform-${cmd}:"
+
+ local __chdir="${opt_args[-chdir]:-.}"
+
+ if (( ${+functions[_terraform_$cmd]} )); then
+ "_terraform_${cmd}"
+ else
+ _message "no more options"
+ fi
+}
+
+(( ${+functions[_terraform_apply]} )) || _terraform_apply() {
_arguments \
- '-yes[Skip the initial introduction messages and interactive confirmation. This can be used to run this command in batch from a script.]' \
- '-force[ Override the heuristic that attempts to detect if a configuration is already written for v0.12 or later. Some of the transformations made by this command are not idempotent, so re-running against the same module may change the meanings expressions in the module.]'
+ '-auto-approve[Skip interactive approval of plan before applying.]' \
+ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -W __chdir -g "*.backup"' \
+ '-compact-warnings[If Terraform produces any warnings that are not accompanied by errors, show them in a more compact form that includes only the summary messages.]' \
+ '-destroy[Destroy Terraform-managed infrastructure. The command "terraform destroy" is a convenience alias for this option.]' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-input=[(true) Ask for input for variables if not directly set.]:input:(true false)' \
+ '-no-color[If specified, output won'\''t contain any color.]' \
+ '-parallelism=[(10) Limit the number of parallel resource operations.]:parallelism:' \
+ '-refresh=[(true) Skip checking for external changes to remote objects while creating the plan. This can potentially make planning faster, but at the expense of possibly planning against a stale record of the remote system state.]:refresh:(true false)' \
+ '*-replace=[(resource) Force replacement of a particular resource instance using its resource address. If applying would'\''ve normally produced an update or no-op action for this instance, Terraform will replace it instead. You can use this option multiple times to replace more than one object.]:resource:__terraform_state_resources' \
+ '-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '*-target=[(resource) Limit the operation to only the given module, resource, or resource instance and all of its dependencies. You can use this option multiple times to include more than one object. This is for exceptional use only.]:target:__terraform_state_resources' \
+ '*-var=[(for=bar) Set a value for one of the input variables in the root module of the configuration. Use this option more than once to set more than one variable.]:var:' \
+ '*-var-file=[(foo) Load variable values from the given file, in addition to the default files terraform.tfvars and *.auto.tfvars. Use this option more than once to include more than one variables file.]:file:_files -W __chdir -g "*.tfvars{,.json}"' \
+ ':plan:_files -W __chdir -'
}
-__013upgrade() {
+(( ${+functions[_terraform_console]} )) || _terraform_console() {
_arguments \
- '-yes[Skip the initial introduction messages and interactive confirmation. This can be used to run this command in batch from a script.]'
+ '-state=[(terraform.tfstate) Legacy option for the local backend only. See the local backend'\''s documentation for more information.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-plan[Create a new plan (as if running "terraform plan") and then evaluate expressions against its planned state, instead of evaluating against the current state. You can use this to inspect the effects of configuration changes that haven'\''t been applied yet.]' \
+ '*-var=[(for=bar) Set a variable in the Terraform configuration. This flag can be set multiple times.]:var:' \
+ '*-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]:file:_files -W __chdir -g "*.tfvars{,.json}"'
}
-__apply() {
- _arguments \
- '-auto-approve[Skip interactive approval of plan before applying.]' \
- '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -g "*.backup"' \
- '-compact-warnings[If Terraform produces any warnings that are not accompanied by errors, show them in a more compact form that includes only the summary messages.]' \
- '-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
- '-lock-timeout=[(0s) Duration to retry a state lock.]' \
- '-input=[(true) Ask for input for variables if not directly set.]' \
- '-no-color[If specified, output will be colorless.]' \
- '-parallelism=[(10) Limit the number of parallel resource operations.]' \
- '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
- '-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]:statefile:_files -g "*.tfstate"' \
- '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]:statefile:_files -g "*.tfstate"' \
- '*-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \
- '*-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
- '*-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]:file:_files -g "*.tfvars{,.json}"'
-}
-
-__console() {
- _arguments \
- '-state=[(terraform.tfstate) Path to read state.]' \
- '*-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
- '*-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]:file:_files -g "*.tfvars{,.json}"'
-}
-
-__destroy() {
- _arguments \
- '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -g "*.backup"' \
- '-auto-approve[Skip interactive approval before destroying.]' \
- '-force[Deprecated: same as auto-approve.]' \
- '-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
- '-lock-timeout=[(0s) Duration to retry a state lock.]' \
- '-no-color[If specified, output will contain no color.]' \
- '-parallelism=[(10) Limit the number of concurrent operations.]' \
- '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
- '-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]:statefile:_files -g "*.tfstate"' \
- '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]:statefile:_files -g "*.tfstate"' \
- '*-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \
- '*-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
- '*-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]:file:_files -g "*.tfvars{,.json}"'
-}
-
-__fmt() {
- _arguments \
- '-list=[(true) List files whose formatting differs (always false if using STDIN)]' \
- '-write=[(true) Write result to source file instead of STDOUT (always false if using STDIN or -check)]' \
- '-diff=[(false) Display diffs of formatting changes]' \
- '-check=[(false) Check if the input is formatted. Exit status will be 0 if all input is properly formatted and non-zero otherwise.]' \
- '-recursive=[(false) Also process files in subdirectories. By default, only the given directory (or current directory) is processed.]'
-}
-
-__force_unlock() {
- _arguments \
- "-force[Don't ask for input for unlock confirmation.]"
-}
-
-__get() {
- _arguments \
- '-update=[(false) If true, modules already downloaded will be checked for updates and updated if necessary.]' \
- '-no-color[Disable text coloring in the output.]'
-}
-
-__graph() {
- _arguments \
- '-draw-cycles[Highlight any cycles in the graph with colored edges. This helps when diagnosing cycle errors.]' \
- '-type=[(plan) Type of graph to output. Can be: plan, plan-destroy, apply, validate, input, refresh.]'
-}
-
-__import() {
- _arguments \
- '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -g "*.backup"' \
- '-config=[(path) Path to a directory of Terraform configuration files to use to configure the provider. Defaults to pwd. If no config files are present, they must be provided via the input prompts or env vars.]' \
- '-allow-missing-config[Allow import when no resource configuration block exists.]' \
- '-input=[(true) Ask for input for variables if not directly set.]' \
- '-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
- '-lock-timeout=[(0s) Duration to retry a state lock.]' \
- '-no-color[If specified, output will contain no color.]' \
- '-state=[(PATH) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]:statefile:_files -g "*.tfstate"' \
- '-state-out=[(PATH) Path to the destination state file to write to. If this is not specified, the source state file will be used. This can be a new or existing path.]:statefile:_files -g "*.tfstate"' \
- '*-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times. This is only useful with the "-config" flag.]' \
- '*-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]:file:_files -g "*.tfvars{,.json}"'
-}
-
-__init() {
- _arguments \
- '-backend=[(true) Configure the backend for this configuration.]' \
- '-backend-config=[This can be either a path to an HCL file with key/value assignments (same format as terraform.tfvars) or a 'key=value' format. This is merged with what is in the configuration file. This can be specified multiple times. The backend type must be in the configuration itself.]' \
- '-force-copy[Suppress prompts about copying state data. This is equivalent to providing a "yes" to all confirmation prompts.]' \
- '-from-module=[(SOURCE) Copy the contents of the given module into the target directory before initialization.]' \
- '-get=[(true) Download any modules for this configuration.]' \
- '-get-plugins=[(true) Download any missing plugins for this configuration.]' \
- '-input=[(true) Ask for input if necessary. If false, will error if input was required.]' \
- '-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
- '-lock-timeout=[(0s) Duration to retry a state lock.]' \
- '-no-color[If specified, output will contain no color.]' \
- '-plugin-dir[Directory containing plugin binaries. This overrides all default search paths for plugins, and prevents the automatic installation of plugins. This flag can be used multiple times.]:plugin_dir:_files -/' \
- '-reconfigure[Reconfigure the backend, ignoring any saved configuration.]' \
- '-upgrade=[(false) If installing modules (-get) or plugins (-get-plugins), ignore previously-downloaded objects and install the latest version allowed within configured constraints.]' \
- '-verify-plugins=[(true) Verify the authenticity and integrity of automatically downloaded plugins.]'
-}
-
-__login() {
- _arguments \
-
-}
-
-__logout() {
- _arguments \
-
-}
-
-__output() {
- _arguments \
- '-state=[(path) Path to the state file to read. Defaults to "terraform.tfstate".]:statefile:_files -g "*.tfstate"' \
- '-no-color[If specified, output will contain no color.]' \
- '-json[If specified, machine readable output will be printed in JSON format]'
-}
-
-__plan() {
- _arguments \
- '-compact-warnings[If Terraform produces any warnings that are not accompanied by errors, show them in a more compact form that includes only the summary messages.]' \
- '-destroy[If set, a plan will be generated to destroy all resources managed by the given configuration and state.]' \
- '-detailed-exitcode[() Return detailed exit codes when the command exits. This will change the meaning of exit codes to: 0 - Succeeded, diff is empty (no changes); 1 - Errored, 2 - Succeeded; there is a diff]' \
- '-input=[(true) Ask for input for variables if not directly set.]' \
- '-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
- '-lock-timeout=[(0s) Duration to retry a state lock.]' \
- '-no-color[() If specified, output will contain no color.]' \
- '-out=[(path) Write a plan file to the given path. This can be used as input to the "apply" command.]' \
- '-parallelism=[(10) Limit the number of concurrent operations.]' \
- '-refresh=[(true) Update state prior to checking for differences.]' \
- '-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]:statefile:_files -g "*.tfstate"' \
- '*-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \
- '*-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
- '*-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]:file:_files -g "*.tfvars{,.json}"'
-}
-
-__providers() {
- local -a __providers_cmds
- __providers_cmds=(
- 'mirror:Mirrors the provider plugins needed for the current configuration'
- 'schema:Prints the schemas of the providers used in the configuration'
- )
- _describe -t providers "providers commands" __providers_cmds
-
-}
-
-__providers_mirror() {
- _arguments \
- '-platform=[(os_arch) Choose which target platform to build a mirror for.]' \
- "*:target_dir:_files -/"
-}
-
-__providers_schema() {
- _arguments \
- '-json[]' \
- '::'
-}
-
-__refresh() {
- _arguments \
- '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]::backupfile:_files -g "*.backup"' \
- '-compact-warnings[If Terraform produces any warnings that are not accompanied by errors, show them in a more compact form that includes only the summary messages.]' \
- '-input=[(true) Ask for input for variables if not directly set.]' \
- '-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
- '-lock-timeout=[(0s) Duration to retry a state lock.]' \
- '-no-color[If specified, output will not contain any color.]' \
- '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]:statefile:_files -g "*.tfstate"' \
- '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]:statefile:_files -g "*.tfstate"' \
- '*-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \
- '*-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
- '*-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]:file:_files -g "*.tfvars{,.json}"'
-}
-
-__show() {
- _arguments \
- '-json[If specified, output the Terraform plan or state in a machine-readable form.]' \
- '-no-color[If specified, output will not contain any color.]'
-}
-
-__state() {
- local -a __state_cmds
- __state_cmds=(
- 'list:List resources in the state'
- 'mv:Move an item in the state'
- 'pull:Pull current state and output to stdout'
- 'push:Update remote state from a local state file'
- 'replace-provider:Replace provider for resources in the Terraform state'
- 'rm:Remove instances from the state'
- 'show:Show a resource in the state'
- )
- _describe -t state "state commands" __state_cmds
-}
-
-__state_list() {
+(( ${+functions[_terraform_destroy]} )) || _terraform_destroy() {
_arguments \
- '-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default, Terraform will consult the state of the currently-selected workspace.]' \
- '-id=[(id) Filters the results to include only instances whose resource types have an attribute named id whose value equals the given id string.]' \
- "*:address:__statelist"
+ '-auto-approve[Skip interactive approval of plan before applying.]' \
+ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -W __chdir -g "*.backup"' \
+ '-compact-warnings[If Terraform produces any warnings that are not accompanied by errors, show them in a more compact form that includes only the summary messages.]' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-input=[(true) Ask for input for variables if not directly set.]:input:(true false)' \
+ '-no-color[If specified, output won'\''t contain any color.]' \
+ '-parallelism=[(10) Limit the number of parallel resource operations.]:parallelism:' \
+ '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]:refresh:(true false)' \
+ '-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '*-target=[(resource) Limit the operation to only the given module, resource, or resource instance and all of its dependencies. You can use this option multiple times to include more than one object. This is for exceptional use only.]:target:__terraform_state_resources' \
+ '*-var=[(for=bar) Set a value for one of the input variables in the root module of the configuration. Use this option more than once to set more than one variable.]:var:' \
+ '*-var-file=[(foo) Load variable values from the given file, in addition to the default files terraform.tfvars and *.auto.tfvars. Use this option more than once to include more than one variables file.]:file:_files -W __chdir -g "*.tfvars{,.json}"'
}
-__state_mv() {
+(( ${+functions[_terraform_fmt]} )) || _terraform_fmt() {
_arguments \
- "-dry-run[If set, prints out what would've been moved but doesn't actually move anything.]" \
- '-backup=[(PATH) Path where Terraform should write the backup for the original state. This can"t be disabled. If not set, Terraform will write it to the same path as the statefile with a ".backup" extension.]:backupfile:_files -g "*.backup"' \
- '-backup-out=[(PATH) Path where Terraform should write the backup for the destination state. This can"t be disabled. If not set, Terraform will write it to the same path as the destination state file with a backup extension. This only needs to be specified if -state-out is set to a different path than -state.]:backupfile:_files -g "*.backup"' \
- "-lock=[(true) Lock the state files when locking is supported.]:lock:(true false)" \
- "-lock-timeout=[(0s) Duration to retry a state lock.]" \
- '-state=[(path) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]:statefile:_files -g "*.tfstate"' \
- '-state-out=[(path) Path to the destination state file to write to. If this isn"t specified, the source state file will be used. This can be a new or existing path.]:statefile:_files -g "*.tfstate"' \
- "::" \
- ":source:__statelist" \
- ":destination: "
+ '-list=[(true) Don'\''t list files whose formatting differs (always disabled if using STDIN)]:list:(true false)' \
+ '-write=[(true) Don'\''t write to source files (always disabled if using STDIN or -check)]:write:(true false)' \
+ '-diff[Display diffs of formatting changes]' \
+ '-check[Check if the input is formatted. Exit status will be 0 if all input is properly formatted and non-zero otherwise.]' \
+ '-no-color[If specified, output won'\''t contain any color.]' \
+ '-recursive[Also process files in subdirectories. By default, only the given directory (or current directory) is processed.]' \
+ '*:targets:_files -W __chdir -'
}
-__state_push() {
+(( ${+functions[_terraform_force-unlock]} )) || _terraform_force-unlock() {
_arguments \
- "-force[Write the state even if lineages don't match or the remote serial is higher.]" \
- '-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
- "-lock-timeout=[(0s) Duration to retry a state lock.]" \
- "::" \
- ":destination:_files"
+ '-force[Don'\''t ask for input for unlock confirmation.]' \
+ ':lock_id:'
}
-__state_replace_provider() {
+(( ${+functions[_terraform_get]} )) || _terraform_get() {
+ _arguments \
+ '-update[Check already-downloaded modules for available updates and install the newest versions available.]' \
+ '-no-color[Disable text coloring in the output.]' \
+ '-test-directory=[(tests) Set the Terraform test directory, defaults to "tests".]:test_directory:_files -W __chdir -/'
+}
+
+(( ${+functions[_terraform_graph]} )) || _terraform_graph() {
+ _arguments \
+ '-draw-cycles[Highlight any cycles in the graph with colored edges. This helps when diagnosing cycle errors. This option is supported only when illustrating a real evaluation graph, selected using the -type=TYPE option.]' \
+ '-module-depth=[(-1) (deprecated) In prior versions of Terraform, specified the depth of modules to show in the output.]:module_depth:' \
+ '-plan=[Render graph using the specified plan file instead of the configuration in the current directory. Implies -type=apply.]:plan:_files -W __chdir -' \
+ '-type=[(plan) Type of operation graph to output. Can be: plan, plan-refresh-only, plan-destroy, or apply. By default Terraform just summarizes the relationships between the resources in your configuration, without any particular operation in mind. Full operation graphs are more detailed but therefore often harder to read.]:type:(plan plan-refresh-only plan-destroy apply)'
+}
+
+(( ${+functions[_terraform_import]} )) || _terraform_import() {
+ _arguments \
+ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -W __chdir -g "*.backup"' \
+ '-config=[(path) Path to a directory of Terraform configuration files to use to configure the provider. Defaults to pwd. If no config files are present, they must be provided via the input prompts or env vars.]:config:_files -W __chdir -/' \
+ '-input=[(true) Disable interactive input prompts.]:input:(true false)' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-no-color[If specified, output will contain no color.]' \
+ '-state=[(PATH) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-state-out=[(PATH) Path to the destination state file to write to. If this is not specified, the source state file will be used. This can be a new or existing path.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '*-var=[(for=bar) Set a variable in the Terraform configuration. This flag can be set multiple times. This is only useful with the "-config" flag.]:var:' \
+ '*-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]:file:_files -W __chdir -g "*.tfvars{,.json}"' \
+ ':addr:' \
+ ':id:'
+}
+
+(( ${+functions[_terraform_init]} )) || _terraform_init() {
+ _arguments \
+ '-backend=[(true) Disable backend or Terraform Cloud initialization for this configuration and use what was previously initialized instead.]:backend:(true false)' \
+ '-backend-config=[Configuration to be merged with what is in the configuration file'\''s '\''backend'\'' block. This can be either a path to an HCL file with key/value assignments (same format as terraform.tfvars) or a '\''key=value'\'' format, and can be specified multiple times. The backend type must be in the configuration itself.]:backend_config:_files -W __chdir -' \
+ '-force-copy[Suppress prompts about copying state data. This is equivalent to providing a "yes" to all confirmation prompts.]' \
+ '-from-module=[Copy the contents of the given module into the target directory before initialization.]:from_module:_files -W __chdir -/' \
+ '-get=[(true) Disable downloading modules for this configuration.]:get:(true false)' \
+ '-input=[(true) Disable interactive prompts. Note that some actions may require interactive prompts and will error if input is disabled.]:input:(true false)' \
+ '-lock=[(true) Don'\''t hold a state lock during backend migration. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-no-color[If specified, output will contain no color.]' \
+ '-plugin-dir[Directory containing plugin binaries. This overrides all default search paths for plugins, and prevents the automatic installation of plugins. This flag can be used multiple times.]:plugin_dir:_files -W __chdir -/' \
+ '-reconfigure[Reconfigure the backend, ignoring any saved configuration.]' \
+ '-migrate-state[Reconfigure a backend, and attempt to migrate any existing state.]' \
+ '-upgrade[Install the latest module and provider versions allowed within configured constraints, overriding the default behavior of selecting exactly the version recorded in the dependency lockfile.]' \
+ '-lockfile=[Set a dependency lockfile mode. Currently only "readonly" is valid.]:lockfile:( readonly )' \
+ '-ignore-remote-version[A rare option used for Terraform Cloud and the remote backend only. Set this to ignore checking that the local and remote Terraform versions use compatible state representations, making an operation proceed even when there is a potential mismatch. See the documentation on configuring Terraform with Terraform Cloud for more information.]' \
+ '-test-directory=[(tests) Set the Terraform test directory, defaults to "tests".]:test_directory:_files -W __chdir -/'
+}
+
+(( ${+functions[_terraform_login]} )) || _terraform_login() {
+ _arguments \
+ ':hostname:'
+}
+
+(( ${+functions[_terraform_logout]} )) || _terraform_logout() {
+ _arguments \
+ ':hostname:'
+}
+
+(( ${+functions[_terraform_metadata]} )) || _terraform_metadata() {
+ _arguments \
+ '*::terraform metadata command:_terraform_metadata_commands'
+}
+
+(( ${+functions[_terraform_metadata_commands]} )) || _terraform_metadata_commands() {
+ local -a _metadata_cmds
+ _metadata_cmds=(
+ 'functions:Show signatures and descriptions for the available functions'
+ )
+ if (( CURRENT == 1 )); then
+ _describe -t commands "terraform metadata commands" _metadata_cmds
+ return
+ fi
+
+ local curcontext="${curcontext}"
+ cmd="${${_metadata_cmds[(r)$words[1]:*]%%:*}}"
+ curcontext="${curcontext%:*:*}:terraform-metadata-${cmd}:"
+
+ if (( ${+functions[_terraform_metadata_$cmd]} )); then
+ "_terraform_metadata_${cmd}"
+ else
+ _message "no more options"
+ fi
+}
+
+(( ${+functions[_terraform_metadata_functions]} )) || _terraform_metadata_functions() {
+ _arguments \
+ '-json[]'
+}
+
+(( ${+functions[_terraform_output]} )) || _terraform_output() {
+ _arguments \
+ '-state=[(path) Path to the state file to read. Defaults to "terraform.tfstate". Ignored when remote state is used.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-no-color[If specified, output will contain no color.]' \
+ '-json[If specified, machine readable output will be printed in JSON format]' \
+ '-raw[For value types that can be automatically converted to a string, will print the raw string directly, rather than a human-oriented representation of the value.]' \
+ ':name:'
+}
+
+(( ${+functions[_terraform_plan]} )) || _terraform_plan() {
+ _arguments \
+ '-compact-warnings[If Terraform produces any warnings that are not accompanied by errors, show them in a more compact form that includes only the summary messages.]' \
+ '-destroy[Select the "destroy" planning mode, which creates a plan to destroy all objects currently managed by this Terraform configuration instead of the usual behavior.]' \
+ '-detailed-exitcode[Return detailed exit codes when the command exits. This will change the meaning of exit codes to: 0 - Succeeded, diff is empty (no changes); 1 - Errored, 2 - Succeeded; there is a diff]' \
+ '-input=[(true) Ask for input for variables if not directly set.]:input:(true false)' \
+ '-generate-config-out=[(path) (Experimental) If import blocks are present in configuration, instructs Terraform to generate HCL for any imported resources not already present. The configuration is written to a new file at PATH, which must not already exist. Terraform may still attempt to write configuration if the plan errors.]:generate_config_out:' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-no-color[If specified, output will contain no color.]' \
+ '-out=[(path) Write a plan file to the given path. This can be used as input to the "apply" command.]:out:' \
+ '-parallelism=[(10) Limit the number of concurrent operations.]:parallelism:' \
+ '-refresh=[(true) Skip checking for external changes to remote objects while creating the plan. This can potentially make planning faster, but at the expense of possibly planning against a stale record of the remote system state.]:refresh:(true false)' \
+ '-refresh-only[Select the "refresh only" planning mode, which checks whether remote objects still match the outcome of the most recent Terraform apply but does not propose any actions to undo any changes made outside of Terraform.]' \
+ '*-replace=[(resource) Force replacement of a particular resource instance using its resource address. If the plan would'\''ve normally produced an update or no-op action for this instance, Terraform will plan to replace it instead. You can use this option multiple times to replace more than one object.]:replace:__terraform_state_resources' \
+ '-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '*-target=[(resource) Limit the planning operation to only the given module, resource, or resource instance and all of its dependencies. You can use this option multiple times to include more than one object. This is for exceptional use only.]:target:__terraform_state_resources' \
+ '*-var=[(for=bar) Set a value for one of the input variables in the root module of the configuration. Use this option more than once to set more than one variable.]:var:' \
+ '*-var-file=[(foo) Load variable values from the given file, in addition to the default files terraform.tfvars and *.auto.tfvars. Use this option more than once to include more than one variables file.]:file:_files -W __chdir -g "*.tfvars{,.json}"'
+}
+
+(( ${+functions[_terraform_providers]} )) || _terraform_providers() {
+ _arguments \
+ '-test-directory=[(path) Set the Terraform test directory, defaults to "tests".]:test_directory:_files -W __chdir -/' \
+ '*::terraform providers command:_terraform_providers_commands'
+}
+
+(( ${+functions[_terraform_providers_commands]} )) || _terraform_providers_commands() {
+ local -a _providers_cmds
+ _providers_cmds=(
+ 'lock:Write out dependency locks for the configured providers'
+ 'mirror:Save local copies of all required provider plugins'
+ 'schema:Show schemas for the providers used in the configuration'
+ )
+ if (( CURRENT == 1 )); then
+ _describe -t commands "terraform providers commands" _providers_cmds
+ return
+ fi
+
+ local curcontext="${curcontext}"
+ cmd="${${_providers_cmds[(r)$words[1]:*]%%:*}}"
+ curcontext="${curcontext%:*:*}:terraform-providers-${cmd}:"
+
+ if (( ${+functions[_terraform_providers_$cmd]} )); then
+ "_terraform_providers_${cmd}"
+ else
+ _message "no more options"
+ fi
+}
+
+(( ${+functions[_terraform_providers_lock]} )) || _terraform_providers_lock() {
+ _arguments \
+ '-fs-mirror=[(dir) Consult the given filesystem mirror directory instead of the origin registry for each of the given providers.]:fs_mirror:_files -W __chdir -/' \
+ '-net-mirror=[(url) Consult the given network mirror (given as a base URL) instead of the origin registry for each of the given providers.]:net_mirror:' \
+ '*-platform=[(os_arch) Choose a target platform to request package checksums for.]:platform:' \
+ '*:provider:'
+}
+
+(( ${+functions[_terraform_providers_mirror]} )) || _terraform_providers_mirror() {
+ _arguments \
+ '*-platform=[(os_arch) Choose which target platform to build a mirror for.]:platform:' \
+ '::' \
+ ':target_dir:_files -W __chdir -/'
+}
+
+(( ${+functions[_terraform_providers_schema]} )) || _terraform_providers_schema() {
+ _arguments \
+ '-json[]'
+}
+
+(( ${+functions[_terraform_refresh]} )) || _terraform_refresh() {
+ _arguments \
+ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]::backupfile:_files -W __chdir -g "*.backup"' \
+ '-compact-warnings[If Terraform produces any warnings that are not accompanied by errors, show them in a more compact form that includes only the summary messages.]' \
+ '-input=[(true) Ask for input for variables if not directly set.]:input:(true false)' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-no-color[If specified, output will not contain any color.]' \
+ '-parallelism=[(10) Limit the number of parallel resource operations.]:parallelism:' \
+ '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '*-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__terraform_state_resources' \
+ '*-var=[(for=bar) Set a variable in the Terraform configuration. This flag can be set multiple times.]:var:' \
+ '*-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]:file:_files -W __chdir -g "*.tfvars{,.json}"'
+}
+
+(( ${+functions[_terraform_show]} )) || _terraform_show() {
+ _arguments \
+ '-json[If specified, output the Terraform plan or state in a machine-readable form.]' \
+ '-no-color[If specified, output will not contain any color.]' \
+ ':path:_files -W __chdir -g "*.tfstate"'
+}
+
+(( ${+functions[_terraform_state]} )) || _terraform_state() {
+ _arguments \
+ '*::terraform state command:_terraform_state_commands'
+}
+
+(( ${+functions[_terraform_state_commands]} )) || _terraform_state_commands() {
+ local -a _state_cmds
+ _state_cmds=(
+ 'list:List resources in the state'
+ 'mv:Move an item in the state'
+ 'pull:Pull current state and output to stdout'
+ 'push:Update remote state from a local state file'
+ 'replace-provider:Replace provider in the state'
+ 'rm:Remove instances from the state'
+ 'show:Show a resource in the state'
+ )
+ if (( CURRENT == 1 )); then
+ _describe -t commands "terraform state commands" _state_cmds
+ return
+ fi
+
+ local curcontext="${curcontext}"
+ cmd="${${_state_cmds[(r)$words[1]:*]%%:*}}"
+ curcontext="${curcontext%:*:*}:terraform-state-${cmd}:"
+
+ if (( ${+functions[_terraform_state_$cmd]} )); then
+ "_terraform_state_${cmd}"
+ else
+ _message "no more options"
+ fi
+}
+
+(( ${+functions[_terraform_state_list]} )) || _terraform_state_list() {
+ _arguments \
+ '-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default, Terraform will consult the state of the currently-selected workspace.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-id=[(id) Filters the results to include only instances whose resource types have an attribute named id whose value equals the given id string.]:id:' \
+ '*:address:__terraform_state_resources'
+}
+
+(( ${+functions[_terraform_state_mv]} )) || _terraform_state_mv() {
+ _arguments \
+ '-dry-run[If set, prints out what would'\''ve been moved but doesn'\''t actually move anything.]' \
+ '-backup=[(PATH) Path where Terraform should write the backup for the original state. This can"t be disabled. If not set, Terraform will write it to the same path as the statefile with a ".backup" extension.]:backupfile:_files -W __chdir -g "*.backup"' \
+ '-backup-out=[(PATH) Path where Terraform should write the backup for the destination state. This can"t be disabled. If not set, Terraform will write it to the same path as the destination state file with a backup extension. This only needs to be specified if -state-out is set to a different path than -state.]:backupfile:_files -W __chdir -g "*.backup"' \
+ '-ignore-remote-version[A rare option used for the remote backend only. See the remote backend documentation for more information.]' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-state=[(path) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-state-out=[(path) Path to the destination state file to write to. If this isn"t specified, the source state file will be used. This can be a new or existing path.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '::' \
+ ':source:__terraform_state_resources' \
+ ':destination: '
+}
+
+(( ${+functions[_terraform_state_push]} )) || _terraform_state_push() {
+ _arguments \
+ '-force[Write the state even if lineages don'\''t match or the remote serial is higher.]' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '::' \
+ ':destination:_files'
+}
+
+(( ${+functions[_terraform_state_replace-provider]} )) || _terraform_state_replace-provider() {
_arguments \
'-auto-approve[Skip interactive approval.]' \
- '-backup=[(PATH) Path where Terraform should write the backup for the state file. This can"t be disabled. If not set, Terraform will write it to the same path as the state file with a ".backup" extension.]:backupfile:_files -g "*.backup"' \
- "-lock=[(true) Lock the state files when locking is supported.]:lock:(true false)" \
- "-lock-timeout=[(0s) Duration to retry a state lock.]" \
- '-state=[(PATH) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]:statefile:_files -g "*.tfstate"' \
- ":from_provider_fqn:" \
- ":to_provider_fqn:"
+ '-backup=[(PATH) Path where Terraform should write the backup for the state file. This can"t be disabled. If not set, Terraform will write it to the same path as the state file with a ".backup" extension.]:backupfile:_files -W __chdir -g "*.backup"' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-state=[(PATH) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '::' \
+ ':from_provider_fqn:' \
+ ':to_provider_fqn:'
}
-__state_rm() {
+(( ${+functions[_terraform_state_rm]} )) || _terraform_state_rm() {
_arguments \
- "-dry-run[If set, prints out what would've been removed but doesn't actually remove anything.]" \
- '-backup=[(PATH) Path where Terraform should write the backup for the original state.]::backupfile:_files -g "*.backup"' \
- "-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)" \
- "-lock-timeout=[(0s) Duration to retry a state lock.]" \
- '-state=[(PATH) Path to the state file to update. Defaults to the current workspace state.]:statefile:_files -g "*.tfstate"' \
- "*:address:__statelist"
+ '-dry-run[If set, prints out what would'\''ve been removed but doesn'\''t actually remove anything.]' \
+ '-backup=[(PATH) Path where Terraform should write the backup for the original state.]::backupfile:_files -W __chdir -g "*.backup"' \
+ '-ignore-remote-version[Continue even if remote and local Terraform versions are incompatible. This may result in an unusable workspace, and should be used with extreme caution.]' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-state=[(PATH) Path to the state file to update. Defaults to the current workspace state.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '*:address:__terraform_state_resources'
}
-
-__state_show() {
+(( ${+functions[_terraform_state_show]} )) || _terraform_state_show() {
_arguments \
- '-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]:statefile:_files -g "*.tfstate"' \
- "*:address:__statelist"
+ '-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ "*:address:__terraform_state_resources"
}
-__statelist() {
- compadd $(terraform state list $opt_args[-state])
+(( ${+functions[__terraform_state_resources]} )) || __terraform_state_resources() {
+ local resource
+ local -a resources
+ terraform -chdir="${__chdir}" state list -state="${opt_args[-state]}" 2>/dev/null | while read -r resource; do
+ resources+=( "${resource}" )
+ done
+ compadd "${@}" - "${resources[@]}"
}
-__taint() {
- _arguments \
- '-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \
- '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -g "*.backup"' \
- '-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
- '-lock-timeout=[(0s) Duration to retry a state lock.]' \
- '-module=[(path) The module path where the resource lives. By default this will be root. Child modules can be specified by names. Ex. "consul" or "consul.vpc" (nested modules).]' \
- '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]:statefile:_files -g "*.tfstate"' \
- '-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]:statefile:_files -g "*.tfstate"' \
- "*:address:__statelist"
-}
-
-__untaint() {
- _arguments \
+(( ${+functions[_terraform_taint]} )) || _terraform_taint() {
+ _arguments \
'-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \
- '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -g "*.backup"' \
- '-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
- '-lock-timeout=[(0s) Duration to retry a state lock.]' \
- '-module=[(path) The module path where the resource lives. By default this will be root. Child modules can be specified by names. Ex. "consul" or "consul.vpc" (nested modules).]' \
- '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]:statefile:_files -g "*.tfstate"' \
- '-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]:statefile:_files -g "*.tfstate"'
+ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -W __chdir -g "*.backup"' \
+ '-ignore-remote-version[A rare option used for the remote backend only. See the remote backend documentation for more information.]' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '*:address:__terraform_state_resources'
}
-__validate() {
- _arguments \
- '-no-color[If specified, output will not contain any color.]' \
+(( ${+functions[_terraform_test]} )) || _terraform_test() {
+ _arguments \
+ '-cloud-run=[(source) If specified, Terraform will execute this test run remotely using Terraform Cloud. You must specify the source of a module registered in a private module registry as the argument to this flag. This allows Terraform to associate the cloud run with the correct Terraform Cloud module and organization.]:cloud_run:' \
+ '*-filter=[(testfile) If specified, Terraform will only execute the test files specified by this flag. You can use this option multiple times to execute more than one test file.]:testfile:_files -W __chdir -g "*.tftest.hcl"' \
+ '-json[If specified, machine readable output will be printed in JSON format]' \
+ '-no-color[If specified, machine readable output will be printed in JSON format]' \
+ '-test-directory=[(path) Set the Terraform test directory, defaults to "tests".]:test_directory:_files -W __chdir -/' \
+ '*-var=[(for=bar) Set a value for one of the input variables in the root module of the configuration. Use this option more than once to set more than one variable.]:var:' \
+ '*-var-file=[(foo) Load variable values from the given file, in addition to the default files terraform.tfvars and *.auto.tfvars. Use this option more than once to include more than one variables file.]:file:_files -W __chdir -g "*.tfvars{,.json}"' \
+ '-verbose[Print the plan or state for each test run block as it executes.]' \
+}
+
+(( ${+functions[_terraform_untaint]} )) || _terraform_untaint() {
+ _arguments \
+ '-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \
+ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -W __chdir -g "*.backup"' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ ':name:__terraform_state_resources'
+}
+
+(( ${+functions[_terraform_validate]} )) || _terraform_validate() {
+ _arguments \
'-json[Produce output in a machine-readable JSON format, suitable for use in text editor integrations and other automated systems.]' \
- ':dir:_files -/'
+ '-no-color[If specified, output will not contain any color.]' \
+ '-no-tests[If specified, Terraform will not validate test files.]' \
+ '-test-directory=[(path) Set the Terraform test directory, defaults to "tests".]:test_directory:_files -W __chdir -/' \
+ ':dir:_files -W __chdir -/'
}
-__version() {
- _arguments \
- '-json[Output the version information as a JSON object.]'
+(( ${+functions[_terraform_version]} )) || _terraform_version() {
+ _arguments \
+ '-json[Output the version information as a JSON object.]' \
+ '::'
}
-__workspace() {
- local -a __workspace_cmds
- __workspace_cmds=(
- 'delete:Delete a workspace'
- 'list:List Workspaces'
- 'new:Create a new workspace'
- 'select:Select a workspace'
- 'show:Show the name of the current workspace'
- )
- _describe -t workspace "workspace commands" __workspace_cmds
+(( ${+functions[_terraform_workspace]} )) || _terraform_workspace() {
+ _arguments \
+ '*::terraform workspace command:_terraform_workspace_commands'
}
-_arguments '*:: :->command'
+(( ${+functions[_terraform_workspace_commands]} )) || _terraform_workspace_commands() {
+ local -a _workspace_cmds
+ _workspace_cmds=(
+ 'delete:Delete a workspace'
+ 'list:List Workspaces'
+ 'new:Create a new workspace'
+ 'select:Select a workspace'
+ 'show:Show the name of the current workspace'
+ )
+ if (( CURRENT == 1 )); then
+ _describe -t commands "terraform workspace commands" _workspace_cmds
+ return
+ fi
-if (( CURRENT == 1 )); then
- _describe -t commands "terraform command" _terraform_cmds
- return
+ local curcontext="${curcontext}"
+ cmd="${${_workspace_cmds[(r)$words[1]:*]%%:*}}"
+ curcontext="${curcontext%:*:*}:terraform-workspace-${cmd}:"
+
+ if (( ${+functions[_terraform_workspace_$cmd]} )); then
+ "_terraform_workspace_${cmd}"
+ else
+ _message "no more options"
+ fi
+}
+
+(( ${+functions[_terraform_workspace_delete]} )) || _terraform_workspace_delete() {
+ _arguments \
+ '-force[Remove a workspace even if it is managing resources. Terraform can no longer track or manage the workspace'\''s infrastructure.]' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '::' \
+ ':name:__terraform_workspaces'
+}
+
+(( ${+functions[_terraform_workspace_list]} )) || _terraform_workspace_list() {
+ _arguments
+}
+
+(( ${+functions[_terraform_workspace_new]} )) || _terraform_workspace_new() {
+ _arguments \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-state=[(path) Copy an existing state file into the new workspace.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '::' \
+ ':name:'
+}
+
+(( ${+functions[_terraform_workspace_select]} )) || _terraform_workspace_select() {
+ _arguments \
+ '-or-create=[(false) Create the Terraform workspace if it doesn'\''t exist.]:or_create:(true false)' \
+ '::' \
+ ':name:__terraform_workspaces'
+}
+
+(( ${+functions[_terraform_workspace_show]} )) || _terraform_workspace_show() {
+ _arguments
+}
+
+(( ${+functions[__terraform_workspaces]} )) || __terraform_workspaces() {
+ local workspace
+ local -a workspaces
+ terraform -chdir="${__chdir}" workspace list | while read -r workspace; do
+ if [[ -z "${workspace}" ]]; then
+ continue
+ fi
+ workspaces+=( "${workspace#[ *] }" )
+ done
+ compadd "${@}" - "${workspaces[@]}"
+}
+
+_terraform() {
+ _arguments \
+ '-chdir=[(DIR) Switch to a different working directory before executing the given subcommand.]:chdir:_files -W __chdir -/' \
+ '-help[Show this help output, or the help for a specified subcommand.]' \
+ '-version[An alias for the "version" subcommand.]' \
+ '*::terraform command:_terraform_commands'
+}
+
+# don't run the completion function when being source-ed or eval-ed
+if [ "${funcstack[1]}" = '_terraform' ]; then
+ _terraform
fi
-
-local -a _command_args
-case "$words[1]" in
- 0.12upgrade)
- __012upgrade ;;
- 0.13upgrade)
- __013upgrade ;;
- apply)
- __apply ;;
- console)
- __console;;
- destroy)
- __destroy ;;
- fmt)
- __fmt;;
- force-unlock)
- __force_unlock;;
- get)
- __get ;;
- graph)
- __graph ;;
- import)
- __import;;
- init)
- __init ;;
- login)
- __login ;;
- logout)
- __logout ;;
- output)
- __output ;;
- plan)
- __plan ;;
- providers)
- test $CURRENT -lt 3 && __providers
- [[ $words[2] = "mirror" ]] && __providers_mirror
- [[ $words[2] = "schema" ]] && __providers_schema
- ;;
- refresh)
- __refresh ;;
- show)
- __show ;;
- state)
- test $CURRENT -lt 3 && __state
- [[ $words[2] = "list" ]] && __state_list
- [[ $words[2] = "mv" ]] && __state_mv
- [[ $words[2] = "push" ]] && __state_push
- [[ $words[2] = "replace-provider" ]] && __state_replace_provider
- [[ $words[2] = "rm" ]] && __state_rm
- [[ $words[2] = "show" ]] && __state_show
- ;;
- taint)
- __taint ;;
- untaint)
- __untaint ;;
- validate)
- __validate ;;
- version)
- __version ;;
- workspace)
- test $CURRENT -lt 3 && __workspace ;;
-esac
diff --git a/plugins/terraform/terraform.plugin.zsh b/plugins/terraform/terraform.plugin.zsh
index f66a8eac9..8ef392efd 100644
--- a/plugins/terraform/terraform.plugin.zsh
+++ b/plugins/terraform/terraform.plugin.zsh
@@ -25,4 +25,5 @@ alias tfo='terraform output'
alias tfp='terraform plan'
alias tfv='terraform validate'
alias tfs='terraform state'
+alias tft='terraform test'
alias tfsh='terraform show'
diff --git a/plugins/thor/README.md b/plugins/thor/README.md
index 09c705d9a..484c88b84 100644
--- a/plugins/thor/README.md
+++ b/plugins/thor/README.md
@@ -1,6 +1,6 @@
# Thor plugin
-This plugin adds completion for [Thor](http://whatisthor.com/),
+This plugin adds completion for [Thor](http://whatisthor.com/),
a ruby toolkit for building powerful command-line interfaces.
To use it, add `thor` to the plugins array in your zshrc file:
diff --git a/plugins/tmux/README.md b/plugins/tmux/README.md
index b4516ef26..09952a9f5 100644
--- a/plugins/tmux/README.md
+++ b/plugins/tmux/README.md
@@ -1,7 +1,7 @@
# tmux
-This plugin provides aliases for [tmux](https://tmux.github.io/), the terminal multiplexer.
-To use it add `tmux` to the plugins array in your zshrc file.
+This plugin provides aliases for [tmux](https://tmux.github.io/), the terminal multiplexer. To use it add
+`tmux` to the plugins array in your zshrc file.
```zsh
plugins=(... tmux)
@@ -19,26 +19,28 @@ The plugin also supports the following:
| ---------- | -------------------------- | -------------------------------------------------------- |
| `ta` | tmux attach -t | Attach new tmux session to already running named session |
| `tad` | tmux attach -d -t | Detach named tmux session |
-| `ts` | tmux new-session -s | Create a new named tmux session |
-| `tl` | tmux list-sessions | Displays a list of running tmux sessions |
-| `tksv` | tmux kill-server | Terminate all running tmux sessions |
+| `tds` | `_tmux_directory_session` | Creates or attaches to a session for the current path |
| `tkss` | tmux kill-session -t | Terminate named running tmux session |
+| `tksv` | tmux kill-server | Terminate all running tmux sessions |
+| `tl` | tmux list-sessions | Displays a list of running tmux sessions |
| `tmux` | `_zsh_tmux_plugin_run` | Start a new tmux session |
| `tmuxconf` | `$EDITOR $ZSH_TMUX_CONFIG` | Open .tmux.conf file with an editor |
-| `tds` | `_tmux_directory_session` | Creates or attaches to a session for the current path |
+| `ts` | tmux new-session -s | Create a new named tmux session |
## Configuration Variables
-| Variable | Description |
-| ----------------------------------- | ------------------------------------------------------------------------------------------- |
-| `ZSH_TMUX_AUTOSTART` | Automatically starts tmux (default: `false`) |
-| `ZSH_TMUX_AUTOSTART_ONCE` | Autostart only if tmux hasn't been started previously (default: `true`) |
-| `ZSH_TMUX_AUTOCONNECT` | Automatically connect to a previous session if it exits (default: `true`) |
-| `ZSH_TMUX_AUTOQUIT` | Automatically closes terminal once tmux exits (default: `ZSH_TMUX_AUTOSTART`) |
-| `ZSH_TMUX_FIXTERM` | Sets `$TERM` to 256-color term or not based on current terminal support |
-| `ZSH_TMUX_ITERM2` | Sets the `-CC` option for iTerm2 tmux integration (default: `false`) |
-| `ZSH_TMUX_FIXTERM_WITHOUT_256COLOR` | `$TERM` to use for non 256-color terminals (default: `screen`) |
-| `ZSH_TMUX_FIXTERM_WITH_256COLOR` | `$TERM` to use for 256-color terminals (default: `screen-256color` |
-| `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`, `$XDG_CONFIG_HOME/tmux/tmux.conf`) |
-| `ZSH_TMUX_UNICODE` | Set `tmux -u` option to support unicode |
-| `ZSH_TMUX_DEFAULT_SESSION_NAME` | Set tmux default session name when autostart is enabled |
+| Variable | Description |
+| ----------------------------------- | ----------------------------------------------------------------------------------------------------------- |
+| `ZSH_TMUX_AUTOSTART` | Automatically starts tmux (default: `false`) |
+| `ZSH_TMUX_AUTOSTART_ONCE` | Autostart only if tmux hasn't been started previously (default: `true`) |
+| `ZSH_TMUX_AUTOCONNECT` | Automatically connect to a previous session if it exits (default: `true`) |
+| `ZSH_TMUX_AUTOQUIT` | Automatically closes terminal once tmux exits (default: `ZSH_TMUX_AUTOSTART`) |
+| `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`, `$XDG_CONFIG_HOME/tmux/tmux.conf`) |
+| `ZSH_TMUX_DEFAULT_SESSION_NAME` | Set tmux default session name when autostart is enabled |
+| `ZSH_TMUX_AUTONAME_SESSION` | Automatically name new sessions based on the basename of `$PWD` (default: `false`) |
+| `ZSH_TMUX_DETACHED` | Set the detached mode (default: `false`) |
+| `ZSH_TMUX_FIXTERM` | Sets `$TERM` to 256-color term or not based on current terminal support |
+| `ZSH_TMUX_FIXTERM_WITHOUT_256COLOR` | `$TERM` to use for non 256-color terminals (default: `tmux` if available, `screen` otherwise) |
+| `ZSH_TMUX_FIXTERM_WITH_256COLOR` | `$TERM` to use for 256-color terminals (default: `tmux-256color` if available, `screen-256color` otherwise) |
+| `ZSH_TMUX_ITERM2` | Sets the `-CC` option for iTerm2 tmux integration (default: `false`) |
+| `ZSH_TMUX_UNICODE` | Set `tmux -u` option to support unicode |
diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh
index 72cdd4818..f65598358 100644
--- a/plugins/tmux/tmux.plugin.zsh
+++ b/plugins/tmux/tmux.plugin.zsh
@@ -13,18 +13,30 @@ fi
: ${ZSH_TMUX_AUTOCONNECT:=true}
# Automatically close the terminal when tmux exits
: ${ZSH_TMUX_AUTOQUIT:=$ZSH_TMUX_AUTOSTART}
+# Automatically name the new session based on the basename of PWD
+: ${ZSH_TMUX_AUTONAME_SESSION:=false}
# Set term to screen or screen-256color based on current terminal support
+: ${ZSH_TMUX_DETACHED:=false}
+# Set detached mode
: ${ZSH_TMUX_FIXTERM:=true}
# Set '-CC' option for iTerm2 tmux integration
: ${ZSH_TMUX_ITERM2:=false}
# The TERM to use for non-256 color terminals.
-# Tmux states this should be screen, but you may need to change it on
+# Tmux states this should be tmux|screen, but you may need to change it on
# systems without the proper terminfo
-: ${ZSH_TMUX_FIXTERM_WITHOUT_256COLOR:=screen}
+if [[ -e /usr/share/terminfo/t/tmux ]]; then
+ : ${ZSH_TMUX_FIXTERM_WITHOUT_256COLOR:=tmux}
+else
+ : ${ZSH_TMUX_FIXTERM_WITHOUT_256COLOR:=screen}
+fi
# The TERM to use for 256 color terminals.
-# Tmux states this should be screen-256color, but you may need to change it on
+# Tmux states this should be (tmux|screen)-256color, but you may need to change it on
# systems without the proper terminfo
-: ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color}
+if [[ -e /usr/share/terminfo/t/tmux-256color ]]; then
+ : ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=tmux-256color}
+else
+ : ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color}
+fi
# Set the configuration path
if [[ -e $HOME/.tmux.conf ]]; then
: ${ZSH_TMUX_CONFIG:=$HOME/.tmux.conf}
@@ -37,14 +49,27 @@ fi
: ${ZSH_TMUX_UNICODE:=false}
# ALIASES
-alias ta='tmux attach -t'
-alias tad='tmux attach -d -t'
-alias ts='tmux new-session -s'
-alias tl='tmux list-sessions'
+function _build_tmux_alias {
+ eval "function $1 {
+ if [[ -z \$1 ]] || [[ \${1:0:1} == '-' ]]; then
+ tmux $2 \"\$@\"
+ else
+ tmux $2 $3 \"\$@\"
+ fi
+ }"
+}
+
alias tksv='tmux kill-server'
-alias tkss='tmux kill-session -t'
+alias tl='tmux list-sessions'
alias tmuxconf='$EDITOR $ZSH_TMUX_CONFIG'
+_build_tmux_alias "ta" "attach" "-t"
+_build_tmux_alias "tad" "attach -d" "-t"
+_build_tmux_alias "ts" "new-session" "-s"
+_build_tmux_alias "tkss" "kill-session" "-t"
+
+unfunction _build_tmux_alias
+
# Determine if the terminal supports 256 colors
if [[ $terminfo[colors] == 256 ]]; then
export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR
@@ -77,11 +102,26 @@ function _zsh_tmux_plugin_run() {
[[ "$ZSH_TMUX_ITERM2" == "true" ]] && tmux_cmd+=(-CC)
[[ "$ZSH_TMUX_UNICODE" == "true" ]] && tmux_cmd+=(-u)
- # Try to connect to an existing session.
- if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then
- [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach -t $ZSH_TMUX_DEFAULT_SESSION_NAME
+ local _detached=""
+ [[ "$ZSH_TMUX_DETACHED" == "true" ]] && _detached="-d"
+
+ local session_name
+ if [[ "$ZSH_TMUX_AUTONAME_SESSION" == "true" ]]; then
+ # Name the session after the basename of the current directory
+ session_name=${PWD##*/}
+ # If the current directory is the home directory, name it 'HOME'
+ [[ "$PWD" == "$HOME" ]] && session_name="HOME"
+ # If the current directory is the root directory, name it 'ROOT'
+ [[ "$PWD" == "/" ]] && session_name="ROOT"
else
- [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach
+ session_name="$ZSH_TMUX_DEFAULT_SESSION_NAME"
+ fi
+
+ # Try to connect to an existing session.
+ if [[ -n "$session_name" ]]; then
+ [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach $_detached -t "$session_name"
+ else
+ [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach $_detached
fi
# If failed, just run tmux, fixing the TERM variable if requested.
@@ -91,8 +131,9 @@ function _zsh_tmux_plugin_run() {
elif [[ -e "$ZSH_TMUX_CONFIG" ]]; then
tmux_cmd+=(-f "$ZSH_TMUX_CONFIG")
fi
- if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then
- $tmux_cmd new-session -s $ZSH_TMUX_DEFAULT_SESSION_NAME
+
+ if [[ -n "$session_name" ]]; then
+ $tmux_cmd new-session -s "$session_name"
else
$tmux_cmd new-session
fi
diff --git a/plugins/ufw/README.md b/plugins/ufw/README.md
index ac377cd17..ffcc6d6f7 100644
--- a/plugins/ufw/README.md
+++ b/plugins/ufw/README.md
@@ -10,7 +10,7 @@ plugins=(... ufw)
Some of the commands include:
-* `allow /` add an allow rule
+* `allow /` add an allow rule
* `default` set default policy
* `delete /` delete RULE
* `deny /` add deny rule
diff --git a/plugins/vagrant-prompt/README.md b/plugins/vagrant-prompt/README.md
index c5bc55d17..dd0ca363b 100644
--- a/plugins/vagrant-prompt/README.md
+++ b/plugins/vagrant-prompt/README.md
@@ -1,6 +1,6 @@
This plugin prompts the status of the Vagrant VMs. It supports single-host and
multi-host configurations as well.
-Look inside the source for documentation about custom variables.
+Look inside the source for documentation about custom variables.
Alberto Re
diff --git a/plugins/vi-mode/README.md b/plugins/vi-mode/README.md
index 84ba30105..6e781f296 100644
--- a/plugins/vi-mode/README.md
+++ b/plugins/vi-mode/README.md
@@ -55,7 +55,7 @@ INSERT_MODE_INDICATOR="%F{yellow}+%f"
### Adding mode indicators to your prompt
-`Vi-mode` by default will add mode indicators to `RPROMPT` **unless** that is defined by
+`Vi-mode` by default will add mode indicators to `RPROMPT` **unless** that is defined by
a preceding plugin.
If `PROMPT` or `RPROMPT` is not defined to your liking, you can add mode info manually. The `vi_mode_prompt_info` function is available to insert mode indicator information.
diff --git a/plugins/vim-interaction/README.md b/plugins/vim-interaction/README.md
index 681648018..c2b45f1d8 100644
--- a/plugins/vim-interaction/README.md
+++ b/plugins/vim-interaction/README.md
@@ -3,7 +3,7 @@
The plugin presents a function called `callvim` whose usage is:
usage: callvim [-b cmd] [-a cmd] [file ... fileN]
-
+
-b cmd Run this command in GVIM before editing the first file
-a cmd Run this command in GVIM after editing the first file
file The file to edit
diff --git a/plugins/vim-interaction/vim-interaction.plugin.zsh b/plugins/vim-interaction/vim-interaction.plugin.zsh
index b73f9b4da..a12b52bd5 100644
--- a/plugins/vim-interaction/vim-interaction.plugin.zsh
+++ b/plugins/vim-interaction/vim-interaction.plugin.zsh
@@ -2,7 +2,7 @@
# See README.md
#
# Derek Wyatt (derek@{myfirstnamemylastname}.org
-#
+#
function callvim {
if [[ $# == 0 ]]; then
diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
index e037241e4..1a3ae37b8 100644
--- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
+++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
@@ -52,7 +52,7 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
else
ENV_NAME=""
fi
-
+
if [[ -n $CD_VIRTUAL_ENV && "$ENV_NAME" != "$CD_VIRTUAL_ENV" ]]; then
# We've just left the repo, deactivate the environment
# Note: this only happens if the virtualenv was activated automatically
diff --git a/plugins/wd/README.md b/plugins/wd/README.md
index 1d1980632..0ad74e805 100644
--- a/plugins/wd/README.md
+++ b/plugins/wd/README.md
@@ -153,7 +153,7 @@ wd ..
wd ...
```
-This is a wrapper for the zsh's `dirs` function.
+This is a wrapper for the zsh's `dirs` function.
_You might need to add `setopt AUTO_PUSHD` to your `.zshrc` if you are not using [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh)._
* Remove warp point:
diff --git a/plugins/wd/_wd.sh b/plugins/wd/_wd.sh
index 8d5cf15a2..52ecb12e6 100644
--- a/plugins/wd/_wd.sh
+++ b/plugins/wd/_wd.sh
@@ -77,7 +77,7 @@ function _wd() {
# complete sub directories from the warp point
_path_files -W "(${points[$target]})" -/ && ret=0
fi
-
+
# don't complete anything if warp point is not valid
;;
esac
diff --git a/plugins/yarn/_yarn b/plugins/yarn/_yarn
index f15756ff4..9ffe5660c 100644
--- a/plugins/yarn/_yarn
+++ b/plugins/yarn/_yarn
@@ -86,7 +86,7 @@ _global_commands=(
)
_yarn_find_package_json() {
- local dir=$(cd "$1" && pwd)
+ local dir=$(builtin cd "$1" && pwd)
while true
do
@@ -109,7 +109,7 @@ _yarn_commands_scripts() {
if [[ -n $opt_args[--cwd] ]]; then
packageJson=$(_yarn_find_package_json $opt_args[--cwd])
- binaries=($(cd $opt_args[--cwd] && echo node_modules/.bin/*(x:t)))
+ binaries=($(builtin cd $opt_args[--cwd] && echo node_modules/.bin/*(x:t)))
else
packageJson=$(_yarn_find_package_json $pwd)
binaries=($(echo node_modules/.bin/*(x:t)))
@@ -130,9 +130,9 @@ _yarn_scripts() {
if [[ -n $_yarn_run_cwd ]]; then
packageJson=$(_yarn_find_package_json $_yarn_run_cwd)
if [[ -d "${_yarn_run_cwd}/node_modules" ]]; then
- binaries=($(cd $_yarn_run_cwd && echo node_modules/.bin/*(x:t)))
+ binaries=($(builtin cd $_yarn_run_cwd && echo node_modules/.bin/*(x:t)))
else
- binaries=($(cd $_yarn_run_cwd && yarn bin | perl -wln -e 'm{^[^:]+: (\S+)$} and print $1'))
+ binaries=($(builtin cd $_yarn_run_cwd && yarn bin | perl -wln -e 'm{^[^:]+: (\S+)$} and print $1'))
fi
else
packageJson=$(_yarn_find_package_json $pwd)
diff --git a/plugins/z/MANUAL.md b/plugins/z/MANUAL.md
index 67a207dbb..106d8c107 100644
--- a/plugins/z/MANUAL.md
+++ b/plugins/z/MANUAL.md
@@ -188,7 +188,7 @@ Add a backslash to the end of the last line add `'zsh-z'` to the list, e.g.,
Then relaunch `zsh`.
### For [zcomet](https://github.com/agkozak/zcomet) users
-
+
Simply add
zcomet load agkozak/zsh-z
diff --git a/plugins/zoxide/README.md b/plugins/zoxide/README.md
index f326effe6..45f77bdf5 100644
--- a/plugins/zoxide/README.md
+++ b/plugins/zoxide/README.md
@@ -10,5 +10,8 @@ To use it, add `zoxide` to the plugins array in your `.zshrc` file:
```zsh
plugins=(... zoxide)
```
+## Overriding `z` Alias
+
+You can set the `ZOXIDE_CMD_OVERRIDE`, which will be passed to the `--cmd` flag of `zoxide init`. This allows you to set your `z` command to a default of `cd`.
**Note:** you have to [install zoxide](https://github.com/ajeetdsouza/zoxide#step-1-install-zoxide) first.
diff --git a/plugins/zoxide/zoxide.plugin.zsh b/plugins/zoxide/zoxide.plugin.zsh
index e5658b8f0..25d2e8377 100644
--- a/plugins/zoxide/zoxide.plugin.zsh
+++ b/plugins/zoxide/zoxide.plugin.zsh
@@ -1,5 +1,5 @@
if (( $+commands[zoxide] )); then
- eval "$(zoxide init zsh)"
+ eval "$(zoxide init --cmd ${ZOXIDE_CMD_OVERRIDE:-z} zsh)"
else
echo '[oh-my-zsh] zoxide not found, please install it from https://github.com/ajeetdsouza/zoxide'
fi
diff --git a/themes/Soliah.zsh-theme b/themes/Soliah.zsh-theme
index c3dd6af89..e297fe9ca 100644
--- a/themes/Soliah.zsh-theme
+++ b/themes/Soliah.zsh-theme
@@ -5,10 +5,10 @@ ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})"
# Text to display if the branch is dirty
-ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}"
# Text to display if the branch is clean
-ZSH_THEME_GIT_PROMPT_CLEAN=""
+ZSH_THEME_GIT_PROMPT_CLEAN=""
# Colors vary depending on time lapsed.
ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}"
@@ -36,7 +36,7 @@ function rvm_gemset() {
GEMSET=`rvm gemset list | grep '=>' | cut -b4-`
if [[ -n $GEMSET ]]; then
echo "%{$fg[yellow]%}$GEMSET%{$reset_color%}|"
- fi
+ fi
fi
}
@@ -52,12 +52,12 @@ function git_time_since_commit() {
# Totals
MINUTES=$((seconds_since_last_commit / 60))
HOURS=$((seconds_since_last_commit/3600))
-
+
# Sub-hours and sub-minutes
DAYS=$((seconds_since_last_commit / 86400))
SUB_HOURS=$((HOURS % 24))
SUB_MINUTES=$((MINUTES % 60))
-
+
if [[ -n $(git status -s 2> /dev/null) ]]; then
if [ "$MINUTES" -gt 30 ]; then
COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme
index c2fdbed23..cc097057f 100644
--- a/themes/adben.zsh-theme
+++ b/themes/adben.zsh-theme
@@ -79,7 +79,7 @@ ps1_command_tip() {
command wget -qO- https://www.commandlinefu.com/commands/random/plaintext
elif (( ${+commands[curl]} )); then
command curl -fsL https://www.commandlinefu.com/commands/random/plaintext
- fi
+ fi
} | sed '1d;/^$/d'
}
diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
index aa274a5bb..c2a542163 100644
--- a/themes/agnoster.zsh-theme
+++ b/themes/agnoster.zsh-theme
@@ -96,7 +96,7 @@ prompt_context() {
# Git: branch/detached head, dirty status
prompt_git() {
(( $+commands[git] )) || return
- if [[ "$(git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]]; then
+ if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]]; then
return
fi
local PL_BRANCH_CHAR
@@ -106,12 +106,12 @@ prompt_git() {
}
local ref dirty mode repo_path
- if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
- repo_path=$(git rev-parse --git-dir 2>/dev/null)
+ if [[ "$(command git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
+ repo_path=$(command git rev-parse --git-dir 2>/dev/null)
dirty=$(parse_git_dirty)
- ref=$(git symbolic-ref HEAD 2> /dev/null) || \
- ref="◈ $(git describe --exact-match --tags HEAD 2> /dev/null)" || \
- ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"
+ ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
+ ref="◈ $(command git describe --exact-match --tags HEAD 2> /dev/null)" || \
+ ref="➦ $(command git rev-parse --short HEAD 2> /dev/null)"
if [[ -n $dirty ]]; then
prompt_segment yellow black
else
@@ -119,8 +119,8 @@ prompt_git() {
fi
local ahead behind
- ahead=$(git log --oneline @{upstream}.. 2>/dev/null)
- behind=$(git log --oneline ..@{upstream} 2>/dev/null)
+ ahead=$(command git log --oneline @{upstream}.. 2>/dev/null)
+ behind=$(command git log --oneline ..@{upstream} 2>/dev/null)
if [[ -n "$ahead" ]] && [[ -n "$behind" ]]; then
PL_BRANCH_CHAR=$'\u21c5'
elif [[ -n "$ahead" ]]; then
@@ -163,10 +163,10 @@ prompt_bzr() {
done
local bzr_status status_mod status_all revision
- if bzr_status=$(bzr status 2>&1); then
+ if bzr_status=$(command bzr status 2>&1); then
status_mod=$(echo -n "$bzr_status" | head -n1 | grep "modified" | wc -m)
status_all=$(echo -n "$bzr_status" | head -n1 | wc -m)
- revision=${$(bzr log -r-1 --log-format line | cut -d: -f1):gs/%/%%}
+ revision=${$(command bzr log -r-1 --log-format line | cut -d: -f1):gs/%/%%}
if [[ $status_mod -gt 0 ]] ; then
prompt_segment yellow black "bzr@$revision ✚"
else
@@ -182,13 +182,13 @@ prompt_bzr() {
prompt_hg() {
(( $+commands[hg] )) || return
local rev st branch
- if $(hg id >/dev/null 2>&1); then
- if $(hg prompt >/dev/null 2>&1); then
- if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
+ if $(command hg id >/dev/null 2>&1); then
+ if $(command hg prompt >/dev/null 2>&1); then
+ if [[ $(command hg prompt "{status|unknown}") = "?" ]]; then
# if files are not added
prompt_segment red white
st='±'
- elif [[ -n $(hg prompt "{status|modified}") ]]; then
+ elif [[ -n $(command hg prompt "{status|modified}") ]]; then
# if any modification
prompt_segment yellow black
st='±'
@@ -196,15 +196,15 @@ prompt_hg() {
# if working copy is clean
prompt_segment green $CURRENT_FG
fi
- echo -n ${$(hg prompt "☿ {rev}@{branch}"):gs/%/%%} $st
+ echo -n ${$(command hg prompt "☿ {rev}@{branch}"):gs/%/%%} $st
else
st=""
- rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
- branch=$(hg id -b 2>/dev/null)
- if `hg st | grep -q "^\?"`; then
+ rev=$(command hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
+ branch=$(command hg id -b 2>/dev/null)
+ if command hg st | command grep -q "^\?"; then
prompt_segment red black
st='±'
- elif `hg st | grep -q "^[MA]"`; then
+ elif command hg st | command grep -q "^[MA]"; then
prompt_segment yellow black
st='±'
else
diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme
index 206274462..0e39d9077 100644
--- a/themes/avit.zsh-theme
+++ b/themes/avit.zsh-theme
@@ -15,7 +15,7 @@ __RPROMPT='$(vi_mode_prompt_info)%{$(echotc UP 1)%}$(_git_time_since_commit) $(g
if [[ -z $RPROMPT ]]; then
RPROMPT=$__RPROMPT
else
- RPROMPT="${RPROMPT} ${__RPROMPT}"
+ RPROMPT="${RPROMPT} ${__RPROMPT}"
fi
function _user_host() {
diff --git a/themes/crunch.zsh-theme b/themes/crunch.zsh-theme
index 8278661ab..d86ce1e4a 100644
--- a/themes/crunch.zsh-theme
+++ b/themes/crunch.zsh-theme
@@ -1,15 +1,15 @@
# CRUNCH - created from Steve Eley's cat waxing.
# Initially hacked from the Dallas theme. Thanks, Dallas Reedy.
#
-# This theme assumes you do most of your oh-my-zsh'ed "colorful" work at a single machine,
-# and eschews the standard space-consuming user and hostname info. Instead, only the
+# This theme assumes you do most of your oh-my-zsh'ed "colorful" work at a single machine,
+# and eschews the standard space-consuming user and hostname info. Instead, only the
# things that vary in my own workflow are shown:
#
# * The time (not the date)
# * The RVM version and gemset (omitting the 'ruby' name if it's MRI)
# * The current directory
# * The Git branch and its 'dirty' state
-#
+#
# Colors are at the top so you can mess with those separately if you like.
# For the most part I stuck with Dallas's.
diff --git a/themes/eastwood.zsh-theme b/themes/eastwood.zsh-theme
index 88134f8e6..31e24fa7f 100644
--- a/themes/eastwood.zsh-theme
+++ b/themes/eastwood.zsh-theme
@@ -1,5 +1,5 @@
# RVM settings
-if [[ -s ~/.rvm/scripts/rvm ]] ; then
+if [[ -s ~/.rvm/scripts/rvm ]] ; then
RPS1="%{$fg[yellow]%}rvm:%{$reset_color%}%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $EPS1"
else
if which rbenv &> /dev/null; then
diff --git a/themes/emotty.zsh-theme b/themes/emotty.zsh-theme
index ba0840950..0fea7d916 100644
--- a/themes/emotty.zsh-theme
+++ b/themes/emotty.zsh-theme
@@ -11,7 +11,7 @@
#
# There are pre-defined different emoji sets to choose from, e.g.:
# emoji, stellar, floral, zodiac, love (see emotty plugin).
-#
+#
# To choose a different emotty set than the default (emoji)
# % export emotty_set=nature
#
@@ -95,7 +95,7 @@ zstyle ':vcs_info:*' stagedstr "${green}${vcs_staged_glyph}"
# %(k|f) reset (back|fore)ground color
zstyle ':vcs_info:*' max-exports 3
zstyle ':vcs_info:*' nvcsformats "${prompt_glyph}" '%3~' ''
-zstyle ':vcs_info:*' formats "${yellow}%u%c%b${vcs_branch_glyph}%f" '%S|' "$FX[bold]%r$FX[no-bold]"
+zstyle ':vcs_info:*' formats "${yellow}%u%c%b${vcs_branch_glyph}%f" '%S|' "$FX[bold]%r$FX[no-bold]"
zstyle ':vcs_info:*' actionformats "${red}%K{white}%a${vcs_action_glyph}%k%f" '%S|' "$FX[bold]%r$FX[no-bold]"
red_if_root="%(!.%F{red}.)"
diff --git a/themes/essembeh.zsh-theme b/themes/essembeh.zsh-theme
index 43d4093b1..50b3f7772 100644
--- a/themes/essembeh.zsh-theme
+++ b/themes/essembeh.zsh-theme
@@ -8,7 +8,7 @@
# - prefix to detect docker containers or chroot
# - git plugin to display current branch and status
-# git plugin
+# git plugin
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}("
ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%%"
@@ -35,7 +35,7 @@ if [[ -n "$SSH_CONNECTION" ]]; then
ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[$(echo $SSH_CONNECTION | awk '{print $1}')]%{$reset_color%} "
# use red color to highlight a remote connection
ZSH_ESSEMBEH_COLOR="red"
-elif [[ -r /etc/debian_chroot ]]; then
+elif [[ -r /etc/debian_chroot ]]; then
# prefix prompt in case of chroot
ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[chroot:$(cat /etc/debian_chroot)]%{$reset_color%} "
elif [[ -r /.dockerenv ]]; then
diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme
index 2b8d559e5..3b975c8f4 100644
--- a/themes/fishy.zsh-theme
+++ b/themes/fishy.zsh-theme
@@ -16,7 +16,8 @@ _fishy_collapsed_wd() {
}
local user_color='green'; [ $UID -eq 0 ] && user_color='red'
-PROMPT='%n@%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>) '
+local host_color='white'; [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] && host_color='yellow'
+PROMPT='%{$fg[$user_color]%}%n%{$reset_color%}@%{$fg[$host_color]%}%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>) '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}"
diff --git a/themes/josh.zsh-theme b/themes/josh.zsh-theme
index ea051c58e..df59280d7 100644
--- a/themes/josh.zsh-theme
+++ b/themes/josh.zsh-theme
@@ -15,7 +15,7 @@ function josh_prompt {
branch_size=${#branch}
ruby_size=${#ruby_version}
user_machine_size=${#${(%):-%n@%m-}}
-
+
if [[ ${#branch} -eq 0 ]]
then (( ruby_size = ruby_size + 1 ))
else
@@ -24,15 +24,15 @@ function josh_prompt {
(( branch_size = branch_size + 2 ))
fi
fi
-
+
(( spare_width = ${spare_width} - (${user_machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) ))
while [ ${#prompt} -lt $spare_width ]; do
prompt=" $prompt"
done
-
+
prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(ruby_prompt_info)%{$reset_color%} $(git_current_branch)"
-
+
echo $prompt
}
diff --git a/themes/junkfood.zsh-theme b/themes/junkfood.zsh-theme
index 01fae4b95..e3b746c7a 100644
--- a/themes/junkfood.zsh-theme
+++ b/themes/junkfood.zsh-theme
@@ -3,10 +3,10 @@
# Grab the current date (%W) and time (%t):
JUNKFOOD_TIME_="%{$fg_bold[red]%}#%{$fg_bold[white]%}( %{$fg_bold[yellow]%}%W%{$reset_color%}@%{$fg_bold[white]%}%t )( %{$reset_color%}"
-# Grab the current machine name
+# Grab the current machine name
JUNKFOOD_MACHINE_="%{$fg_bold[blue]%}%m%{$fg[white]%} ):%{$reset_color%}"
-# Grab the current username
+# Grab the current username
JUNKFOOD_CURRENT_USER_="%{$fg_bold[green]%}%n%{$reset_color%}"
# Grab the current filepath, use shortcuts: ~/Desktop
diff --git a/themes/mlh.zsh-theme b/themes/mlh.zsh-theme
index c059bf850..94718f8f2 100644
--- a/themes/mlh.zsh-theme
+++ b/themes/mlh.zsh-theme
@@ -15,7 +15,7 @@
# To customize symbols (e.g MLH_AT_SYMBOL), simply set them as environment variables
# for example in your ~/.zshrc file, like this:
# MLH_AT_SYMBOL=" at "
-#
+#
# Settings *must* be set before sourcing oh-my-zsh.sh the .zshrc file.
#
# To easily discover colors and their codes, type `spectrum_ls` in the terminal
diff --git a/themes/mortalscumbag.zsh-theme b/themes/mortalscumbag.zsh-theme
index 36301cb76..c9994c0f9 100644
--- a/themes/mortalscumbag.zsh-theme
+++ b/themes/mortalscumbag.zsh-theme
@@ -1,6 +1,6 @@
function my_git_prompt() {
tester=$(git rev-parse --git-dir 2> /dev/null) || return
-
+
INDEX=$(git status --porcelain 2> /dev/null)
STATUS=""
diff --git a/themes/sonicradish.zsh-theme b/themes/sonicradish.zsh-theme
index 508611830..db6170969 100644
--- a/themes/sonicradish.zsh-theme
+++ b/themes/sonicradish.zsh-theme
@@ -1,4 +1,4 @@
-#!/usr/bin/env zsh
+#!/usr/bin/env zsh
#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
setopt promptsubst
diff --git a/themes/wedisagree.zsh-theme b/themes/wedisagree.zsh-theme
index e9e9d6ef8..358891992 100644
--- a/themes/wedisagree.zsh-theme
+++ b/themes/wedisagree.zsh-theme
@@ -5,9 +5,9 @@
# - Place that bundle in ~/Library/Application\ Support/SIMBL/Plugins (create that folder if it doesn't exist)
# - Open Terminal preferences. Go to Settings -> Text -> More
# - Change default colours to your liking.
-#
+#
# Here are the colours from Textmate's Monokai theme:
-#
+#
# Black: 0, 0, 0
# Red: 229, 34, 34
# Green: 166, 227, 45
@@ -28,7 +28,7 @@ PROMPT='%{$fg[magenta]%}[%c] %{$reset_color%}'
RPROMPT='${time} %{$fg[magenta]%}$(git_prompt_info)%{$reset_color%}$(git_prompt_status)%{$reset_color%}$(git_prompt_ahead)%{$reset_color%}'
# Add this at the start of RPROMPT to include rvm info showing ruby-version@gemset-name
-# $(ruby_prompt_info)
+# $(ruby_prompt_info)
# local time, color coded by last return code
time_enabled="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}"
@@ -53,7 +53,7 @@ ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$reset_color%}"
# More symbols to choose from:
# ☀ ✹ ☄ ♆ ♀ ♁ ♐ ♇ ♈ ♉ ♚ ♛ ♜ ♝ ♞ ♟ ♠ ♣ ⚢ ⚲ ⚳ ⚴ ⚥ ⚤ ⚦ ⚒ ⚑ ⚐ ♺ ♻ ♼ ☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷
-# ✡ ✔ ✖ ✚ ✱ ✤ ✦ ❤ ➜ ➟ ➼ ✂ ✎ ✐ ⨀ ⨁ ⨂ ⨍ ⨎ ⨏ ⨷ ⩚ ⩛ ⩡ ⩱ ⩲ ⩵ ⩶ ⨠
+# ✡ ✔ ✖ ✚ ✱ ✤ ✦ ❤ ➜ ➟ ➼ ✂ ✎ ✐ ⨀ ⨁ ⨂ ⨍ ⨎ ⨏ ⨷ ⩚ ⩛ ⩡ ⩱ ⩲ ⩵ ⩶ ⨠
# ⬅ ⬆ ⬇ ⬈ ⬉ ⬊ ⬋ ⬒ ⬓ ⬔ ⬕ ⬖ ⬗ ⬘ ⬙ ⬟ ⬤ 〒 ǀ ǁ ǂ ĭ Ť Ŧ
# Determine if we are using a gemset.
@@ -61,7 +61,7 @@ function rvm_gemset() {
GEMSET=`rvm gemset list | grep '=>' | cut -b4-`
if [[ -n $GEMSET ]]; then
echo "%{$fg[yellow]%}$GEMSET%{$reset_color%}|"
- fi
+ fi
}
# Determine the time since last commit. If branch is clean,
@@ -76,12 +76,12 @@ function git_time_since_commit() {
# Totals
MINUTES=$((seconds_since_last_commit / 60))
HOURS=$((seconds_since_last_commit/3600))
-
+
# Sub-hours and sub-minutes
DAYS=$((seconds_since_last_commit / 86400))
SUB_HOURS=$((HOURS % 24))
SUB_MINUTES=$((MINUTES % 60))
-
+
if [[ -n $(git status -s 2> /dev/null) ]]; then
if [ "$MINUTES" -gt 30 ]; then
COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
diff --git a/tools/changelog.sh b/tools/changelog.sh
index 3ad8fe786..c4b26079e 100755
--- a/tools/changelog.sh
+++ b/tools/changelog.sh
@@ -221,11 +221,16 @@ supports_hyperlinks() {
# If $TERM_PROGRAM is set, these terminals support hyperlinks
case "$TERM_PROGRAM" in
- Hyper|iTerm.app|terminology|WezTerm) return 0 ;;
+ Hyper|iTerm.app|terminology|WezTerm|vscode) return 0 ;;
esac
- # kitty supports hyperlinks
- if [ "$TERM" = xterm-kitty ]; then
+ # These termcap entries support hyperlinks
+ case "$TERM" in
+ xterm-kitty|alacritty|alacritty-direct) return 0 ;;
+ esac
+
+ # xfce4-terminal supports hyperlinks
+ if [ "$COLORTERM" = "xfce4-terminal" ]; then
return 0
fi
diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
index 1cc193bde..1ecab5c0b 100755
--- a/tools/check_for_upgrade.sh
+++ b/tools/check_for_upgrade.sh
@@ -20,14 +20,16 @@ zstyle -s ':omz:update' mode update_mode || {
}
# Cancel update if:
-# - the automatic update is disabled.
-# - the current user doesn't have write permissions nor owns the $ZSH directory.
+# - the automatic update is disabled
+# - the current user doesn't have write permissions nor owns the $ZSH directory
# - is not run from a tty
-# - git is unavailable on the system.
+# - git is unavailable on the system
+# - $ZSH is not a git repository
if [[ "$update_mode" = disabled ]] \
|| [[ ! -w "$ZSH" || ! -O "$ZSH" ]] \
|| [[ ! -t 1 ]] \
- || ! command git --version 2>&1 >/dev/null; then
+ || ! command git --version 2>&1 >/dev/null \
+ || (builtin cd -q "$ZSH"; ! command git rev-parse --is-inside-work-tree &>/dev/null); then
unset update_mode
return
fi
diff --git a/tools/install.sh b/tools/install.sh
index 071ad94f6..47a200e78 100755
--- a/tools/install.sh
+++ b/tools/install.sh
@@ -164,11 +164,16 @@ supports_hyperlinks() {
# If $TERM_PROGRAM is set, these terminals support hyperlinks
case "$TERM_PROGRAM" in
- Hyper|iTerm.app|terminology|WezTerm) return 0 ;;
+ Hyper|iTerm.app|terminology|WezTerm|vscode) return 0 ;;
esac
- # kitty supports hyperlinks
- if [ "$TERM" = xterm-kitty ]; then
+ # These termcap entries support hyperlinks
+ case "$TERM" in
+ xterm-kitty|alacritty|alacritty-direct) return 0 ;;
+ esac
+
+ # xfce4-terminal supports hyperlinks
+ if [ "$COLORTERM" = "xfce4-terminal" ]; then
return 0
fi
diff --git a/tools/upgrade.sh b/tools/upgrade.sh
index a27a68127..9b0a4def7 100755
--- a/tools/upgrade.sh
+++ b/tools/upgrade.sh
@@ -10,9 +10,14 @@ fi
# Protect against unwanted sourcing
case "$ZSH_EVAL_CONTEXT" in
- *:file) echo "error: this file should not be sourced" && return ;;
+ *:file) echo "error: this file should not be sourced" && return 1 ;;
esac
+# Define "$ZSH" if not defined -- in theory this should be `export`ed by the calling script
+if [[ -z "$ZSH" ]]; then
+ ZSH="${0:a:h:h}"
+fi
+
cd "$ZSH"
verbose_mode="default"
@@ -90,11 +95,16 @@ supports_hyperlinks() {
# If $TERM_PROGRAM is set, these terminals support hyperlinks
case "$TERM_PROGRAM" in
- Hyper|iTerm.app|terminology|WezTerm) return 0 ;;
+ Hyper|iTerm.app|terminology|WezTerm|vscode) return 0 ;;
esac
- # kitty supports hyperlinks
- if [ "$TERM" = xterm-kitty ]; then
+ # These termcap entries support hyperlinks
+ case "$TERM" in
+ xterm-kitty|alacritty|alacritty-direct) return 0 ;;
+ esac
+
+ # xfce4-terminal supports hyperlinks
+ if [ "$COLORTERM" = "xfce4-terminal" ]; then
return 0
fi