Compare commits

..
Author SHA1 Message Date
Robby RussellandClaude Opus 5.5 34aec8b799 docs(lib): note why the omz autoloads need -z under kshautoload
The autoload files end with a call to the function they define. Under
kshautoload, ksh-style loading would call it a second time; -z forces
zsh-style loading so the trailing call is the only one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 11:44:09 -08:00
copilot-swe-agent[bot]androbbyrussell 82bfc95f7f ci: check syntax for functions/* and completions/_*
Co-authored-by: robbyrussell <257+robbyrussell@users.noreply.github.com>
2026-11-24 11:43:34 -08:00
Robby RussellandClaude Fable 5.1 58d76b0c10 perf(lib): autoload the omz CLI and omz_diagnostic_dump
lib/cli.zsh (944 lines) and lib/diagnostics.zsh (353 lines) were parsed
on every startup to define functions that most shells never call. Move
them to $ZSH/functions/, which is already on $fpath, and autoload the
two entry points from oh-my-zsh.sh instead. The `omz` completion moves
to $ZSH/completions/_omz where compinit picks it up on its own.

Measured on macOS arm64, zsh 5.9: ~1.7 ms less per interactive start.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-24 11:43:34 -08:00
42 changed files with 143 additions and 718 deletions

No files matched your search

+2
View File
@@ -36,6 +36,8 @@ jobs:
run: | run: |
for file in ./oh-my-zsh.sh \ for file in ./oh-my-zsh.sh \
./lib/*.zsh \ ./lib/*.zsh \
./functions/* \
./completions/_* \
./plugins/*/*.plugin.zsh \ ./plugins/*/*.plugin.zsh \
./plugins/*/_* \ ./plugins/*/_* \
./themes/*.zsh-theme; do ./themes/*.zsh-theme; do
+104
View File
@@ -0,0 +1,104 @@
#compdef omz
local -a cmds subcmds
cmds=(
'changelog:Print the changelog'
'diagnose:Run configuration diagnostics'
'help:Usage information'
'plugin:Manage plugins'
'pr:Manage Oh My Zsh Pull Requests'
'reload:Reload the current zsh session'
'shellsaver:Launch a whimsical terminal screensaver'
'shop:Open the Oh My Zsh shop'
'theme:Manage themes'
'update:Update Oh My Zsh'
'version:Show the version'
)
if [[ "$words[2]" == (screensaver|shellsaver) ]] && (( CURRENT > 2 )); then
_arguments \
'1:command:' \
'2::scene:(aquarium logo hermit party)' \
'--list[List available scenes]' \
'--mono[Use the default foreground color]' \
'--seconds[Exit after a number of seconds]:seconds:' \
'--snapshot[Print a plain-text still]::frame:' \
'--help[Show Shellsaver help]'
return
fi
if (( CURRENT == 2 )); then
_describe 'command' cmds
elif (( CURRENT == 3 )); then
case "$words[2]" in
changelog) local -a refs
refs=("${(@f)$(builtin cd -q "$ZSH"; command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}")
_describe 'command' refs ;;
plugin) subcmds=(
'disable:Disable plugin(s)'
'enable:Enable plugin(s)'
'info:Get plugin information'
'list:List plugins'
'load:Load plugin(s)'
)
_describe 'command' subcmds ;;
pr) subcmds=('clean:Delete all Pull Request branches' 'test:Test a Pull Request')
_describe 'command' subcmds ;;
theme) subcmds=('list:List themes' 'set:Set a theme in your .zshrc file' 'use:Load a theme')
_describe 'command' subcmds ;;
esac
elif (( CURRENT == 4 )); then
case "${words[2]}::${words[3]}" in
plugin::(disable|enable|load))
local -aU valid_plugins
if [[ "${words[3]}" = disable ]]; then
# if command is "disable", only offer already enabled plugins
valid_plugins=($plugins)
else
valid_plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t))
# if command is "enable", remove already enabled plugins
[[ "${words[3]}" = enable ]] && valid_plugins=(${valid_plugins:|plugins})
fi
_describe 'plugin' valid_plugins ;;
plugin::info)
local -aU plugins
plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t))
_describe 'plugin' plugins ;;
plugin::list)
local -a opts
opts=('--enabled:List enabled plugins only')
_describe -o 'options' opts ;;
theme::(set|use))
local -aU themes
themes=("$ZSH"/themes/*.zsh-theme(-.N:t:r) "$ZSH_CUSTOM"/**/*.zsh-theme(-.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::))
_describe 'theme' themes ;;
esac
elif (( CURRENT > 4 )); then
case "${words[2]}::${words[3]}" in
plugin::(enable|disable|load))
local -aU valid_plugins
if [[ "${words[3]}" = disable ]]; then
# if command is "disable", only offer already enabled plugins
valid_plugins=($plugins)
else
valid_plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t))
# if command is "enable", remove already enabled plugins
[[ "${words[3]}" = enable ]] && valid_plugins=(${valid_plugins:|plugins})
fi
# Remove plugins already passed as arguments
# NOTE: $(( CURRENT - 1 )) is the last plugin argument completely passed, i.e. that which
# has a space after them. This is to avoid removing plugins partially passed, which makes
# the completion not add a space after the completed plugin.
local -a args
args=(${words[4,$(( CURRENT - 1))]})
valid_plugins=(${valid_plugins:|args})
_describe 'plugin' valid_plugins ;;
esac
fi
return 0
+4 -114
View File
@@ -1,5 +1,3 @@
#!/usr/bin/env zsh
function omz { function omz {
setopt localoptions noksharrays setopt localoptions noksharrays
[[ $# -gt 0 ]] || { [[ $# -gt 0 ]] || {
@@ -20,116 +18,6 @@ function omz {
_omz::$command "$@" _omz::$command "$@"
} }
function _omz {
local -a cmds subcmds
cmds=(
'changelog:Print the changelog'
'diagnose:Run configuration diagnostics'
'help:Usage information'
'plugin:Manage plugins'
'pr:Manage Oh My Zsh Pull Requests'
'reload:Reload the current zsh session'
'shellsaver:Launch a whimsical terminal screensaver'
'shop:Open the Oh My Zsh shop'
'theme:Manage themes'
'update:Update Oh My Zsh'
'version:Show the version'
)
if [[ "$words[2]" == (screensaver|shellsaver) ]] && (( CURRENT > 2 )); then
_arguments \
'1:command:' \
'2::scene:(aquarium logo hermit party)' \
'--list[List available scenes]' \
'--mono[Use the default foreground color]' \
'--seconds[Exit after a number of seconds]:seconds:' \
'--snapshot[Print a plain-text still]::frame:' \
'--help[Show Shellsaver help]'
return
fi
if (( CURRENT == 2 )); then
_describe 'command' cmds
elif (( CURRENT == 3 )); then
case "$words[2]" in
changelog) local -a refs
refs=("${(@f)$(builtin cd -q "$ZSH"; command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}")
_describe 'command' refs ;;
plugin) subcmds=(
'disable:Disable plugin(s)'
'enable:Enable plugin(s)'
'info:Get plugin information'
'list:List plugins'
'load:Load plugin(s)'
)
_describe 'command' subcmds ;;
pr) subcmds=('clean:Delete all Pull Request branches' 'test:Test a Pull Request')
_describe 'command' subcmds ;;
theme) subcmds=('list:List themes' 'set:Set a theme in your .zshrc file' 'use:Load a theme')
_describe 'command' subcmds ;;
esac
elif (( CURRENT == 4 )); then
case "${words[2]}::${words[3]}" in
plugin::(disable|enable|load))
local -aU valid_plugins
if [[ "${words[3]}" = disable ]]; then
# if command is "disable", only offer already enabled plugins
valid_plugins=($plugins)
else
valid_plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t))
# if command is "enable", remove already enabled plugins
[[ "${words[3]}" = enable ]] && valid_plugins=(${valid_plugins:|plugins})
fi
_describe 'plugin' valid_plugins ;;
plugin::info)
local -aU plugins
plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t))
_describe 'plugin' plugins ;;
plugin::list)
local -a opts
opts=('--enabled:List enabled plugins only')
_describe -o 'options' opts ;;
theme::(set|use))
local -aU themes
themes=("$ZSH"/themes/*.zsh-theme(-.N:t:r) "$ZSH_CUSTOM"/**/*.zsh-theme(-.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::))
_describe 'theme' themes ;;
esac
elif (( CURRENT > 4 )); then
case "${words[2]}::${words[3]}" in
plugin::(enable|disable|load))
local -aU valid_plugins
if [[ "${words[3]}" = disable ]]; then
# if command is "disable", only offer already enabled plugins
valid_plugins=($plugins)
else
valid_plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t))
# if command is "enable", remove already enabled plugins
[[ "${words[3]}" = enable ]] && valid_plugins=(${valid_plugins:|plugins})
fi
# Remove plugins already passed as arguments
# NOTE: $(( CURRENT - 1 )) is the last plugin argument completely passed, i.e. that which
# has a space after them. This is to avoid removing plugins partially passed, which makes
# the completion not add a space after the completed plugin.
local -a args
args=(${words[4,$(( CURRENT - 1))]})
valid_plugins=(${valid_plugins:|args})
_describe 'plugin' valid_plugins ;;
esac
fi
return 0
}
# If run from a script, do not set the completion function
if (( ${+functions[compdef]} )); then
compdef _omz omz
fi
## Utility functions ## Utility functions
function _omz::confirm { function _omz::confirm {
@@ -392,8 +280,8 @@ function _omz::plugin::enable {
# Enable plugins awk script # Enable plugins awk script
local awk_script=" local awk_script="
# if plugins=() is in oneline form (empty or not), substitute ) with new plugins and go to the next line # if plugins=() is in oneline form, substitute ) with new plugins and go to the next line
/^[ \t]*plugins=\([^#]*\).*\$/ { /^[ \t]*plugins=\([^#]+\).*\$/ {
sub(/\)/, \" $add_plugins&\") sub(/\)/, \" $add_plugins&\")
print \$0 print \$0
next next
@@ -999,3 +887,5 @@ function _omz::version {
printf "%s (%s)\n" "$version" "$commit" printf "%s (%s)\n" "$version" "$commit"
) )
} }
omz "$@"
@@ -1,4 +1,4 @@
# diagnostics.zsh # omz_diagnostic_dump
# #
# Diagnostic and debugging support for oh-my-zsh # Diagnostic and debugging support for oh-my-zsh
@@ -351,3 +351,5 @@ function _omz_diag_dump_os_specific_version() {
done done
} }
omz_diagnostic_dump "$@"
+4
View File
@@ -78,6 +78,10 @@ fpath=($ZSH/{functions,completions} $ZSH_CUSTOM/{functions,completions} $fpath)
# Load all stock functions (from $fpath files) called below. # Load all stock functions (from $fpath files) called below.
autoload -U compaudit compinit zrecompile autoload -U compaudit compinit zrecompile
# The omz CLI and omz_diagnostic_dump are loaded on first use; -z keeps
# zsh-style loading under kshautoload so the trailing call runs once
autoload -Uz omz omz_diagnostic_dump
is_plugin() { is_plugin() {
local base_dir=$1 local base_dir=$1
local name=$2 local name=$2
+1 -2
View File
@@ -35,8 +35,7 @@ plugins=(... aws)
* `aws_change_access_key`: changes the AWS access key of a profile. * `aws_change_access_key`: changes the AWS access key of a profile.
* `aws_profiles`: lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`) and * `aws_profiles`: lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`).
`$AWS_SHARED_CREDENTIALS_FILE` (default: `~/.aws/credentials`).
Used to provide completion for the `asp` function. Used to provide completion for the `asp` function.
* `aws_regions`: lists the available regions. * `aws_regions`: lists the available regions.
+5 -43
View File
@@ -42,7 +42,7 @@ function asp() {
export AWS_PROFILE=$1 export AWS_PROFILE=$1
export AWS_EB_PROFILE=$1 export AWS_EB_PROFILE=$1
export AWS_PROFILE_REGION=$(_aws_profile_region "$1") export AWS_PROFILE_REGION=$(aws configure get region)
_aws_update_state _aws_update_state
@@ -239,47 +239,9 @@ function aws_regions() {
} }
function aws_profiles() { function aws_profiles() {
emulate -L zsh aws --no-cli-pager configure list-profiles 2> /dev/null && return
local config="${AWS_CONFIG_FILE:-$HOME/.aws/config}" [[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1
local creds="${AWS_SHARED_CREDENTIALS_FILE:-$HOME/.aws/credentials}" command grep -Eo '^[[:space:]]*\[[[:space:]]*(profile[[:space:]]+)?[^][:space:]]+[[:space:]]*\]' "${AWS_CONFIG_FILE:-$HOME/.aws/config}" | command sed -E 's/^[[:space:]]*\[[[:space:]]*(profile[[:space:]]+)?([^][:space:]]+)[[:space:]]*\]$/\2/'
# Read the files directly; the AWS CLI is slow to start
if [[ ! -r "$config" && ! -r "$creds" ]]; then
aws --no-cli-pager configure list-profiles 2> /dev/null
return
fi
local line words
# Only read the section headers, so the credentials never enter the shell
for line in "${(@f)$(command grep -h '^[[:space:]]*\[' -- "$config" "$creds" 2> /dev/null)}"; do
line=${line#*\[} # drop up to the first [
line=${line%\]*} # drop from the last ] (comments, CR)
words=(${=line})
if (( $#words == 1 )); then
print -r -- $words[1] # [default], or [foo] in the credentials file
elif (( $#words == 2 )) && [[ $words[1] == profile ]]; then
print -r -- $words[2]
fi
done | command sort -u
}
# Read a profile's region from the config file, falling back to the AWS CLI
function _aws_profile_region() {
emulate -L zsh
local config="${AWS_CONFIG_FILE:-$HOME/.aws/config}" line words in_profile
if [[ -r "$config" ]]; then
# Only read headers and region lines, so any credentials never enter the shell
for line in "${(@f)$(command grep -e '\[' -e region -- "$config" 2> /dev/null)}"; do
line=${line%$'\r'}
words=(${=line//[\[\]=]/ }) # "[profile foo]" -> (profile foo), "region = x" -> (region x)
if [[ ${${=line}[1]} == \[* ]]; then # header, possibly indented
in_profile=
[[ "$words" == "profile $1" || ( $1 == default && "$words" == default ) ]] && in_profile=1
elif [[ -n $in_profile && $words[1] == region ]]; then
print -r -- $words[2]
return
fi
done
fi
aws configure get region
} }
function _aws_regions() { function _aws_regions() {
@@ -323,7 +285,7 @@ if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
export AWS_PROFILE="$AWS_DEFAULT_PROFILE" export AWS_PROFILE="$AWS_DEFAULT_PROFILE"
export AWS_EB_PROFILE="$AWS_DEFAULT_PROFILE" export AWS_EB_PROFILE="$AWS_DEFAULT_PROFILE"
test -z "${aws_state[2]}" && AWS_REGION=$(_aws_profile_region "$AWS_PROFILE") test -z "${aws_state[2]}" && AWS_REGION=$(aws configure get region)
export AWS_REGION=${AWS_REGION:-$aws_state[2]} export AWS_REGION=${AWS_REGION:-$aws_state[2]}
export AWS_DEFAULT_REGION="$AWS_REGION" export AWS_DEFAULT_REGION="$AWS_REGION"
-1
View File
@@ -90,7 +90,6 @@ colorize_less() {
# (e.g. when not scrolled to the bottom) while already the next file will be displayed. # (e.g. when not scrolled to the bottom) while already the next file will be displayed.
local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \ local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \
ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \ ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \
ZSH_COLORIZE_CHROMA_FORMATTER=$ZSH_COLORIZE_CHROMA_FORMATTER \
colorize_cat %s 2> /dev/null'" colorize_cat %s 2> /dev/null'"
# LESSCLOSE will be set to prevent any errors by executing a user script # LESSCLOSE will be set to prevent any errors by executing a user script
-1
View File
@@ -84,7 +84,6 @@ If you use Podman's Docker wrapper, you need to enable legacy completion. See ab
| dtop | `docker top` | Display the running processes of a container | | dtop | `docker top` | Display the running processes of a container |
| dvi | `docker volume inspect` | Display detailed information about one or more volumes | | dvi | `docker volume inspect` | Display detailed information about one or more volumes |
| dvls | `docker volume ls` | List all the volumes known to docker | | dvls | `docker volume ls` | List all the volumes known to docker |
| dvrm | `docker volume rm` | Remove one or more volumes |
| dvprune | `docker volume prune` | Cleanup dangling volumes | | dvprune | `docker volume prune` | Cleanup dangling volumes |
| dxc | `docker container exec` | Run a new command in a running container | | dxc | `docker container exec` | Run a new command in a running container |
| dxcit | `docker container exec -it` | Run a new command in a running container in an interactive shell | | dxcit | `docker container exec -it` | Run a new command in a running container in an interactive shell |
-1
View File
@@ -35,7 +35,6 @@ alias dsts='docker stats'
alias dtop='docker top' alias dtop='docker top'
alias dvi='docker volume inspect' alias dvi='docker volume inspect'
alias dvls='docker volume ls' alias dvls='docker volume ls'
alias dvrm='docker volume rm'
alias dvprune='docker volume prune' alias dvprune='docker volume prune'
alias dxc='docker container exec' alias dxc='docker container exec'
alias dxcit='docker container exec -it' alias dxcit='docker container exec -it'
+3 -34
View File
@@ -135,40 +135,9 @@ EOF
(*.deb) (*.deb)
command mkdir -p "control" "data" command mkdir -p "control" "data"
ar vx "$full_path" > /dev/null ar vx "$full_path" > /dev/null
local member= dest= failed=0 builtin cd -q control; extract ../control.tar.*
for member in control.tar.* data.tar.*; do builtin cd -q ../data; extract ../data.tar.*
dest="${member%%.*}" builtin cd -q ..; command rm *.tar.* debian-binary ;;
case "${member:l}" in
(*.tar.gz)
(( $+commands[pigz] )) && { tar -I pigz -xvf "$member" -C "$dest" } \
|| tar zxvf "$member" -C "$dest" ;;
(*.tar.bz2)
(( $+commands[pbzip2] )) && { tar -I pbzip2 -xvf "$member" -C "$dest" } \
|| tar xvjf "$member" -C "$dest" ;;
(*.tar.xz)
# .deb members are small, so skip extract()'s pixz fast path and
# let tar use its built-in xz support (or a plain pipe).
tar --xz --help &> /dev/null \
&& tar --xz -xvf "$member" -C "$dest" \
|| xzcat "$member" | tar xvf - -C "$dest" ;;
(*.tar.zst)
tar --zstd --help &> /dev/null \
&& tar --zstd -xvf "$member" -C "$dest" \
|| zstdcat "$member" | tar xvf - -C "$dest" ;;
(*.tar)
tar xvf "$member" -C "$dest" ;;
(*)
echo "extract: cannot extract unexpected .deb member '$member'" >&2
failed=1
success=1 ;;
esac
done
if (( failed )); then
# Keep the archive members so the unexpected one can be inspected.
echo "extract: leaving .deb members in place" >&2
else
command rm *.tar.* debian-binary
fi ;;
(*.zst) unzstd --stdout "$full_path" > "${file:t:r}" ;; (*.zst) unzstd --stdout "$full_path" > "${file:t:r}" ;;
(*.cab|*.exe) cabextract "$full_path" ;; (*.cab|*.exe) cabextract "$full_path" ;;
(*.cpio|*.obscpio) cpio -idmvF "$full_path" ;; (*.cpio|*.obscpio) cpio -idmvF "$full_path" ;;
+1 -120
View File
@@ -4,7 +4,7 @@
emulate -L zsh emulate -L zsh
setopt err_return setopt err_return
for tool in ar lzma unlzma uncompress; do for tool in lzma unlzma uncompress; do
(( $+commands[$tool] )) || { (( $+commands[$tool] )) || {
print -u2 -r -- "These tests require $tool." print -u2 -r -- "These tests require $tool."
exit 1 exit 1
@@ -46,120 +46,6 @@ check_extract() {
print -r -- "PASS: $extension ($mode)" print -r -- "PASS: $extension ($mode)"
} }
# Extracting a .deb must place the control members directly in <name>/control
# and the data members directly in <name>/data, whatever their member count.
check_deb_extract() {
local mode=$1
local case_dir="$test_dir/deb-$mode"
mkdir -p "$case_dir/source files" "$case_dir/work/target dir" \
"$case_dir/src/ctl" "$case_dir/src/data/usr/bin"
print -r -- "postinst script" > "$case_dir/src/ctl/postinst"
print -r -- "conf:1" > "$case_dir/src/ctl/conffiles"
print -r -- "app main" > "$case_dir/src/data/usr/bin/app"
tar czf "$case_dir/src/control.tar.gz" -C "$case_dir/src/ctl" conffiles postinst
tar czf "$case_dir/src/data.tar.gz" -C "$case_dir/src/data" usr
print -r -- "2.0" > "$case_dir/src/debian-binary"
(
builtin cd "$case_dir/src"
rm -f "$case_dir/source files/pkg.deb"
ar rS "$case_dir/source files/pkg.deb" debian-binary control.tar.gz data.tar.gz
)
local archive="$case_dir/source files/pkg.deb"
builtin cd "$case_dir/work"
local base="$PWD/pkg"
local -a args
case "$mode" in
target)
args=(-t 'target dir')
base="$PWD/target dir/pkg"
;;
remove) args=(-r) ;;
esac
() {
emulate -L zsh
extract "${args[@]}" "$archive"
} || return 1
[[ -f "$base/control/conffiles" && -f "$base/control/postinst" ]] ||
{ print -u2 -r -- "$mode: control members not extracted into $base/control"; return 1 }
[[ -f "$base/data/usr/bin/app" ]] ||
{ print -u2 -r -- "$mode: data members not extracted into $base/data"; return 1 }
[[ ! -d "$base/control/control" && ! -d "$base/data/data" ]] ||
{ print -u2 -r -- "$mode: deb extraction double-nested the member directories"; return 1 }
[[ ! -e "$base/control.tar.gz" && ! -e "$base/data.tar.gz" && ! -e "$base/debian-binary" ]] ||
{ print -u2 -r -- "$mode: deb member debris left behind"; return 1 }
if [[ $mode == remove ]]; then
[[ ! -e $archive ]]
else
[[ -f $archive ]]
fi
print -r -- "PASS: deb ($mode)"
}
# An unexpected member must be reported and left on disk for inspection, and
# the cleanup must not delete the other members around it either.
check_deb_unexpected_member() {
local case_dir="$test_dir/deb-unexpected"
mkdir -p "$case_dir/src/ctl" "$case_dir/src/data/usr/bin"
print -r -- "postinst script" > "$case_dir/src/ctl/postinst"
print -r -- "app main" > "$case_dir/src/data/usr/bin/app"
tar czf "$case_dir/src/control.tar.gz" -C "$case_dir/src/ctl" postinst
print -r -- "unknown compression" > "$case_dir/src/control.tar.weird"
tar czf "$case_dir/src/data.tar.gz" -C "$case_dir/src/data" usr
print -r -- "2.0" > "$case_dir/src/debian-binary"
(
builtin cd "$case_dir/src"
ar rS "$case_dir/pkg.deb" debian-binary control.tar.weird data.tar.gz
)
builtin cd "$case_dir"
() {
emulate -L zsh
extract "$case_dir/pkg.deb"
} || return 1
[[ -f "$case_dir/pkg/data/usr/bin/app" ]] ||
{ print -u2 -r -- "deb-unexpected: known members were not extracted"; return 1 }
[[ -f "$case_dir/pkg/control.tar.weird" && -f "$case_dir/pkg/data.tar.gz" &&
-f "$case_dir/pkg/debian-binary" ]] ||
{ print -u2 -r -- "deb-unexpected: archive members were deleted"; return 1 }
print -r -- "PASS: deb (unexpected member)"
}
# Passing more than one .deb in a single call must not leak the loop variables
# between archives; the stale `member`/`dest` locals used to be printed by the
# second archive.
check_deb_multiple() {
local case_dir="$test_dir/deb-multiple"
mkdir -p "$case_dir/src/ctl" "$case_dir/src/data/usr/bin"
print -r -- "postinst script" > "$case_dir/src/ctl/postinst"
print -r -- "app main" > "$case_dir/src/data/usr/bin/app"
tar czf "$case_dir/src/control.tar.gz" -C "$case_dir/src/ctl" postinst
tar czf "$case_dir/src/data.tar.gz" -C "$case_dir/src/data" usr
print -r -- "2.0" > "$case_dir/src/debian-binary"
(
builtin cd "$case_dir/src"
ar rS "$case_dir/one.deb" debian-binary control.tar.gz data.tar.gz
ar rS "$case_dir/two.deb" debian-binary control.tar.gz data.tar.gz
)
builtin cd "$case_dir"
local output
output=$( () {
emulate -L zsh
extract one.deb two.deb
} 2>&1 ) || return 1
[[ $output != *member=* && $output != *dest=* ]] ||
{ print -u2 -r -- "deb-multiple: stale loop variables were printed"; return 1 }
[[ -f one/control/postinst && -f one/data/usr/bin/app &&
-f two/control/postinst && -f two/data/usr/bin/app ]] ||
{ print -u2 -r -- "deb-multiple: both archives were not extracted"; return 1 }
print -r -- "PASS: deb (multiple archives)"
}
{ {
print -r -- hello > "$test_dir/plain" print -r -- hello > "$test_dir/plain"
lzma -c "$test_dir/plain" > "$test_dir/fixture.lzma" lzma -c "$test_dir/plain" > "$test_dir/fixture.lzma"
@@ -172,11 +58,6 @@ check_deb_multiple() {
check_extract "$extension" "$mode" check_extract "$extension" "$mode"
done done
done done
check_deb_extract default
check_deb_extract target
check_deb_extract remove
check_deb_unexpected_member
check_deb_multiple
print 'All extract compressed-file tests passed.' print 'All extract compressed-file tests passed.'
} always { } always {
builtin cd "$original_dir" builtin cd "$original_dir"
-15
View File
@@ -1,15 +0,0 @@
# fnox
Adds shell integration and completions for [fnox](https://github.com/jdx/fnox), a tool for provider-agnostic secret injection.
## Installation
[Install fnox](https://fnox.jdx.dev/guide/quick-start.html), then add it to your plugins in `~/.zshrc`:
```zsh
plugins=(fnox)
```
## Usage
See the [fnox documentation](https://fnox.jdx.dev/guide/shell-integration.html) for shell integration and usage.
-23
View File
@@ -1,23 +0,0 @@
if (( ! $+commands[fnox] )); then
# if we don't have fnox at all just bail out
return
fi
eval "$(fnox activate zsh)"
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `fnox`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_fnox" ]]; then
typeset -g -A _comps
autoload -Uz _fnox
_comps[fnox]=_fnox
fi
# Regenerate completions when the executable changes.
if [[ ! -s "$ZSH_CACHE_DIR/completions/_fnox" || "$commands[fnox]" -nt "$ZSH_CACHE_DIR/completions/_fnox" ]]; then
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._fnox"
zf_mv -f -- =( fnox completion zsh ) "$ZSH_CACHE_DIR/completions/_fnox"
} &|
fi
+2 -6
View File
@@ -12,7 +12,7 @@ plugins=(... git-commit)
## Syntax ## Syntax
```zsh ```zsh
git <type> [(-s, --scope) "<scope>"] [(-a, --attention)] [(-b, --body) "<body>"] "<message>" git <type> [(-s, --scope) "<scope>"] [(-a, --attention)] "<message>"
``` ```
Where `type` is one of the following: Where `type` is one of the following:
@@ -30,9 +30,6 @@ Where `type` is one of the following:
- `test` - `test`
- `wip` - `wip`
The optional `-b` / `--body` becomes the commit body (a blank line after the subject), as defined by
[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#summary).
> NOTE: the subcommand for `revert` type is `rev`, as otherwise it conflicts with the > NOTE: the subcommand 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 > git command of the same name. It will still generate a commit message in the format
> `revert: <message>` > `revert: <message>`
@@ -42,7 +39,6 @@ The optional `-b` / `--body` becomes the commit body (a blank line after the sub
| Git subcommand | Command | | Git subcommand | Command |
| --------------------------------------------- | ---------------------------------------------------- | | --------------------------------------------- | ---------------------------------------------------- |
| `git style "remove trailing whitespace"` | `git commit -m "style: remove trailing whitespace"` | | `git style "remove trailing whitespace"` | `git commit -m "style: remove trailing whitespace"` |
| `git wip "work in progress"` | `git commit -m "wip: work in progress"` | | `git wip "work in progress"` | `git commit -m "work in progress"` |
| `git fix -s "router" "correct redirect link"` | `git commit -m "fix(router): correct redirect link"` | | `git fix -s "router" "correct redirect link"` | `git commit -m "fix(router): correct redirect link"` |
| `git rev -s "api" "rollback v2"` | `git commit -m "revert(api): rollback v2"` | | `git rev -s "api" "rollback v2"` | `git commit -m "revert(api): rollback v2"` |
| `git feat -s "auth" -b "Keep session across redirects." "add login redirect"` | `git commit -m "feat(auth): add login redirect" -m "Keep session across redirects."` |
+3 -11
View File
@@ -12,11 +12,11 @@ _omz_git_commit() {
if [[ "$_type" == rev ]]; then if [[ "$_type" == rev ]]; then
_type=revert _type=revert
fi fi
local _scope _attention _message _body local _scope _attention _message
while [ $# -ne 0 ]; do while [ $# -ne 0 ]; do
case $1 in case $1 in
-s | --scope ) -s | --scope )
if [ -z "$2" ]; then if [ -z $2 ]; then
echo >&2 "Missing scope!" echo >&2 "Missing scope!"
return 1 return 1
fi fi
@@ -27,20 +27,12 @@ _omz_git_commit() {
_attention="!" _attention="!"
shift 1 shift 1
;; ;;
-b | --body )
if [ -z "$2" ]; then
echo >&2 "Missing body!"
return 1
fi
_body="$2"
shift 2
;;
* ) * )
_message="${_message} $1" _message="${_message} $1"
shift 1 shift 1
;; ;;
esac esac
done done
git commit -m "${_type}${_scope:+(${_scope})}${_attention}:${_message}" ${_body:+-m} ${_body:+"$_body"} git commit -m "${_type}${_scope:+(${_scope})}${_attention}:${_message}"
} }
_omz_git_commit "$@" _omz_git_commit "$@"
+1 -1
View File
@@ -21,7 +21,7 @@ plugins=(... git)
| `gapa` | `git add --patch` | | `gapa` | `git add --patch` |
| `gau` | `git add --update` | | `gau` | `git add --update` |
| `gav` | `git add --verbose` | | `gav` | `git add --verbose` |
| `gwip` | `git add -A; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"` | | `gwip` | `git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"` |
| `gam` | `git am` | | `gam` | `git am` |
| `gama` | `git am --abort` | | `gama` | `git am --abort` |
| `gamc` | `git am --continue` | | `gamc` | `git am --continue` |
+1 -1
View File
@@ -119,7 +119,7 @@ alias gaa='git add --all'
alias gapa='git add --patch' alias gapa='git add --patch'
alias gau='git add --update' alias gau='git add --update'
alias gav='git add --verbose' alias gav='git add --verbose'
alias gwip='git add -A; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"' alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"'
alias gam='git am' alias gam='git am'
alias gama='git am --abort' alias gama='git am --abort'
alias gamc='git am --continue' alias gamc='git am --continue'
-31
View File
@@ -112,37 +112,6 @@ plugins=(... hcloud)
| hcst | `hcloud server-type list` | List all server types | | hcst | `hcloud server-type list` | List all server types |
| hcit | `hcloud image list --type system` | List all system images | | hcit | `hcloud image list --type system` | List all system images |
## Prompt function
This plugin provides `hcloud_prompt_info` which can be added to your prompt to display the current Hetzner Cloud context.
- If `HCLOUD_TOKEN` environment variable is set, it displays `HCLOUD_TOKEN` (indicating direct token usage)
- Otherwise, it displays the active context name
### Usage
Add `$(hcloud_prompt_info)` to your `PROMPT` or `RPROMPT` in your `.zshrc`:
```zsh
RPROMPT='$(hcloud_prompt_info)'
```
### Theme variables
| Variable | Default | Description |
| :----------------------------- | :-------------- | :----------------------------------------------- |
| `ZSH_THEME_HCLOUD_PREFIX` | `<hcloud:` | Prefix before the context name |
| `ZSH_THEME_HCLOUD_SUFFIX` | `>` | Suffix after the context name |
| `ZSH_THEME_HCLOUD_TOKEN_TEXT` | `HCLOUD_TOKEN` | Text shown when `HCLOUD_TOKEN` env var is set |
### Example with custom styling
```zsh
ZSH_THEME_HCLOUD_PREFIX="%{$fg[blue]%}hcloud:("
ZSH_THEME_HCLOUD_SUFFIX=")%{$reset_color%}"
RPROMPT='$(hcloud_prompt_info)'
```
## Requirements ## Requirements
This plugin requires the [Hetzner Cloud CLI](https://github.com/hetznercloud/cli) to be installed. This plugin requires the [Hetzner Cloud CLI](https://github.com/hetznercloud/cli) to be installed.
-17
View File
@@ -131,20 +131,3 @@ alias hcdc='hcloud datacenter list'
alias hcloc='hcloud location list' alias hcloc='hcloud location list'
alias hcst='hcloud server-type list' alias hcst='hcloud server-type list'
alias hcit='hcloud image list --type system' alias hcit='hcloud image list --type system'
# Prompt function to display current hcloud context
# Usage: add $(hcloud_prompt_info) to your PROMPT or RPROMPT
function hcloud_prompt_info() {
# Check if HCLOUD_TOKEN is set (overrides context)
if [[ -n "$HCLOUD_TOKEN" ]]; then
echo "${ZSH_THEME_HCLOUD_PREFIX=<hcloud:}${ZSH_THEME_HCLOUD_TOKEN_TEXT=HCLOUD_TOKEN}${ZSH_THEME_HCLOUD_SUFFIX=>}"
return
fi
# Get active context
local context
context=$(hcloud context active 2>/dev/null)
[[ -n "$context" ]] || return
echo "${ZSH_THEME_HCLOUD_PREFIX=<hcloud:}${context}${ZSH_THEME_HCLOUD_SUFFIX=>}"
}
-14
View File
@@ -80,17 +80,3 @@ zstyle ':omz:plugins:laravel' php 'herd php'
| `paqr` | `php artisan queue:retry` | | `paqr` | `php artisan queue:retry` |
| `paqt` | `php artisan queue:table` | | `paqt` | `php artisan queue:table` |
| `paqw` | `php artisan queue:work` | | `paqw` | `php artisan queue:work` |
## Modules
Aliases for [nWidart/laravel-modules](https://github.com/nWidart/laravel-modules).
| Alias | Description |
|:-:|:-:|
| `pamol` | `php artisan module:list` |
| `pamomk` | `php artisan module:make` |
| `pamoe` | `php artisan module:enable` |
| `pamod` | `php artisan module:disable` |
| `pamom` | `php artisan module:migrate` |
| `pamomr` | `php artisan module:migrate-rollback` |
| `pamos` | `php artisan module:seed` |
-9
View File
@@ -53,13 +53,4 @@ alias paqr="$_omz_laravel_php artisan queue:retry"
alias paqt="$_omz_laravel_php artisan queue:table" alias paqt="$_omz_laravel_php artisan queue:table"
alias paqw="$_omz_laravel_php artisan queue:work" alias paqw="$_omz_laravel_php artisan queue:work"
# Modules (nWidart/laravel-modules)
alias pamol="$_omz_laravel_php artisan module:list"
alias pamomk="$_omz_laravel_php artisan module:make"
alias pamoe="$_omz_laravel_php artisan module:enable"
alias pamod="$_omz_laravel_php artisan module:disable"
alias pamom="$_omz_laravel_php artisan module:migrate"
alias pamomr="$_omz_laravel_php artisan module:migrate-rollback"
alias pamos="$_omz_laravel_php artisan module:seed"
unset _omz_laravel_php unset _omz_laravel_php
-1
View File
@@ -30,7 +30,6 @@ man-command-line() {
else else
BUFFER="man ${args[1]}" BUFFER="man ${args[1]}"
fi fi
zle end-of-line
} }
zle -N man-command-line zle -N man-command-line
-2
View File
@@ -30,8 +30,6 @@ if it's found, or the mvn command otherwise.
| `mvncisto` | `mvn clean install -DskipTests --offline` | | `mvncisto` | `mvn clean install -DskipTests --offline` |
| `mvncom` | `mvn compile` | | `mvncom` | `mvn compile` |
| `mvncp` | `mvn clean package` | | `mvncp` | `mvn clean package` |
| `mvncpst` | `mvn clean package -DskipTests` |
| `mvncpsto` | `mvn clean package -DskipTests --offline` |
| `mvnct` | `mvn clean test` | | `mvnct` | `mvn clean test` |
| `mvncv` | `mvn clean verify` | | `mvncv` | `mvn clean verify` |
| `mvncvst` | `mvn clean verify -DskipTests` | | `mvncvst` | `mvn clean verify -DskipTests` |
-2
View File
@@ -59,8 +59,6 @@ alias mvncist='mvn clean install -DskipTests'
alias mvncisto='mvn clean install -DskipTests --offline' alias mvncisto='mvn clean install -DskipTests --offline'
alias mvncom='mvn compile' alias mvncom='mvn compile'
alias mvncp='mvn clean package' alias mvncp='mvn clean package'
alias mvncpst='mvn clean package -DskipTests'
alias mvncpsto='mvn clean package -DskipTests --offline'
alias mvnct='mvn clean test' alias mvnct='mvn clean test'
alias mvncv='mvn clean verify' alias mvncv='mvn clean verify'
alias mvncvst='mvn clean verify -DskipTests' alias mvncvst='mvn clean verify -DskipTests'
+1 -1
View File
@@ -1,7 +1,7 @@
# Pre-commit plugin # Pre-commit plugin
This plugin adds aliases for common commands of [pre-commit](https://pre-commit.com/). This plugin adds aliases for common commands of [pre-commit](https://pre-commit.com/).
It also supports [prek](https://github.com/j178/prek) as a drop-in replacement. It also supports [prek](https://github.com/prek/prek) as a drop-in replacement.
If `prek` is available, it will be used; otherwise, `pre-commit` is used as fallback. If `prek` is available, it will be used; otherwise, `pre-commit` is used as fallback.
To use this plugin, add it to the plugins array in your zshrc file: To use this plugin, add it to the plugins array in your zshrc file:
-2
View File
@@ -34,8 +34,6 @@ virtual environments:
`<venv-name>/bin/activate`, and automatically deactivate it when navigating out of it (keeps venv activated `<venv-name>/bin/activate`, and automatically deactivate it when navigating out of it (keeps venv activated
in subdirectories). in subdirectories).
- To enable the feature, set `PYTHON_AUTO_VRUN=true` before sourcing oh-my-zsh. - To enable the feature, set `PYTHON_AUTO_VRUN=true` before sourcing oh-my-zsh.
- To also search parent directories (useful for monorepos), set `PYTHON_AUTO_VRUN_RECURSIVE=true` as well.
The search stops before `$HOME`, so a venv in your home directory is not activated in every folder under it.
- The plugin activates the first existing virtual environment, in order, appearing in `$PYTHON_VENV_NAMES`. - The plugin activates the first existing virtual environment, in order, appearing in `$PYTHON_VENV_NAMES`.
The default virtual environment name is `venv`. To use a different name, set The default virtual environment name is `venv`. To use a different name, set
`PYTHON_VENV_NAME=<venv-name>`. For example: `PYTHON_VENV_NAME=".venv"` `PYTHON_VENV_NAME=<venv-name>`. For example: `PYTHON_VENV_NAME=".venv"`
+1 -16
View File
@@ -113,23 +113,8 @@ if [[ "$PYTHON_AUTO_VRUN" == "true" ]]; then
# make sure we're not in a venv already # make sure we're not in a venv already
(( $+functions[deactivate] )) && deactivate > /dev/null 2>&1 (( $+functions[deactivate] )) && deactivate > /dev/null 2>&1
source $file > /dev/null 2>&1 source $file > /dev/null 2>&1
return break
done done
# Search parent directories if recursive mode is enabled, stopping before $HOME
if [[ "$PYTHON_AUTO_VRUN_RECURSIVE" == "true" ]]; then
local search_dir="$PWD:h"
while [[ "$search_dir" != "/" && "$search_dir" != "." && "$search_dir" != "$HOME" ]]; do
for file in "${search_dir}/"${^PYTHON_VENV_NAMES[@]}"/bin/activate"(N.); do
# the venv found is already active
[[ "${file:h:h:A}" == "${VIRTUAL_ENV:A}" ]] && return
(( $+functions[deactivate] )) && deactivate > /dev/null 2>&1
source $file > /dev/null 2>&1
return
done
search_dir="${search_dir:h}"
done
fi
fi fi
} }
add-zsh-hook chpwd auto_vrun add-zsh-hook chpwd auto_vrun
+1 -23
View File
@@ -24,7 +24,7 @@ plugins=(... systemd)
| `sc-show-environment` | `systemctl show-environment` | Dump the systemd manager environment block | | `sc-show-environment` | `systemctl show-environment` | Dump the systemd manager environment block |
| `sc-cat` | `systemctl cat` | Show backing files of one or more units | | `sc-cat` | `systemctl cat` | Show backing files of one or more units |
| `sc-list-timers` | `systemctl list-timers` | List timer units currently in memory | | `sc-list-timers` | `systemctl list-timers` | List timer units currently in memory |
| **Privileged aliases** ||| | **Aliases with sudo** |||
| `sc-start` | `sudo systemctl start` | Start Unit(s) | | `sc-start` | `sudo systemctl start` | Start Unit(s) |
| `sc-stop` | `sudo systemctl stop` | Stop Unit(s) | | `sc-stop` | `sudo systemctl stop` | Stop Unit(s) |
| `sc-reload` | `sudo systemctl reload` | Reload Unit(s) | | `sc-reload` | `sudo systemctl reload` | Reload Unit(s) |
@@ -50,28 +50,6 @@ plugins=(... systemd)
| `sc-disable-now` | `sudo systemctl disable --now` | Disable and stop unit(s) | | `sc-disable-now` | `sudo systemctl disable --now` | Disable and stop unit(s) |
| `sc-mask-now` | `sudo systemctl mask --now` | Mask and stop unit(s) | | `sc-mask-now` | `sudo systemctl mask --now` | Mask and stop unit(s) |
### Privileged aliases
systemd plugin supports alternative privilege elevation tools. You can prepend an arbitrary string,
replacing `sudo`, to the privileged aliases by setting `$ZSH_SYSTEMD_SUDO` variable. You can leave
authorization to systemd by setting `$ZSH_SYSTEMD_SUDO` to an empty string.
To use `doas` as your elevation tool you will need to add the following line to your zshrc;
```zsh
ZSH_SYSTEMD_SUDO="doas"
```
After shell restart, you will see that alias for `sc-enable` is changed:
```sh
$ which sc-enable
sc-enable: aliased to doas systemctl enable
```
These aliases are evaluated during oh-my-zsh startup, and can't be changed interactively (you will
need to restart shell to see changes).
### User aliases ### User aliases
You can use the above aliases as `--user` by using the prefix `scu` instead of `sc`. You can use the above aliases as `--user` by using the prefix `scu` instead of `sc`.
+2 -13
View File
@@ -67,27 +67,15 @@ power_commands=(
suspend suspend
) )
if ! [[ -v ZSH_SYSTEMD_SUDO ]]; then
ZSH_SYSTEMD_SUDO="sudo"
fi
for c in $user_commands; do for c in $user_commands; do
alias "sc-$c"="systemctl $c" alias "sc-$c"="systemctl $c"
alias "scu-$c"="systemctl --user $c" alias "scu-$c"="systemctl --user $c"
done done
# Avoids leading space in alias when using polkit
if [[ -n "${ZSH_SYSTEMD_SUDO}" ]]; then
for c in $sudo_commands; do for c in $sudo_commands; do
alias "sc-$c"="$ZSH_SYSTEMD_SUDO systemctl $c" alias "sc-$c"="sudo systemctl $c"
alias "scu-$c"="systemctl --user $c" alias "scu-$c"="systemctl --user $c"
done done
else
for c in $sudo_commands; do
alias "sc-$c"="systemctl $c"
alias "scu-$c"="systemctl --user $c"
done
fi
for c in $power_commands; do for c in $power_commands; do
alias "sc-$c"="systemctl $c" alias "sc-$c"="systemctl $c"
@@ -95,6 +83,7 @@ done
unset c user_commands sudo_commands power_commands unset c user_commands sudo_commands power_commands
# --now commands # --now commands
alias sc-enable-now="sc-enable --now" alias sc-enable-now="sc-enable --now"
alias sc-disable-now="sc-disable --now" alias sc-disable-now="sc-disable --now"
-20
View File
@@ -1,20 +0,0 @@
# talosctl plugin
This plugin adds completion for the [talosctl](https://docs.siderolabs.com/talos/v1.12/learn-more/talosctl) CLI for managing [Talos](https://github.com/siderolabs/talos) Linux.
To use it, add `talosctl` to the plugins array in your zshrc file:
```zsh
plugins=(... talosctl)
```
This plugin does not add any aliases.
## Cache
This plugin caches the completion script and is automatically updated asynchronously when the plugin is
loaded, which is usually when you start up a new terminal emulator.
The cache is stored at:
- `$ZSH_CACHE/completions/_talosctl` completions script
-18
View File
@@ -1,18 +0,0 @@
# Autocompletion for talosctl
if (( ! $+commands[talosctl] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `talosctl`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_talosctl" ]]; then
typeset -g -A _comps
autoload -Uz _talosctl
_comps[talosctl]=_talosctl
fi
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._talosctl"
zf_mv -f -- =( talosctl completion zsh ) "$ZSH_CACHE_DIR/completions/_talosctl"
} &|
-53
View File
@@ -1,53 +0,0 @@
# Terragrunt plugin
Terragrunt is a thin wrapper for opentofu/terraform that provides extra tools
and features to enhance the management of Infrastructure as Code (IaC) using
opentofu/terraform. This plugin adds completion for `terragrunt` command, as well
as aliases and a prompt function.
To use it, add `terragrunt` to the plugins array of your `~/.zshrc` file:
```shell
plugins=(... terragrunt)
```
## Requirements
- [Terragrunt](https://docs.terragrunt.com/) v0.77.22 or later
## Aliases
| Alias | Command |
| ------ | ----------------------------------------- |
| `tg` | `terragrunt` |
| `tga` | `terragrunt run -- apply` |
| `tgaa` | `terragrunt run -- apply -auto-approve` |
| `tgc` | `terragrunt run -- console` |
| `tgd` | `terragrunt run -- destroy` |
| `tgd!` | `terragrunt run -- destroy -auto-approve` |
| `tgi` | `terragrunt run -- init` |
| `tgo` | `terragrunt run -- output` |
| `tgp` | `terragrunt run -- plan` |
| `tgv` | `terragrunt run -- validate` |
| `tgs` | `terragrunt run -- state` |
| `tgsh` | `terragrunt run -- show` |
| `tgr` | `terragrunt run -- refresh` |
| `tgt` | `terragrunt run -- test` |
| `tgws` | `terragrunt run -- workspace` |
## Prompt function
- `terragrunt_version_prompt_info` shows the current version of the `terragrunt` command.
To use it, add it to a `PROMPT` or `RPROMPT` variable in your theme or `.zshrc` file.
```sh
RPROMPT='$(terragrunt_version_prompt_info)'
```
You can also specify the PREFIX and SUFFIX strings with the following variables.
```sh
ZSH_THEME_TERRAGRUNT_VERSION_PROMPT_PREFIX="%{$fg[white]%}"
ZSH_THEME_TERRAGRUNT_VERSION_PROMPT_SUFFIX="%{$reset_color%}"
```
-27
View File
@@ -1,27 +0,0 @@
# set up the terragrunt completion (compatible for zsh)
autoload -Uz bashcompinit && bashcompinit
complete -C terragrunt terragrunt
# terragrunt version prompt function
function terragrunt_version_prompt_info() {
# get the output of `terragrunt --version` in a single line, and get the third word after splitting by a space
local terragrunt_version=${${(s: :)$(terragrunt --version)}[3]}
# make sure to escape % signs in the version string to prevent command injection
echo "${ZSH_THEME_TERRAGRUNT_VERSION_PROMPT_PREFIX-[}${terragrunt_version:gs/%/%%}${ZSH_THEME_TERRAGRUNT_VERSION_PROMPT_SUFFIX-]}"
}
alias tg='terragrunt'
alias tga='terragrunt run -- apply'
alias tgaa='terragrunt run -- apply -auto-approve'
alias tgc='terragrunt run -- console'
alias tgd='terragrunt run -- destroy'
alias tgd!='terragrunt run -- destroy -auto-approve'
alias tgi='terragrunt run -- init'
alias tgo='terragrunt run -- output'
alias tgp='terragrunt run -- plan'
alias tgv='terragrunt run -- validate'
alias tgs='terragrunt run -- state'
alias tgsh='terragrunt run -- show'
alias tgr='terragrunt run -- refresh'
alias tgt='terragrunt run -- test'
alias tgws='terragrunt run -- workspace'
-1
View File
@@ -11,7 +11,6 @@ tldr-command-line() {
args=(${${(Az)BUFFER}[1]} ${${(Az)BUFFER}[2]}) args=(${${(Az)BUFFER}[1]} ${${(Az)BUFFER}[2]})
BUFFER="tldr ${args[1]}" BUFFER="tldr ${args[1]}"
zle end-of-line
} }
zle -N tldr-command-line zle -N tldr-command-line
+1 -1
View File
@@ -22,7 +22,7 @@ plugins=(... uv)
| uvlu | `uv lock --upgrade` | Lock the dependencies to the newest compatible versions | | uvlu | `uv lock --upgrade` | Lock the dependencies to the newest compatible versions |
| uvp | `uv pip` | Manage pip packages | | uvp | `uv pip` | Manage pip packages |
| uvpi | `uv python install` | Install a specific version of python | | uvpi | `uv python install` | Install a specific version of python |
| uvpl | `uv python list` | List all installed Python versions. | | uvpl | `uv python list` | Lists all python version installed |
| uvpp | `uv python pin` | Pin the current project to use a specific Python version | | uvpp | `uv python pin` | Pin the current project to use a specific Python version |
| uvpu | `uv python uninstall` | Remove a specific version of python | | uvpu | `uv python uninstall` | Remove a specific version of python |
| uvpy | `uv python` | Manage Python installs | | uvpy | `uv python` | Manage Python installs |
-9
View File
@@ -39,15 +39,6 @@ plugins=(... vi-mode)
- `VI_MODE_DISABLE_CLIPBOARD`: If set, disables clipboard integration on yank/paste - `VI_MODE_DISABLE_CLIPBOARD`: If set, disables clipboard integration on yank/paste
Clipboard integration keeps put widgets (`p`/`P`) in sync with the system
clipboard, but only while the last copy to the clipboard actually succeeded.
If that copy failed — no `xclip`/`xsel`, Wayland without `wl-clipboard`, a dead
X forwarding over SSH — the clipboard no longer mirrors what you killed inside
the line editor, so puts use the internal kill buffer instead of the stale
clipboard contents. After a failed push, puts keep using the kill buffer only
while the clipboard still holds exactly what it held when the push failed; a
new external copy is picked up again immediately.
## Mode indicators ## Mode indicators
*Normal mode* is indicated with a red `<<<` mark at the right prompt, when it *Normal mode* is indicated with a red `<<<` mark at the right prompt, when it
+1 -30
View File
@@ -118,15 +118,6 @@ bindkey '^s' history-incremental-search-forward
bindkey '^a' beginning-of-line bindkey '^a' beginning-of-line
bindkey '^e' end-of-line bindkey '^e' end-of-line
# Snapshot of the clipboard taken when the most recent push to it failed.
# While the marker is set, put widgets compare the live clipboard against the
# snapshot: unchanged means the clipboard is stale (it never received the
# kill), so the internal CUTBUFFER is used instead. As soon as the clipboard
# differs again - e.g. an external copy - it is trusted immediately, so
# external copies are never lost for longer than the failure itself.
typeset -g _OMZ_VI_CLIPBOARD_STALE=""
typeset -g _OMZ_VI_CLIPBOARD_STALE_SET=""
function wrap_clipboard_widgets() { function wrap_clipboard_widgets() {
# NB: Assume we are the first wrapper and that we only wrap native widgets # NB: Assume we are the first wrapper and that we only wrap native widgets
# See zsh-autosuggestions.zsh for a more generic and more robust wrapper # See zsh-autosuggestions.zsh for a more generic and more robust wrapper
@@ -141,33 +132,13 @@ function wrap_clipboard_widgets() {
eval " eval "
function ${wrapped_name}() { function ${wrapped_name}() {
zle .${widget} zle .${widget}
# On a failed push, snapshot the clipboard so put widgets can tell printf %s \"\${CUTBUFFER}\" | clipcopy 2>/dev/null || true
# stale content (which never received this kill) apart from later
# external copies.
if printf %s \"\${CUTBUFFER}\" | clipcopy 2>/dev/null; then
_OMZ_VI_CLIPBOARD_STALE_SET=\"\"
else
_OMZ_VI_CLIPBOARD_STALE=\"\$(clippaste 2>/dev/null)\"
_OMZ_VI_CLIPBOARD_STALE_SET=1
fi
} }
" "
else else
eval " eval "
function ${wrapped_name}() { function ${wrapped_name}() {
if [[ -n \"\${_OMZ_VI_CLIPBOARD_STALE_SET:-}\" ]]; then
# Last push failed. If the clipboard still matches the snapshot
# taken at the failure, it is stale: keep the internal CUTBUFFER.
# If it differs, an external copy arrived since - trust it again
# and clear the stale state.
local _clip=\"\$(clippaste 2>/dev/null)\"
if [[ \"\$_clip\" != \"\${_OMZ_VI_CLIPBOARD_STALE}\" ]]; then
CUTBUFFER=\"\$_clip\"
_OMZ_VI_CLIPBOARD_STALE_SET=\"\"
fi
else
CUTBUFFER=\"\$(clippaste 2>/dev/null || echo \$CUTBUFFER)\" CUTBUFFER=\"\$(clippaste 2>/dev/null || echo \$CUTBUFFER)\"
fi
zle .${widget} zle .${widget}
} }
" "
+2 -3
View File
@@ -53,11 +53,10 @@ function web_search() {
# search or go to main page depending on number of arguments passed # search or go to main page depending on number of arguments passed
if [[ $# -gt 1 ]]; then if [[ $# -gt 1 ]]; then
# if search goes in the query string ==> space as + and escape reserved # if search goes in the query string ==> space as +, otherwise %20
# characters like & and +, otherwise %20
# see https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20 # see https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20
local param="-P" local param="-P"
[[ "$urls[$1]" == *\?*= ]] && param="-r" [[ "$urls[$1]" == *\?*= ]] && param=""
# build search url: # build search url:
# join arguments passed with '+', then append to search engine URL # join arguments passed with '+', then append to search engine URL
-30
View File
@@ -1,30 +0,0 @@
# zsh-patina plugin
Initializes [zsh-patina](https://github.com/michel-kraemer/zsh-patina), a
"blazingly fast Zsh plugin performing syntax highlighting of your command line
while you type 🌈"
The plugin also caches completions for the `zsh-patina` command in
`$ZSH_CACHE_DIR/completions/_zsh-patina`, refreshed each time the plugin loads.
To use it, add `zsh-patina` to the plugins array in your `.zshrc` file:
```zsh
plugins=(... zsh-patina)
```
zsh-patina replaces [zsh-syntax-highlighting](../zsh-syntax-highlighting), so
enable only one of them. If zsh-syntax-highlighting is in the plugins array or
already loaded, this plugin prints a warning and does not activate.
## Binary location
If `zsh-patina` is not in your `PATH` when Oh My Zsh loads (eg: it lives in
`~/.cargo/bin`), set `ZSH_PATINA_BINARY` to its full path before sourcing
Oh My Zsh:
```zsh
ZSH_PATINA_BINARY=$HOME/.cargo/bin/zsh-patina
```
**Note:** you have to [install zsh-patina](https://github.com/michel-kraemer/zsh-patina#how-to-install) first.
-21
View File
@@ -1,21 +0,0 @@
if (( $+ZSH_HIGHLIGHT_VERSION )) || (( ${plugins[(Ie)zsh-syntax-highlighting]} )); then
echo '[oh-my-zsh] zsh-patina conflicts with zsh-syntax-highlighting, please enable only one of them'
elif [[ -x ${ZSH_PATINA_BINARY:-$commands[zsh-patina]} ]]; then
eval "$(${ZSH_PATINA_BINARY:-$commands[zsh-patina]} activate)"
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `zsh-patina`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_zsh-patina" ]]; then
typeset -g -A _comps
autoload -Uz _zsh-patina
_comps[zsh-patina]=_zsh-patina
fi
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._zsh-patina"
zf_mv -f -- =( "$1" completion ) "$ZSH_CACHE_DIR/completions/_zsh-patina"
} "${ZSH_PATINA_BINARY:-$commands[zsh-patina]}" &|
else
echo '[oh-my-zsh] zsh-patina not found, please install it from https://github.com/michel-kraemer/zsh-patina'
fi
Regular → Executable
View File
File mode changed.