mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-08-23 00:23:27 +08:00
Compare commits
5 Commits
master
...
eb62826522
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb62826522 | ||
|
|
c15b32baa4 | ||
|
|
ffd4c95a4f | ||
|
|
4cdd45338c | ||
|
|
8e5be2cb3a |
@@ -23,6 +23,7 @@ you would make is not already covered.
|
||||
- [A note on AI-assisted contributions](#a-note-on-ai-assisted-contributions)
|
||||
- [Use the Search, Luke](#use-the-search-luke)
|
||||
- [Commit Guidelines](#commit-guidelines)
|
||||
- [Plugin And Theme Bootstrap Compatibility](#plugin-and-theme-bootstrap-compatibility)
|
||||
- [Format](#format)
|
||||
- [Style](#style)
|
||||
- [Volunteer](#volunteer)
|
||||
@@ -176,6 +177,24 @@ specification. The automatic changelog tool uses these to automatically generate
|
||||
a changelog based on the commit messages. Here's a guide to writing a commit message
|
||||
to allow this:
|
||||
|
||||
### Plugin And Theme Bootstrap Compatibility
|
||||
|
||||
Oh My Zsh now provides a shared bootstrap entrypoint at `lib/bootstrap.zsh` for plugin-manager setups that don't
|
||||
source `oh-my-zsh.sh`.
|
||||
|
||||
When working on plugins/themes:
|
||||
|
||||
- assume bootstrap has already run in manager-driven setups
|
||||
- rely on bootstrap guarantees (`ZSH*` defaults, cache/completions setup, required `fpath` entries)
|
||||
- avoid adding per-plugin/per-theme copies of common setup unless truly plugin-specific
|
||||
|
||||
Common patterns we should migrate away from over time:
|
||||
|
||||
- repeated cache setup logic (`mkdir -p "$ZSH_CACHE_DIR/completions"`)
|
||||
- repeated base `fpath` bootstrapping for OMZ core/custom directories
|
||||
|
||||
If your plugin/theme still needs custom initialization, keep it scoped to that plugin/theme behavior only.
|
||||
|
||||
### Format
|
||||
|
||||
```
|
||||
|
||||
115
README.md
115
README.md
@@ -46,6 +46,7 @@ Twitter), and join us on [Discord](https://discord.gg/ohmyzsh).
|
||||
- [Manual Installation](#manual-installation)
|
||||
- [Installation Problems](#installation-problems)
|
||||
- [Custom Plugins And Themes](#custom-plugins-and-themes)
|
||||
- [Using Plugin Managers Without `oh-my-zsh.sh`](#using-plugin-managers-without-oh-my-zshsh)
|
||||
- [Enable GNU ls In macOS And FreeBSD Systems](#enable-gnu-ls-in-macos-and-freebsd-systems)
|
||||
- [Skip Aliases](#skip-aliases)
|
||||
- [Async git prompt](#async-git-prompt)
|
||||
@@ -349,6 +350,120 @@ If you have many functions that go well together, you can put them as a `XYZ.plu
|
||||
If you would like to override the functionality of a plugin distributed with Oh My Zsh, create a plugin of the
|
||||
same name in the `custom/plugins/` directory and it will be loaded instead of the one in `plugins/`.
|
||||
|
||||
### Using Plugin Managers Without `oh-my-zsh.sh`
|
||||
|
||||
Some plugin managers load individual OMZ plugins/themes directly and do not source `oh-my-zsh.sh`.
|
||||
For those setups, source this bootstrap entrypoint before loading any OMZ plugin or theme:
|
||||
|
||||
```zsh
|
||||
source "$ZSH/lib/bootstrap.zsh"
|
||||
```
|
||||
|
||||
#### Bootstrap compatibility contract
|
||||
|
||||
`lib/bootstrap.zsh` is idempotent and is the only required pre-load step for plugin-manager setups.
|
||||
It guarantees:
|
||||
|
||||
- `ZSH`, `ZSH_CUSTOM`, and `ZSH_CACHE_DIR` defaults
|
||||
- writable cache fallback to `${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh`
|
||||
- `$ZSH_CACHE_DIR/completions` directory creation
|
||||
- required OMZ `fpath` entries for plugins/themes:
|
||||
- `$ZSH/functions`
|
||||
- `$ZSH/completions`
|
||||
- `$ZSH_CUSTOM/functions`
|
||||
- `$ZSH_CUSTOM/completions`
|
||||
- `$ZSH_CACHE_DIR/completions`
|
||||
- public signal: `OMZ_IS_BOOTSTRAPPED=true` (for one-time hook guards)
|
||||
|
||||
What still requires `oh-my-zsh.sh`:
|
||||
|
||||
- update checks
|
||||
- plugin auto-discovery from the `plugins=(...)` list
|
||||
- `compinit`/`compfix` orchestration and zcompdump metadata refresh
|
||||
- alias filtering via `:omz:*` zstyles during file sourcing
|
||||
- final full-init signal: `OMZ_IS_LOADED=true`
|
||||
|
||||
#### Plugin manager hook guidance
|
||||
|
||||
Run bootstrap once, before any OMZ plugin/theme load:
|
||||
|
||||
```zsh
|
||||
[[ -n "${OMZ_IS_BOOTSTRAPPED:-}" ]] || source "$ZSH/lib/bootstrap.zsh"
|
||||
```
|
||||
|
||||
- **Antigen** (pre-bundle hook pattern):
|
||||
|
||||
```zsh
|
||||
omz_preload() { [[ -n "${OMZ_IS_BOOTSTRAPPED:-}" ]] || source "$ZSH/lib/bootstrap.zsh"; }
|
||||
omz_preload
|
||||
antigen bundle OMZ::plugins/git
|
||||
antigen apply
|
||||
```
|
||||
|
||||
- **Zinit** (`atinit` pre-load hook):
|
||||
|
||||
```zsh
|
||||
zinit ice atinit'[[ -n "${OMZ_IS_BOOTSTRAPPED:-}" ]] || source "$ZSH/lib/bootstrap.zsh"'
|
||||
zinit snippet OMZ::plugins/git/git.plugin.zsh
|
||||
```
|
||||
|
||||
- **zgen** (pre-load hook function called before OMZ loads):
|
||||
|
||||
```zsh
|
||||
omz_preload() { [[ -n "${OMZ_IS_BOOTSTRAPPED:-}" ]] || source "$ZSH/lib/bootstrap.zsh"; }
|
||||
omz_preload
|
||||
zgen load ohmyzsh/ohmyzsh plugins/git
|
||||
```
|
||||
|
||||
- **zplug** (run pre-load hook immediately before OMZ entries):
|
||||
|
||||
```zsh
|
||||
omz_preload() { [[ -n "${OMZ_IS_BOOTSTRAPPED:-}" ]] || source "$ZSH/lib/bootstrap.zsh"; }
|
||||
omz_preload
|
||||
zplug "plugins/git", from:oh-my-zsh
|
||||
zplug load
|
||||
```
|
||||
|
||||
- **antibody** (run pre-load hook before `antibody bundle`/`source` output):
|
||||
|
||||
```zsh
|
||||
omz_preload() { [[ -n "${OMZ_IS_BOOTSTRAPPED:-}" ]] || source "$ZSH/lib/bootstrap.zsh"; }
|
||||
omz_preload
|
||||
source <(antibody bundle <<'EOF'
|
||||
ohmyzsh/ohmyzsh path:plugins/git
|
||||
EOF
|
||||
)
|
||||
```
|
||||
|
||||
- **zulu** (run pre-load hook before OMZ module loads):
|
||||
|
||||
```zsh
|
||||
omz_preload() { [[ -n "${OMZ_IS_BOOTSTRAPPED:-}" ]] || source "$ZSH/lib/bootstrap.zsh"; }
|
||||
omz_preload
|
||||
zulu install oh-my-zsh
|
||||
```
|
||||
|
||||
Compatibility matrix:
|
||||
|
||||
| Load mode | `OMZ_IS_BOOTSTRAPPED` | `OMZ_IS_LOADED` | Suitable for |
|
||||
| :-- | :--: | :--: | :-- |
|
||||
| `source $ZSH/oh-my-zsh.sh` | ✅ | ✅ | Full OMZ framework features |
|
||||
| `source $ZSH/lib/bootstrap.zsh` + manager-loaded OMZ plugins/themes | ✅ | ❌ | Plugin/theme prerequisites only |
|
||||
|
||||
#### Manager entrypoints and OMZ-side auto-injection limits
|
||||
|
||||
Most plugin managers load OMZ by directly sourcing selected plugin/theme/lib entrypoints, not by sourcing
|
||||
`oh-my-zsh.sh`, so OMZ cannot universally inject bootstrap on its own.
|
||||
|
||||
| Manager | Typical OMZ entrypoint(s) it loads | Can OMZ auto-inject bootstrap without user hook? |
|
||||
| :-- | :-- | :--: |
|
||||
| Antigen | `antigen bundle ...` targets after `antigen use oh-my-zsh` | ❌ |
|
||||
| Zinit | `OMZ::`, `OMZL::`, `OMZP::`, `OMZT::` snippets | ❌ |
|
||||
| zgen | `zgen oh-my-zsh ...` selected OMZ paths | ❌ |
|
||||
| zplug | `from:oh-my-zsh` selected OMZ entries | ❌ |
|
||||
| antibody | `ohmyzsh/ohmyzsh path:...` selected OMZ paths | ❌ |
|
||||
| zulu | OMZ package/module entries selected by zulu | ❌ |
|
||||
|
||||
### Enable GNU ls In macOS And FreeBSD Systems
|
||||
|
||||
<a name="enable-gnu-ls"></a>
|
||||
|
||||
44
lib/bootstrap.zsh
Normal file
44
lib/bootstrap.zsh
Normal file
@@ -0,0 +1,44 @@
|
||||
#
|
||||
# Shared Oh My Zsh bootstrap entrypoint.
|
||||
#
|
||||
# This file can be sourced by plugin managers that don't source `oh-my-zsh.sh`.
|
||||
# It is safe to source multiple times.
|
||||
#
|
||||
|
||||
# Keep source path for callers that invoke omz_bootstrap again later.
|
||||
typeset -g _OMZ_BOOTSTRAP_SOURCE="${${(%):-%x}:a}"
|
||||
|
||||
omz_bootstrap() {
|
||||
# If ZSH is not defined, infer from this file location.
|
||||
[[ -n "${ZSH:-}" ]] || export ZSH="${_OMZ_BOOTSTRAP_SOURCE:h:h}"
|
||||
|
||||
# Set ZSH_CUSTOM to the path where custom config files and plugins exist.
|
||||
[[ -n "${ZSH_CUSTOM:-}" ]] || ZSH_CUSTOM="$ZSH/custom"
|
||||
|
||||
# Set cache directory.
|
||||
[[ -n "${ZSH_CACHE_DIR:-}" ]] || ZSH_CACHE_DIR="$ZSH/cache"
|
||||
|
||||
# Ensure cache dir is writable, otherwise fallback to a HOME-based cache.
|
||||
if [[ ! -w "$ZSH_CACHE_DIR" ]]; then
|
||||
ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh"
|
||||
fi
|
||||
|
||||
# Create cache and completions dir.
|
||||
command mkdir -p "$ZSH_CACHE_DIR/completions"
|
||||
|
||||
# Add required OMZ search paths.
|
||||
local dir
|
||||
for dir in \
|
||||
"$ZSH/functions" \
|
||||
"$ZSH/completions" \
|
||||
"$ZSH_CUSTOM/functions" \
|
||||
"$ZSH_CUSTOM/completions" \
|
||||
"$ZSH_CACHE_DIR/completions"; do
|
||||
(( ${fpath[(Ie)$dir]} )) || fpath=("$dir" $fpath)
|
||||
done
|
||||
|
||||
# Public signal: OMZ bootstrap has completed.
|
||||
typeset -g OMZ_IS_BOOTSTRAPPED=true
|
||||
}
|
||||
|
||||
omz_bootstrap "$@"
|
||||
88
lib/tests/bootstrap.test.zsh
Normal file
88
lib/tests/bootstrap.test.zsh
Normal file
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/zsh -df
|
||||
|
||||
set -u
|
||||
|
||||
bootstrap_file="${0:A:h:h}/bootstrap.zsh"
|
||||
|
||||
_assert() {
|
||||
local condition="$1" message="$2"
|
||||
if ! eval "$condition"; then
|
||||
print -u2 "\e[31mError\e[0m: $message"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
test_bootstrap_sets_defaults_and_paths() {
|
||||
local tmp==(:)
|
||||
mkdir -p "$tmp/ohmyzsh"/{functions,completions,cache} "$tmp/ohmyzsh/custom"/{functions,completions}
|
||||
|
||||
(
|
||||
set -e
|
||||
export ZSH="$tmp/ohmyzsh"
|
||||
unset ZSH_CUSTOM ZSH_CACHE_DIR OMZ_IS_BOOTSTRAPPED
|
||||
fpath=()
|
||||
source "$bootstrap_file"
|
||||
|
||||
_assert '[[ "$ZSH_CUSTOM" == "'"$tmp/ohmyzsh/custom"'" ]]' "ZSH_CUSTOM default should be set"
|
||||
_assert '[[ "$ZSH_CACHE_DIR" == "'"$tmp/ohmyzsh/cache"'" ]]' "ZSH_CACHE_DIR default should be set"
|
||||
_assert '[[ -d "'"$tmp/ohmyzsh/cache/completions"'" ]]' "completions dir should be created"
|
||||
_assert '[[ "${fpath[(Ie)'"$tmp/ohmyzsh/functions"']}" -gt 0 ]]' "fpath should include OMZ functions dir"
|
||||
_assert '[[ "${fpath[(Ie)'"$tmp/ohmyzsh/completions"']}" -gt 0 ]]' "fpath should include OMZ completions dir"
|
||||
_assert '[[ "${fpath[(Ie)'"$tmp/ohmyzsh/custom/functions"']}" -gt 0 ]]' "fpath should include custom functions dir"
|
||||
_assert '[[ "${fpath[(Ie)'"$tmp/ohmyzsh/custom/completions"']}" -gt 0 ]]' "fpath should include custom completions dir"
|
||||
_assert '[[ "${fpath[(Ie)'"$tmp/ohmyzsh/cache/completions"']}" -gt 0 ]]' "fpath should include cache completions dir"
|
||||
_assert '[[ "$OMZ_IS_BOOTSTRAPPED" == true ]]' "bootstrap signal should be set"
|
||||
)
|
||||
}
|
||||
|
||||
test_bootstrap_is_idempotent() {
|
||||
local tmp==(:)
|
||||
mkdir -p "$tmp/ohmyzsh"/{functions,completions,cache} "$tmp/ohmyzsh/custom"/{functions,completions}
|
||||
|
||||
(
|
||||
set -e
|
||||
export ZSH="$tmp/ohmyzsh"
|
||||
unset ZSH_CUSTOM ZSH_CACHE_DIR OMZ_IS_BOOTSTRAPPED
|
||||
fpath=()
|
||||
source "$bootstrap_file"
|
||||
source "$bootstrap_file"
|
||||
omz_bootstrap
|
||||
|
||||
_assert '[[ ${#fpath} -eq ${#${(u)fpath}} ]]' "fpath entries should not duplicate after repeated bootstrap"
|
||||
_assert '[[ "$OMZ_IS_BOOTSTRAPPED" == true ]]' "bootstrap signal should remain true"
|
||||
)
|
||||
}
|
||||
|
||||
test_bootstrap_uses_writable_cache_fallback() {
|
||||
local tmp==(:)
|
||||
mkdir -p "$tmp/ohmyzsh"/{functions,completions} "$tmp/ohmyzsh/custom"/{functions,completions}
|
||||
mkdir -p "$tmp/no-write" "$tmp/xdg-cache"
|
||||
chmod 0555 "$tmp/no-write"
|
||||
|
||||
(
|
||||
set -e
|
||||
export ZSH="$tmp/ohmyzsh"
|
||||
export XDG_CACHE_HOME="$tmp/xdg-cache"
|
||||
export ZSH_CACHE_DIR="$tmp/no-write"
|
||||
unset ZSH_CUSTOM OMZ_IS_BOOTSTRAPPED
|
||||
fpath=()
|
||||
source "$bootstrap_file"
|
||||
|
||||
_assert '[[ "$ZSH_CACHE_DIR" == "'"$tmp/xdg-cache/oh-my-zsh"'" ]]' "cache dir should fallback when not writable"
|
||||
_assert '[[ -d "'"$tmp/xdg-cache/oh-my-zsh/completions"'" ]]' "fallback completions dir should be created"
|
||||
_assert '[[ "${fpath[(Ie)'"$tmp/xdg-cache/oh-my-zsh/completions"']}" -gt 0 ]]' "fpath should include fallback completions dir"
|
||||
)
|
||||
}
|
||||
|
||||
tests=(
|
||||
test_bootstrap_sets_defaults_and_paths
|
||||
test_bootstrap_is_idempotent
|
||||
test_bootstrap_uses_writable_cache_fallback
|
||||
)
|
||||
|
||||
for test_name in $tests; do
|
||||
print -u2 "Test: $test_name"
|
||||
"$test_name" || exit 1
|
||||
print -u2 "\e[32mSuccess\e[0m"
|
||||
print -u2 ""
|
||||
done
|
||||
24
oh-my-zsh.sh
24
oh-my-zsh.sh
@@ -50,31 +50,14 @@ unset -f omz_f
|
||||
# If ZSH is not defined, use the current script's directory.
|
||||
[[ -n "$ZSH" ]] || export ZSH="${${(%):-%x}:a:h}"
|
||||
|
||||
# Set ZSH_CUSTOM to the path where your custom config files
|
||||
# and plugins exists, or else we will use the default custom/
|
||||
[[ -n "$ZSH_CUSTOM" ]] || ZSH_CUSTOM="$ZSH/custom"
|
||||
|
||||
# Set ZSH_CACHE_DIR to the path where cache files should be created
|
||||
# or else we will use the default cache/
|
||||
[[ -n "$ZSH_CACHE_DIR" ]] || ZSH_CACHE_DIR="$ZSH/cache"
|
||||
|
||||
# Make sure $ZSH_CACHE_DIR is writable, otherwise use a directory in $HOME
|
||||
if [[ ! -w "$ZSH_CACHE_DIR" ]]; then
|
||||
ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh"
|
||||
fi
|
||||
|
||||
# Create cache and completions dir and add to $fpath
|
||||
mkdir -p "$ZSH_CACHE_DIR/completions"
|
||||
(( ${fpath[(Ie)$ZSH_CACHE_DIR/completions]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath)
|
||||
# Shared, manager-agnostic bootstrap.
|
||||
source "$ZSH/lib/bootstrap.zsh"
|
||||
|
||||
# Check for updates on initial load...
|
||||
source "$ZSH/tools/check_for_upgrade.sh"
|
||||
|
||||
# Initializes Oh My Zsh
|
||||
|
||||
# add a function path
|
||||
fpath=($ZSH/{functions,completions} $ZSH_CUSTOM/{functions,completions} $fpath)
|
||||
|
||||
# Load all stock functions (from $fpath files) called below.
|
||||
autoload -U compaudit compinit zrecompile
|
||||
|
||||
@@ -234,3 +217,6 @@ fi
|
||||
|
||||
# set completion colors to be the same as `ls`, after theme has been loaded
|
||||
[[ -z "$LS_COLORS" ]] || zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
||||
|
||||
# Public signal: full Oh My Zsh init script has completed.
|
||||
typeset -g OMZ_IS_LOADED=true
|
||||
|
||||
@@ -9,11 +9,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_op" ]]; then
|
||||
_comps[op]=_op
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_op"
|
||||
zf_mv -f -- =( op completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
op completion zsh >| "$ZSH_CACHE_DIR/completions/_op" &|
|
||||
|
||||
# Load opswd function
|
||||
autoload -Uz opswd
|
||||
|
||||
@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_arduino-cli" ]]; then
|
||||
fi
|
||||
|
||||
# Generate and load arduino-cli completion
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_arduino-cli"
|
||||
zf_mv -f -- =( arduino-cli completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
arduino-cli completion zsh >! "$ZSH_CACHE_DIR/completions/_arduino-cli" &|
|
||||
|
||||
@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_argocd" ]]; then
|
||||
_comps[argocd]=_argocd
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_argocd"
|
||||
zf_mv -f -- =( argocd completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
argocd completion zsh >| "$ZSH_CACHE_DIR/completions/_argocd" &|
|
||||
|
||||
@@ -12,8 +12,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_asdf" ]]; then
|
||||
autoload -Uz _asdf
|
||||
_comps[asdf]=_asdf
|
||||
fi
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_asdf"
|
||||
zf_mv -f -- =( asdf completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
asdf completion zsh >| "$ZSH_CACHE_DIR/completions/_asdf" &|
|
||||
|
||||
@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_buf" ]]; then
|
||||
fi
|
||||
|
||||
# Generate and load buf completion
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_buf"
|
||||
zf_mv -f -- =( buf completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
buf completion zsh >! "$ZSH_CACHE_DIR/completions/_buf" &|
|
||||
@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_bun" ]]; then
|
||||
_comps[bun]=_bun
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_bun"
|
||||
zf_mv -f -- =( SHELL=zsh bun completions ) "$TMPPREFIX"
|
||||
} &|
|
||||
SHELL=zsh bun completions >| "$ZSH_CACHE_DIR/completions/_bun" &|
|
||||
|
||||
@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_charm" ]]; then
|
||||
_comps[charm]=_charm
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_charm"
|
||||
zf_mv -f -- =( charm completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
charm completion zsh >| "$ZSH_CACHE_DIR/completions/_charm" &|
|
||||
|
||||
@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_chezmoi" ]]; then
|
||||
_comps[chezmoi]=_chezmoi
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_chezmoi"
|
||||
zf_mv -f -- =( chezmoi completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
chezmoi completion zsh >| "$ZSH_CACHE_DIR/completions/_chezmoi" &|
|
||||
|
||||
@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_codex" ]]; then
|
||||
_comps[codex]=_codex
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_codex"
|
||||
zf_mv -f -- =( codex completion zsh < /dev/null 2> /dev/null ) "$TMPPREFIX"
|
||||
} &|
|
||||
codex completion zsh < /dev/null 2> /dev/null >| "$ZSH_CACHE_DIR/completions/_codex" &|
|
||||
|
||||
@@ -25,8 +25,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_deno" ]]; then
|
||||
_comps[deno]=_deno
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_deno"
|
||||
zf_mv -f -- =( deno completions zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
deno completions zsh >| "$ZSH_CACHE_DIR/completions/_deno" &|
|
||||
|
||||
@@ -56,8 +56,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_docker" ]]; then
|
||||
_comps[docker]=_docker
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
{
|
||||
# `docker completion` is only available from 23.0.0 on
|
||||
# docker version returns `Docker version 24.0.2, build cb74dfcd85`
|
||||
# with `s:,:` remove the comma after the version, and select third word of it
|
||||
@@ -65,7 +64,6 @@ zmodload -F zsh/files b:zf_mv
|
||||
! 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
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_docker"
|
||||
zf_mv -f -- =( command docker completion zsh ) "$TMPPREFIX"
|
||||
command docker completion zsh | tee "$ZSH_CACHE_DIR/completions/_docker" > /dev/null
|
||||
fi
|
||||
} &|
|
||||
|
||||
@@ -14,8 +14,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_doctl" ]]; then
|
||||
_comps[doctl]=_doctl
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_doctl"
|
||||
zf_mv -f -- =( doctl completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
doctl completion zsh >| "$ZSH_CACHE_DIR/completions/_doctl" &|
|
||||
|
||||
@@ -30,8 +30,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_flutter" ]]; then
|
||||
_comps[flutter]=_flutter
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_flutter"
|
||||
zf_mv -f -- =( flutter zsh-completion < /dev/null ) "$TMPPREFIX"
|
||||
} &|
|
||||
flutter zsh-completion < /dev/null >| "$ZSH_CACHE_DIR/completions/_flutter" &|
|
||||
@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_flux" ]]; then
|
||||
_comps[flux]=_flux
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_flux"
|
||||
zf_mv -f -- =( flux completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
flux completion zsh >| "$ZSH_CACHE_DIR/completions/_flux" &|
|
||||
|
||||
@@ -10,11 +10,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_fnm" ]]; then
|
||||
_comps[fnm]=_fnm
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_fnm"
|
||||
zf_mv -f -- =( fnm completions --shell=zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
fnm completions --shell=zsh >| "$ZSH_CACHE_DIR/completions/_fnm" &|
|
||||
|
||||
if zstyle -t ':omz:plugins:fnm' autostart; then
|
||||
local -a fnm_env_cmd
|
||||
|
||||
@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_gh" ]]; then
|
||||
_comps[gh]=_gh
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_gh"
|
||||
zf_mv -f -- =( gh completion --shell zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
gh completion --shell zsh >| "$ZSH_CACHE_DIR/completions/_gh" &|
|
||||
|
||||
@@ -9,9 +9,5 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_hasura" ]]; then
|
||||
source "$ZSH_CACHE_DIR/completions/_hasura"
|
||||
else
|
||||
source "$ZSH_CACHE_DIR/completions/_hasura"
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_hasura"
|
||||
zf_mv -f -- =( hasura completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
hasura completion zsh --file "$ZSH_CACHE_DIR/completions/_hasura" >/dev/null &|
|
||||
fi
|
||||
|
||||
@@ -13,11 +13,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_hcloud" ]]; then
|
||||
_comps[hcloud]=_hcloud
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_hcloud"
|
||||
zf_mv -f -- =( hcloud completion zsh 2> /dev/null ) "$TMPPREFIX"
|
||||
} &|
|
||||
hcloud completion zsh 2> /dev/null >| "$ZSH_CACHE_DIR/completions/_hcloud" &|
|
||||
|
||||
# Main alias
|
||||
alias hc='hcloud'
|
||||
|
||||
@@ -9,11 +9,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_helm" ]]; then
|
||||
source "$ZSH_CACHE_DIR/completions/_helm"
|
||||
else
|
||||
source "$ZSH_CACHE_DIR/completions/_helm"
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_helm"
|
||||
zf_mv -f -- =( helm completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
helm completion zsh | tee "$ZSH_CACHE_DIR/completions/_helm" >/dev/null &|
|
||||
fi
|
||||
|
||||
alias h='helm'
|
||||
|
||||
@@ -11,11 +11,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_jj" ]]; then
|
||||
_comps[jj]=_jj
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_jj"
|
||||
zf_mv -f -- =( COMPLETE=zsh jj ) "$TMPPREFIX"
|
||||
} &|
|
||||
COMPLETE=zsh jj >| "$ZSH_CACHE_DIR/completions/_jj" &|
|
||||
|
||||
function __jj_prompt_jj() {
|
||||
local -a flags
|
||||
@@ -76,3 +72,4 @@ alias jjsq='jj squash'
|
||||
alias jjst='jj status'
|
||||
alias jjwa='jj workspace add'
|
||||
alias jjwf='jj workspace forget'
|
||||
|
||||
|
||||
@@ -11,8 +11,4 @@ fi
|
||||
|
||||
# and then generate it in the background. On first completion,
|
||||
# the actual completion file will be loaded.
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_k9s"
|
||||
zf_mv -f -- =( k9s completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
k9s completion zsh >| "$ZSH_CACHE_DIR/completions/_k9s" &|
|
||||
|
||||
@@ -11,11 +11,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_kind" ]]; then
|
||||
fi
|
||||
|
||||
# Generate and load kind completion
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_kind"
|
||||
zf_mv -f -- =( kind completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
kind completion zsh >! "$ZSH_CACHE_DIR/completions/_kind" &|
|
||||
|
||||
# Register aliases
|
||||
alias kicc="kind create cluster"
|
||||
|
||||
@@ -10,11 +10,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_kubectl" ]]; then
|
||||
_comps[kubectl]=_kubectl
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_kubectl"
|
||||
zf_mv -f -- =( kubectl completion zsh 2> /dev/null ) "$TMPPREFIX"
|
||||
} &|
|
||||
kubectl completion zsh 2> /dev/null >| "$ZSH_CACHE_DIR/completions/_kubectl" &|
|
||||
|
||||
# This command is used a LOT both below and in daily life
|
||||
alias k=kubectl
|
||||
|
||||
@@ -10,8 +10,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_minikube" ]]; then
|
||||
_comps[minikube]=_minikube
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_minikube"
|
||||
zf_mv -f -- =( minikube completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
minikube completion zsh >| "$ZSH_CACHE_DIR/completions/_minikube" &|
|
||||
|
||||
@@ -14,8 +14,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_mise" ]]; then
|
||||
fi
|
||||
|
||||
# Generate and load mise completion
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_mise"
|
||||
zf_mv -f -- =( mise completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
mise completion zsh >| "$ZSH_CACHE_DIR/completions/_mise" &|
|
||||
|
||||
@@ -11,11 +11,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_molecule" ]]; then
|
||||
_comps[molecule]=_molecule
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_molecule"
|
||||
zf_mv -f -- =( _MOLECULE_COMPLETE=zsh_source molecule ) "$TMPPREFIX"
|
||||
} &|
|
||||
_MOLECULE_COMPLETE=zsh_source molecule >| "$ZSH_CACHE_DIR/completions/_molecule" &|
|
||||
|
||||
# Alias
|
||||
# molecule: https://docs.ansible.com/projects/molecule/
|
||||
|
||||
@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_atlas" ]]; then
|
||||
_comps[atlas]=_atlas
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_atlas"
|
||||
zf_mv -f -- =( atlas completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
atlas completion zsh >| "$ZSH_CACHE_DIR/completions/atlas" &|
|
||||
|
||||
@@ -7,11 +7,7 @@ if (( $+commands[nsc] )); then
|
||||
_comps[nsc]=_nsc
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_nsc"
|
||||
zf_mv -f -- =( nsc completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
nsc completion zsh >| "$ZSH_CACHE_DIR/completions/_nsc" &|
|
||||
fi
|
||||
|
||||
if (( $+commands[nats] )); then
|
||||
@@ -23,9 +19,5 @@ if (( $+commands[nats] )); then
|
||||
_comps[nats]=_nats
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_nats"
|
||||
zf_mv -f -- =( nats --completion-script-zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
nats --completion-script-zsh >| "$ZSH_CACHE_DIR/completions/_nats" &|
|
||||
fi
|
||||
|
||||
@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_ngrok" ]]; then
|
||||
_comps[ngrok]=_ngrok
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_ngrok"
|
||||
zf_mv -f -- =( ngrok completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
ngrok completion zsh >| "$ZSH_CACHE_DIR/completions/_ngrok" &|
|
||||
|
||||
@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_pass-cli" ]]; then
|
||||
_comps[pass-cli]=_pass-cli
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_pass-cli"
|
||||
zf_mv -f -- =( pass-cli completions zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
pass-cli completions zsh >| "$ZSH_CACHE_DIR/completions/_pass-cli" &|
|
||||
|
||||
@@ -43,11 +43,7 @@ else
|
||||
_comps[pipenv]=_pipenv
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_pipenv"
|
||||
zf_mv -f -- =( _PIPENV_COMPLETE=zsh_source pipenv ) "$TMPPREFIX"
|
||||
} &|
|
||||
_PIPENV_COMPLETE=zsh_source pipenv >| "$ZSH_CACHE_DIR/completions/_pipenv" &|
|
||||
fi
|
||||
|
||||
if zstyle -T ':omz:plugins:pipenv' auto-shell; then
|
||||
|
||||
@@ -10,11 +10,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_podman" ]]; then
|
||||
_comps[podman]=_podman
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_podman"
|
||||
zf_mv -f -- =( podman completion zsh 2> /dev/null ) "$TMPPREFIX"
|
||||
} &|
|
||||
podman completion zsh 2> /dev/null >| "$ZSH_CACHE_DIR/completions/_podman" &|
|
||||
|
||||
alias pbl='podman build'
|
||||
alias pcin='podman container inspect'
|
||||
|
||||
@@ -39,8 +39,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_poetry" ]]; then
|
||||
_comps[poetry]=_poetry
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_poetry"
|
||||
zf_mv -f -- =( poetry completions zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
poetry completions zsh >| "$ZSH_CACHE_DIR/completions/_poetry" &|
|
||||
|
||||
@@ -10,16 +10,12 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_procs" ]]; then
|
||||
_comps[procs]=_procs
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_procs"
|
||||
{
|
||||
autoload -Uz is-at-least
|
||||
local _version=$(procs --version)
|
||||
zf_mv -f -- =(
|
||||
if is-at-least "0.14" "${_version#procs }"; then
|
||||
procs --gen-completion-out zsh
|
||||
else
|
||||
procs --completion-out zsh
|
||||
fi
|
||||
) "$TMPPREFIX"
|
||||
if is-at-least "0.14" "${_version#procs }"; then
|
||||
procs --gen-completion-out zsh >| "$ZSH_CACHE_DIR/completions/_procs"
|
||||
else
|
||||
procs --completion-out zsh >| "$ZSH_CACHE_DIR/completions/_procs"
|
||||
fi
|
||||
} &|
|
||||
|
||||
@@ -10,11 +10,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_pulumi" ]]; then
|
||||
_comps[pulumi]=_pulumi
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_pulumi"
|
||||
zf_mv -f -- =( pulumi gen-completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
pulumi gen-completion zsh >| "$ZSH_CACHE_DIR/completions/_pulumi" &|
|
||||
|
||||
# Aliases
|
||||
alias pul='pulumi'
|
||||
|
||||
@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_qodana" ]]; then
|
||||
_comps[qodana]=_qodana
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_qodana"
|
||||
zf_mv -f -- =( qodana completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
qodana completion zsh >| "$ZSH_CACHE_DIR/completions/_qodana" &|
|
||||
|
||||
@@ -10,11 +10,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_rbw" ]]; then
|
||||
_comps[rbw]=_rbw
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_rbw"
|
||||
zf_mv -f -- =( rbw gen-completions zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
rbw gen-completions zsh >| "$ZSH_CACHE_DIR/completions/_rbw" &|
|
||||
|
||||
# rbwpw function copies the password of a service to the clipboard
|
||||
# and clears it after 20 seconds
|
||||
|
||||
@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_rclone" ]]; then
|
||||
_comps[rclone]=_rclone
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_rclone"
|
||||
zf_mv -f -- =( rclone completion zsh - ) "$TMPPREFIX"
|
||||
} &|
|
||||
rclone completion zsh - >| "$ZSH_CACHE_DIR/completions/_rclone" &|
|
||||
|
||||
@@ -19,11 +19,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_rustup" ]]; then
|
||||
fi
|
||||
|
||||
# Generate completion files in the background
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_rustup"
|
||||
zf_mv -f -- =( rustup completions zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
rustup completions zsh >| "$ZSH_CACHE_DIR/completions/_rustup" &|
|
||||
cat >| "$ZSH_CACHE_DIR/completions/_cargo" <<'EOF'
|
||||
#compdef cargo
|
||||
source "$(rustup run ${${(z)$(rustup default)}[1]} rustc --print sysroot)"/share/zsh/site-functions/_cargo
|
||||
|
||||
@@ -12,11 +12,7 @@ function install_autocompletion {
|
||||
_comps[$1]=_$1
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_$1"
|
||||
zf_mv -f -- =( $1 completion zsh ) "$TMPPREFIX"
|
||||
} "$1" &|
|
||||
$1 completion zsh >| "$ZSH_CACHE_DIR/completions/_$1" &|
|
||||
}
|
||||
|
||||
install_autocompletion cosign
|
||||
|
||||
@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_skaffold" ]]; then
|
||||
_comps[skaffold]=_skaffold
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_skaffold"
|
||||
zf_mv -f -- =( skaffold completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
skaffold completion zsh >| "$ZSH_CACHE_DIR/completions/_skaffold" &|
|
||||
|
||||
@@ -10,8 +10,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_stripe" ]]; then
|
||||
_comps[stripe]=_stripe
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_stripe"
|
||||
zf_mv -f -- =( stripe completion --shell zsh --write-to-stdout ) "$TMPPREFIX"
|
||||
} &|
|
||||
stripe completion --shell zsh --write-to-stdout >| "$ZSH_CACHE_DIR/completions/_stripe" &|
|
||||
|
||||
@@ -22,8 +22,4 @@ if (( $+aliases[tailscale] )); then
|
||||
_comps[${aliases[tailscale]:t}]=_tailscale
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_tailscale"
|
||||
zf_mv -f -- =( tailscale completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
tailscale completion zsh >| "$ZSH_CACHE_DIR/completions/_tailscale" &|
|
||||
|
||||
@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_task" ]]; then
|
||||
fi
|
||||
|
||||
# Generate and load task completion
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_task"
|
||||
zf_mv -f -- =( task --completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
task --completion zsh >! "$ZSH_CACHE_DIR/completions/_task" &|
|
||||
@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_timoni" ]]; then
|
||||
_comps[timoni]=_timoni
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_timoni"
|
||||
zf_mv -f -- =( timoni completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
timoni completion zsh >| "$ZSH_CACHE_DIR/completions/_timoni" &|
|
||||
|
||||
@@ -43,12 +43,5 @@ fi
|
||||
|
||||
# uv and uvx are installed together (uvx is an alias to `uv tool run`)
|
||||
# Overwrites the file each time as completions might change with uv versions.
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_uv"
|
||||
zf_mv -f -- =( uv generate-shell-completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_uvx"
|
||||
zf_mv -f -- =( uvx --generate-shell-completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
uv generate-shell-completion zsh >| "$ZSH_CACHE_DIR/completions/_uv" &|
|
||||
uvx --generate-shell-completion zsh >| "$ZSH_CACHE_DIR/completions/_uvx" &|
|
||||
|
||||
@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_volta" ]]; then
|
||||
_comps[volta]=_volta
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_volta"
|
||||
zf_mv -f -- =( volta completions zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
volta completions zsh >| "$ZSH_CACHE_DIR/completions/_volta" &|
|
||||
|
||||
@@ -221,12 +221,12 @@ supports_hyperlinks() {
|
||||
|
||||
# If $TERM_PROGRAM is set, these terminals support hyperlinks
|
||||
case "$TERM_PROGRAM" in
|
||||
ghostty|Hyper|iTerm.app|terminology|vscode|WezTerm) return 0 ;;
|
||||
Hyper|iTerm.app|terminology|WezTerm|vscode) return 0 ;;
|
||||
esac
|
||||
|
||||
# These termcap entries support hyperlinks
|
||||
case "$TERM" in
|
||||
alacritty|alacritty-direct|xterm-ghostty|xterm-kitty) return 0 ;;
|
||||
xterm-kitty|alacritty|alacritty-direct) return 0 ;;
|
||||
esac
|
||||
|
||||
# xfce4-terminal supports hyperlinks
|
||||
|
||||
@@ -49,31 +49,9 @@ USER=${USER:-$(id -u -n)}
|
||||
# $HOME is defined at the time of login, but it could be unset. If it is unset,
|
||||
# a tilde by itself (~) will not be expanded to the current user's home directory.
|
||||
# POSIX: https://pubs.opengroup.org/onlinepubs/009696899/basedefs/xbd_chap08.html#tag_08_03
|
||||
if [ -z "$HOME" ]; then
|
||||
HOME=$(getent passwd "$USER" 2>/dev/null | cut -d: -f6)
|
||||
|
||||
# macOS does not have getent; fall back to tilde expansion, but only if
|
||||
# $USER is a safe username. The eval below would otherwise expand any shell
|
||||
# metacharacters in $USER and allow command injection (CWE-78).
|
||||
case "$USER" in
|
||||
*[![:alnum:]_.-]*|'')
|
||||
;;
|
||||
*)
|
||||
resolved_home=$(eval echo ~"$USER")
|
||||
# Unknown users are not expanded and produce a literal "~username".
|
||||
[ "$resolved_home" = "~$USER" ] || HOME=$resolved_home
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$HOME" in
|
||||
/*) ;;
|
||||
*)
|
||||
echo "Error: unable to determine the current user's home directory." >&2
|
||||
echo "Set HOME explicitly and rerun the installer." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
HOME="${HOME:-$(getent passwd $USER 2>/dev/null | cut -d: -f6)}"
|
||||
# macOS does not have getent, but this works even if $HOME is unset
|
||||
HOME="${HOME:-$(eval echo ~"$USER")}"
|
||||
|
||||
|
||||
# Track if $ZSH was provided
|
||||
@@ -190,12 +168,12 @@ supports_hyperlinks() {
|
||||
|
||||
# If $TERM_PROGRAM is set, these terminals support hyperlinks
|
||||
case "$TERM_PROGRAM" in
|
||||
ghostty|Hyper|iTerm.app|terminology|vscode|WezTerm) return 0 ;;
|
||||
Hyper|iTerm.app|terminology|WezTerm|vscode) return 0 ;;
|
||||
esac
|
||||
|
||||
# These termcap entries support hyperlinks
|
||||
case "$TERM" in
|
||||
alacritty|alacritty-direct|xterm-ghostty|xterm-kitty) return 0 ;;
|
||||
xterm-kitty|alacritty|alacritty-direct) return 0 ;;
|
||||
esac
|
||||
|
||||
# xfce4-terminal supports hyperlinks
|
||||
|
||||
@@ -95,12 +95,12 @@ supports_hyperlinks() {
|
||||
|
||||
# If $TERM_PROGRAM is set, these terminals support hyperlinks
|
||||
case "$TERM_PROGRAM" in
|
||||
ghostty|Hyper|iTerm.app|terminology|vscode|WezTerm) return 0 ;;
|
||||
Hyper|iTerm.app|terminology|WezTerm|vscode) return 0 ;;
|
||||
esac
|
||||
|
||||
# These termcap entries support hyperlinks
|
||||
case "$TERM" in
|
||||
alacritty|alacritty-direct|xterm-ghostty|xterm-kitty) return 0 ;;
|
||||
xterm-kitty|alacritty|alacritty-direct) return 0 ;;
|
||||
esac
|
||||
|
||||
# xfce4-terminal supports hyperlinks
|
||||
|
||||
Reference in New Issue
Block a user