Merge branch 'main' into feat/smart-completion

This commit is contained in:
vladislav doster 2026-02-17 06:31:18 -06:00 committed by GitHub
commit dc8f1cdf68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 5383 additions and 312 deletions

View file

@ -1,3 +0,0 @@
{
"extends": "@commitlint/config-angular"
}

View file

@ -14,7 +14,7 @@ body:
## Self Check
- Look for similar errors in existing [GitHub Issues](https://github.com/zdharma-continuum/zinit/issues?q=is%3Aissue) (open or closed).
- Try reaching out on the [Gitter server](https://gitter.im/zdharma-continuum/community/) for help.
- Try reaching out on the [Gitter server](https://matrix.to/#/#zdharma-continuum_community:gitter.im) for help.
- type: textarea
id: what-happened

View file

@ -3,6 +3,6 @@ contact_links:
- name: Support
url: https://github.com/zdharma-continuum/zinit/discussions
about: Ask the community for support
- name: Get help on Gitter
url: https://gitter.im/zdharma-continuum/community/
- name: Get help on Matrix
url: https://matrix.to/#/#zdharma-continuum_community:gitter.im
about: Have a quick question? Join the Gitter community and ask your question.

View file

@ -11,10 +11,10 @@ jobs:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Bump Homebrew formulae
uses: dawidd6/action-homebrew-bump-formula@v3
uses: dawidd6/action-homebrew-bump-formula@v7
with:
formula: zinit
# A Personal Access Token (PAT) is instead of the default

View file

@ -15,17 +15,11 @@ jobs:
fail-fast: false
matrix:
zsh_version:
- 5.2.4
- 5.3.1
- 5.4.2
- 5.5.1
- 5.6.2
- 5.7.1
- 5.8
- 5.9
steps:
- name: check out repository code
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Grab git slugs (short commit id, branch etc.)
uses: rlespinasse/github-slug-action@v3.x
@ -49,7 +43,7 @@ jobs:
- name: build and push
id: docker_build_zsh_versions
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
timeout-minutes: 90 # compiling older zsh versions take a long time
with:
push: ${{ github.event.number == 0 }}
@ -67,7 +61,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: get vcs details
uses: rlespinasse/github-slug-action@v3.x
@ -91,7 +85,7 @@ jobs:
- name: build & push new image
id: docker_build_latest
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
if: github.ref == 'refs/heads/main'
with:
push: true

View file

@ -9,6 +9,8 @@ on:
push:
branches:
- main
paths:
- 'zinit*.zsh'
workflow_dispatch:
jobs:
@ -17,17 +19,18 @@ jobs:
steps:
- name: checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event.pull_request.head.ref || github.ref }}
- name: re-generate documentation
run: |
make doc/container
sudo chown -R "$(id -u):$(id -g)" .
- name: commit changes to the current branch
- name: commit and push updated docs
if: github.event_name != 'pull_request'
uses: EndBug/add-and-commit@v9
with:
add: 'doc'

View file

@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
- uses: actions/labeler@v6
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true

View file

@ -10,39 +10,69 @@ on:
workflow_dispatch:
jobs:
lint:
name: Lint
mdlint:
name: Markdown Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- uses: actions/checkout@v6
- uses: actions/setup-python@v5
- uses: xt0rted/markdownlint-problem-matcher@v3
- run: npm install -g markdownlint-cli
# disabled checks:
# MD013/line-length
# MD024/no-duplicate-heading
# MD033/no-inline-html
# MD034/no-bare-urls
# MD036/no-emphasis-as-heading
# MD041/first-line-heading/first-line-h1
# MD059/descriptive-link-text
# MD060/table-column-style
- run: |
markdownlint --version
# List files to lint
ls *.md **/*.md
markdownlint \
--disable MD013 MD024 MD029 MD033 MD034 MD036 MD041 MD059 MD060 \
--ignore '**/CHANGELOG.md' \
-- *.md **/*.md
zshlint:
name: ZSH Lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
task: [zsh-noexec, zsh-zcompile]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-python@v6
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install --yes zsh
pip install --user linkify-it-py mdformat mdformat-config mdformat-gfm mdformat-shfmt mdformat-tables mdformat-toc
- name: commit
uses: wagoid/commitlint-github-action@v5
with:
configFile: '.commitlintrc'
# run: commitlint --from=$(git cherry origin/main | head -n 1 | awk '{print $2}')
- name: markdown
run: find . -name '*.md' ! -name 'CHANGELOG.md' -type f -print0 | xargs -0 -n1 -P4 mdformat --check --wrap 120 --number
# - name: shell (shfmt)
# run: find . -name '*.sh' -type f -print0 | xargs -0 -n1 -P4 shfmt -bn -ci -d -i 2 -ln bash -s -sr
# - name: shell (shellcheck)
# run: find . -name '*.sh' -type f -print0 | xargs -0 -n1 -P4 shellcheck
- name: zsh (noexec)
run: find . -name '*.zsh' -type f -print0 | xargs -0 -n1 -P4 zsh -n
- name: zsh (zcompile)
run: find . -name '*.zsh' -type f -exec zsh -fc "zcompile {}" \;
- name: "run lint (${{ matrix.task }})"
run: |
case "${{ matrix.task }}" in
zsh-noexec)
find . -name '*.zsh' -type f -print0 \
| xargs -0 -n1 -P4 zsh -n
;;
zsh-zcompile)
find . -name '*.zsh' -type f \
-exec zsh -fc "zcompile {}" \;
;;
*)
echo "ERROR: unknown task ${{ matrix.task }}" >&2
exit 1
;;
esac

View file

@ -8,8 +8,8 @@ jobs:
name: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '20'

View file

@ -26,13 +26,21 @@ jobs:
zunit-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["macos-latest", "ubuntu-latest"]
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
zunit_test:
- annexes
- commands
- compile
- gh-r
- ices
- plugins
- snippets
steps:
- name: checkout ${{ github.repository }}
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0
@ -46,7 +54,7 @@ jobs:
sudo apt-get update --yes
sudo apt-get install --no-install-recommends --yes \
autoconf automake autotools-dev \
build-essential byacc\
build-essential byacc \
file \
gcc gettext glibc-source grep \
libc6 libc6-dev libevent-dev libncurses5-dev libncursesw5-dev libtool libuvc0 lua5.1 \
@ -59,34 +67,19 @@ jobs:
- name: "install dependencies"
id: install-deps
run: |
brew install --force --overwrite autoconf automake binutils byacc cmake coreutils curl gettext gnu-sed libevent libtool libuv lua lua@5.4 make ncurses ninja parallel pkg-config texinfo unzip xz zsh
brew install --force --overwrite autoconf automake binutils byacc coreutils curl gettext gnu-sed libevent libtool libuv lua lua@5.4 make ncurses ninja parallel pkg-config texinfo unzip xz zsh
brew link --force --overwrite ncurses
- name: "install zunit"
id: install-zunit
shell: zsh {0}
run: |
mkdir -p "$HOME/.local/bin" && echo "$HOME/.local/bin" >> $GITHUB_PATH
git clone --depth 1 https://github.com/zdharma-continuum/zunit; cd ./zunit
./configure --prefix=$HOME/.local && make all install
mkdir -p "$HOME/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
git clone --depth 1 https://github.com/zdharma-continuum/zunit
cd ./zunit
./configure --prefix=$HOME/.local
make all install
- name: "gh-r"
run: $HOME/.local/bin/zunit run --verbose tests/gh-r.zunit
- name: "annexes"
run: zunit run tests/annexes.zunit
- name: "commands"
run: zunit run tests/commands.zunit
- name: "compile"
run: zunit run tests/compile.zunit
- name: "ices"
run: zunit run tests/ices.zunit
- name: "plugins"
run: zunit run tests/plugins.zunit
- name: "snippets"
run: zunit run tests/snippets.zunit
- name: "run tests"
run: zunit run tests/${{ matrix.zunit_test }}.zunit

View file

@ -3,5 +3,5 @@ directories:
output: tests/_output
support: tests/_support
tests: tests
fail_fast: true
fail_fast: false
verbose: true

View file

@ -1,13 +1,13 @@
<p align="center">
<a href="https://github.com/zdharma-continuum/zinit">
<img src="https://raw.githubusercontent.com/zdharma-continuum/zinit/images/zinit.png"/>
<img alt="zinit logo" src="https://raw.githubusercontent.com/zdharma-continuum/zinit/images/zinit.png"/>
</a>
</p>
# Zinit<a name="zinit"></a>
[![MIT License][mit-badge]][mit-link] [![zinit version][ver-badge]][ver-link] [![zunit tests][tests-badge]][tests-link]
[![Join the chat at https://gitter.im/zdharma-continuum/zinit][gitter-badge]][gitter-link]
[![Join the chat at https://matrix.to/#/#zdharma-continuum_community:gitter.im][gitter-badge]][gitter-link]
<!-- mdformat-toc start --slug=github --maxlevel=3 --minlevel=2 -->
@ -48,7 +48,9 @@ # Zinit<a name="zinit"></a>
- [Calling `compinit` Without Turbo Mode](#calling-compinit-without-turbo-mode)
- [Calling `compinit` With Turbo Mode](#calling-compinit-with-turbo-mode)
- [Ignoring Compdefs](#ignoring-compdefs)
- [Disabling System-Wide `compinit` Call (Ubuntu)](#disabling-system-wide-compinit-call-ubuntu)
- [Disabling System-Wide `compinit` Call](#disabling-system-wide-compinit-call)
- [Ubuntu](#disabling-system-wide-compinit-call-ubuntu)
- [NixOS](#disabling-system-wide-compinit-call-nixos)
- [Zinit Module](#zinit-module)
- [Hints and Tips](#hints-and-tips)
- [Using ZPFX variable](#using-zpfx-variable)
@ -63,7 +65,7 @@ # Zinit<a name="zinit"></a>
<p align="center">
<a href="https://github.com/zdharma-continuum/pm-perf-test">
<img width="550px" src="https://raw.githubusercontent.com/zdharma-continuum/zinit/images/startup-times.png"/>
<img alt="startup times graph" width="550px" src="https://raw.githubusercontent.com/zdharma-continuum/zinit/images/startup-times.png"/>
</a>
</p>
@ -137,7 +139,7 @@ ### Manual<a name="manual"></a>
source "${ZINIT_HOME}/zinit.zsh"
```
[compinit](http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Initialization)):
[compinit](http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Initialization):
If you source `zinit.zsh` after `compinit`, add the following snippet after sourcing `zinit.zsh`:
@ -336,6 +338,9 @@ ## Zinit Setting
# Must Load OMZ Git library
zi snippet OMZL::git.zsh
# Must Load OMZ Async prompt library
zi snippet OMZL::async_prompt.zsh 
# Load Git plugin from OMZ
zi snippet OMZP::git
zi cdclear -q # <- forget completions provided up to this moment
@ -672,9 +677,9 @@ # make'!...' -> run make before atclone & atpull
You can also check out the [Gallery of Zinit Invocations](https://zdharma-continuum.github.io/zinit/wiki/GALLERY/) for
some additional examples.
Also, two articles on the Wiki present an example setup
[here](https://zdharma-continuum.github.io/zinit/wiki/Example-Minimal-Setup/) and
[here](https://zdharma-continuum.github.io/zinit/wiki/Example-Oh-My-Zsh-setup/).
Also, two articles on the Wiki present a
[Minimal Setup](https://zdharma-continuum.github.io/zinit/wiki/Example-Minimal-Setup/) and
[Oh-My-Zsh Setup](https://zdharma-continuum.github.io/zinit/wiki/Example-Oh-My-Zsh-setup/).
# How to Use<a name="how-to-use"></a>
@ -720,7 +725,7 @@ ### Conditional Loading<a name="conditional-loading"></a>
| `if` | Load plugin or snippet only when given condition is fulfilled, for example: `zinit ice if'[[ -n "$commands[otool]" ]]'; zinit load ...`. |
| `load` | A condition to check which should cause plugin to load. It will load once, the condition can be still true, but will not trigger second load (unless plugin is unloaded earlier, see `unload` below). E.g.: `load'[[ $PWD = */github* ]]'`. |
| `subscribe` / `on-update-of` | Postpone loading of a plugin or snippet until the given file(s) get updated, e.g. `subscribe'{~/files-*,/tmp/files-*}'` |
| `trigger-load` | Creates a function that loads the associated plugin/snippet, with an option (to use it, precede the ice content with `!`) to automatically forward the call afterwards, to a command of the same name as the function. Can obtain multiple functions to create  sparate with `;`. |
| `trigger-load` | Creates a function that loads the associated plugin/snippet, with an option (to use it, precede the ice content with `!`) to automatically forward the call afterwards, to a command of the same name as the function. Can obtain multiple functions to create  separate with `;`. |
| `unload` | A condition to check causing plugin to unload. It will unload once, then only if loaded again. E.g.: `unload'[[ $PWD != */github* ]]'`. |
| `wait` | Postpone loading a plugin or snippet. For `wait'1'`, loading is done `1` second after prompt. For `wait'[[ ... ]]'`, `wait'(( ... ))'`, loading is done when given condition is meet. For `wait'!...'`, prompt is reset after load. Zsh can start 80% (i.e.: 5x) faster thanks to postponed loading. **Fact:** when `wait` is used without value, it works as `wait'0'`. |
@ -775,9 +780,9 @@ ### Others<a name="others"></a>
| `id-as` | Nickname a plugin or snippet, to e.g. create a short handler for long-url snippet. |
| `subst` | Substitute the given string into another string when sourcing the plugin script, e.g.: `zinit subst'autoload → autoload -Uz' …`. |
| `aliases` | Load the plugin with the aliases mechanism enabled. Use with plugins that define **and use** aliases in their scripts. |
| `autoload` | Autoload the given functions (from their files). Equvalent to calling `atinit'autoload the-function'`. Supports renaming of the function pass `'… → new-name'` or `'… -> new-name'`, e.g.: `zinit autoload'fun → my-fun; fun2 → my-fun2'`. |
| `bindmap` | To hold `;`-separated strings like `Key(s)A -> Key(s)B`, e.g. `^R -> ^T; ^A -> ^B`. In general, `bindmap''`changes bindings (done with the `bindkey` builtin) the plugin does. The example would cause the plugin to map Ctrl-T instead of Ctrl-R, and Ctrl-B instead of Ctrl-A. **Does not work with snippets.** |
| `compile` | Pattern (+ possible `{...}` expansion, like `{a/*,b*}`) to select additional files to compile, e.g. \`compile"(pure\\ |
| `autoload` | Autoload the given functions (from their files). Equivalent to calling `atinit'autoload the-function'`. Supports renaming of the function pass `'… → new-name'` or `'… -> new-name'`, e.g.: `zinit autoload'fun → my-fun; fun2 → my-fun2'`. |
| `bindmap` | To hold `;`-separated strings like `Key(s)A -> Key(s)B`, e.g. `^R -> ^T; ^A -> ^B`. In general, `bindmap''`changes bindings (done with the `bindkey` builtin) the plugin does. The example would cause the plugin to map Ctrl-T instead of Ctrl-R, and Ctrl-B instead of Ctrl-A. **Does not work with snippets.** |
| `compile` | Pattern (+ possible `{...}` expansion, like `{a/*,b*}`) to select additional files to compile, e.g. `compile'*.zsh'`. |
| `extract` | Performs archive extraction supporting multiple formats like `zip`, `tar.gz`, etc. and also notably OS X `dmg` images. If it has no value, then it works in the _auto_ mode it automatically extracts all files of known archive extensions IF they aren't located deeper than in a sub-directory (this is to prevent extraction of some helper archive files, typically located somewhere deeper in the tree). If no such files will be found, then it extracts all found files of known **type** the type is being read by the `file` Unix command. If not empty, then takes names of the files to extract. Refer to the Wiki page for further information. |
| `service` | Make following plugin or snippet a _service_, which will be ran in background, and only in single Zshell instance. See [the zservice-\* repositories](https://github.com/orgs/zdharma-continuum/repositories?q=zservice-). |
| `light-mode` | Load the plugin without the investigating, i.e.: as if it would be loaded with the `light` command. Useful for the for-syntax, where there is no `load` nor `light` subcommand |
@ -918,7 +923,7 @@ ## Updating Zinit and Plugins<a name="updating-zinit-and-plugins"></a>
issue `zinit update NAME_OF_PLUGIN`. A list of commits will be shown:
<p align="center">
<img src="./doc/img/update.png" />
<img alt="screenshot displaying zinit update tj/git-extras and its output" src="./doc/img/update.png" />
</p>
Some plugins require performing an action each time they're updated. One way you can do this is by using the `atpull`
@ -936,7 +941,7 @@ ### Calling `compinit` Without Turbo Mode<a name="calling-compinit-without-turbo
With no Turbo mode in use, compinit can be called normally, i.e.: as `autoload compinit; compinit`. This should be done
after loading of all plugins and before possibly calling `zinit cdreplay`.
The `cdreplay` subcommand is provided to re-play all catched `compdef` calls. The `compdef` calls are used to define a
The `cdreplay` subcommand is provided to re-play all caught `compdef` calls. The `compdef` calls are used to define a
completion for a command. For example, `compdef _git git` defines that the `git` command should be completed by a `_git`
function.
@ -1031,11 +1036,16 @@ ### Ignoring Compdefs<a name="ignoring-compdefs"></a>
The `cdreplay` is important if you use plugins like `OMZP::kubectl` or `asdf-vm/asdf`, because these plugins call
`compdef`.
### Disabling System-Wide `compinit` Call (Ubuntu)<a name="disabling-system-wide-compinit-call-ubuntu"></a>
### Disabling System-Wide `compinit` Call<a name="disabling-system-wide-compinit-call"></a>
On Ubuntu users might get surprised that e.g. their completions work while they didn't call `compinit` in their
`.zshrc`. That's because the function is being called in `/etc/zshrc`. To disable this call what is needed to avoid
the slowdown and if user loads any completion-equipped plugins, i.e. almost on 100% add the following lines to
On some systems, users might be surprised to see that completions work even though they didnt call `compinit` in their
`~/.zshrc`. This happens because `compinit` is being called from `/etc/zshrc`. To disable this behavior -- which is
recommended to avoid slow startup, especially if you load plugins that bring their own completions (which is almost
always the case) -- follow the instructions for your system below:
#### Ubuntu<a name="disabling-system-wide-compinit-call-ubuntu"></a>
On Ubuntu, the global `compinit` call can be disabled on a per-user basis by adding the following lines to a users
`~/.zshenv`:
```zsh
@ -1043,6 +1053,19 @@ # Skip the not really helping Ubuntu global compinit
skip_global_compinit=1
```
#### NixOS<a name="disabling-system-wide-compinit-call-nixos"></a>
On NixOS, the global `compinit` call can be disabled system-wide by setting the following option in your
`/etc/nixos/configuration.nix`:
```nix
# Disable global completion init to speed up `compinit` call in `~/.zshrc`.
programs.zsh.enableGlobalCompInit = false;
```
Don't forget to add the `compinit` call to every user's `~/.zshrc`! Otherwise completions for system packages might not
work.
## Zinit Module<a name="zinit-module"></a>
The module is now hosted [in its own repository](https://github.com/zdharma-continuum/zinit-module)
@ -1069,10 +1092,10 @@ ### Using ZPFX variable<a name="using-zpfx-variable"></a>
Typical use cases when working with `$ZPFX` are, e.g.:
```zsh
$ ls $ZPFX
$ cd $ZPFX
$ cd $ZPFX/bin # note: $ZPFX/bin is automatically prepended to $PATH
$ cd $ZPFX/share
ls $ZPFX
cd $ZPFX
cd $ZPFX/bin # note: $ZPFX/bin is automatically prepended to $PATH
cd $ZPFX/share
```
Before the `configure''` ice appeared one would use `$ZPFX` as follows:
@ -1093,7 +1116,7 @@ # (supported are: configure, cmake, scons and meson)
To set ZPFX, one should do (in `.zshrc` before loading `zinit`):
```zsh
$ export ZPFX=$HOME/my-software # or: ZPFX=$HOME/.local, etc.
export ZPFX=$HOME/my-software # or: ZPFX=$HOME/.local, etc.
```
We encourage people to install compiled software with use of `$ZPFX` and `configure''` and `make''` ices, to have a
@ -1180,11 +1203,11 @@ ## Getting Help and Community<a name="getting-help-and-community"></a>
- [Open a discussion](https://github.com/zdharma-continuum/zinit/discussions).
- Or via reach out via Gitter
[![Join the chat at https://gitter.im/zdharma-continuum/community][gitter-badge]][gitter-link]
- Or via reach out via Matrix
[![Join the chat at https://matrix.to/#/#zdharma-continuum_community:gitter.im][gitter-badge]][gitter-link]
[gitter-badge]: https://badges.gitter.im/zdharma-continuum/zinit.svg
[gitter-link]: https://gitter.im/zdharma-continuum/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
[gitter-link]: https://matrix.to/#/#zdharma-continuum_community:gitter.im
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
[mit-link]: ./LICENSE
[tests-badge]: https://github.com/zdharma-continuum/zinit/actions/workflows/tests.yaml/badge.svg

16
_zinit
View file

@ -98,7 +98,7 @@ __zinit_installed_plugins(){
__zinit_installed_snippets(){
# [[ -prefix '-' ]] && return 0
typeset -a snippets
local expl snippet
local expl
snippets=( "${ZINIT[SNIPPETS_DIR]}"/**/._zinit(D/:h) )
snippets=( ${(Q)snippets[@]#${ZINIT[SNIPPETS_DIR]}/} )
# formulae=( ${(qq)formulae[@]/(#b)(http|https|ftp|ftps|scp)--/${match[1]}://} )
@ -320,13 +320,15 @@ _zinit_unload(){
# FUNCTION: _zinit_update [[[
_zinit_update(){
_arguments \
'--help[Show this help message]' \
'--no-pager[Don'\''t automatically install dependencies]' \
'--quiet[Turn off messages from the operation]' \
'--reset[Reset repository or delete downloadremove single-file snippets and gh-r plugins)]' \
'--urge[Cause all the hooks like: atpull'', cp'', etc. to execute even when there aren'\''t any new commits / any new version of the gh-r file / etc.… available for download↔ simulate a non-empty update]' \
'(-h --help)'{-h,--help}'[Show this help message]' \
'(-n --no-pager)'{-n,--no-pager}'[Disable the use of the pager]' \
'(-q --quiet)'{-q,--quiet}'[Turn off almost-all messages from the update operation FOR the objects which don'\''t have any new version available]' \
'(-r --reset)'{-r,--reset}'[Reset the repository before updating (or remove the files for single-file snippets and gh-r plugins)]' \
'(-s --snippets)'{-s,--snippets}'[Update only snippets (i.e.: skip updating plugins)]' \
'(-u --urge)'{-u,--urge}'[Cause all the hooks like: atpull'\'\'', cp'\'\'', etc. to execute even when there aren'\''t any new commits / any new version of the gh-r file / etc.… available for download↔ simulate a non-empty update]' \
'(-v --verbose)'{-v,--verbose}'[Turn on more messages from the operation]' \
- set1 \
'--parallel[Turn on concurrent, multi-thread update (of all objects)]' \
'(-p --parallel)'{-p,--parallel}'[Turn on concurrent, multi-thread update (of all objects)]' \
'(-a --all)'{-a,--all}'[Update all plugins and snippets]' \
- set2 \
'1:installed:__zinit_installed'

View file

@ -1,31 +1,35 @@
# Documentation
# HACKING.md
## README: Update the table of content
## Documentation
### README: Update the table of contents
1. Install [doctoc](https://github.com/thlorenz/doctoc)
2. To update the TOC run the following command:
2. To update the TOC, run the following command:
```zsh
doctoc --github README.md
```
## Update asciidoc and/or zshelldoc
### Update asciidoc and/or zshelldoc
1. Make sure you have [docker](https://www.docker.com/) or [podman](https://podman.io/) installed.
2. From the root of the repo, run:
> [!IMPORTANT]
> Make sure you have [docker](https://www.docker.com/) or [podman](https://podman.io/) installed.
1. From the root of the repo, run:
```zsh
make doc-container
```
If for some reason you want to build the zshelldocs or the PDF manually, you'll need:
If, for some reason, you want to build the zshelldocs or the PDF manually, you'll need:
1. Patience, zsd is very finicky about locales. You have been warned.
2. [zshelldoc (zsd)](https://github.com/zdharma-continuum/zshelldoc)
3. [asciidoc](https://asciidoc.org/)
4. `make doc`
## Generate the manpage (doc/zinit.1)
### Generate the manpage (doc/zinit.1)
1. Install [pandoc](https://pandoc.org/)
2. From the root of the repo run:
@ -34,7 +38,7 @@ ## Generate the manpage (doc/zinit.1)
pandoc --standalone --to man README.md -o doc/zinit.1
```
## Updating the gh-pages (zdharma-continuum.github.io)
### Updating the gh-pages (zdharma-continuum.github.io)
1. Check out the [documentation branch](https://github.com/zdharma-continuum/zinit/tree/documentation)
@ -45,14 +49,15 @@ ## Updating the gh-pages (zdharma-continuum.github.io)
2. Do your modifications and push your changes
3. Keep an eye on [the CI logs](https://github.com/zdharma-continuum/zinit/actions/workflows/gh-pages.yaml)
4. If all went well you can head to https://zdharma-continuum.github.io/ to see your changes live.
4. If all went well, head to https://zdharma-continuum.github.io/ to see your changes live.
**NOTE:** If you really **need** to push directly, without CI please refer to \[the README in the
documentation\]https://github.com/zdharma-continuum/zinit/blob/documentation/README.md
> [!NOTE]
> If you really **need** to push directly, without CI, please refer to [the README in the
documentation](https://github.com/zdharma-continuum/zinit/blob/documentation/README.md)
# Testing
## Testing
We run out tests with [zunit](https://zunit.xyz).
We run our tests with [zunit](https://zunit.xyz).
To add a new test case:
@ -88,12 +93,12 @@ # Testing
}
@test 'zinit-annex-bin-gem-node installation' {
# This spawns the official zinit container, and executesa single zinit command
# This spawns the official zinit container and executes a single zinit command
# inside it
run ./scripts/docker-run.sh --wrap --debug --zunit \
zinit light as"null" for zdharma-continuum/null
# Verify exit code of the command above
# Verify the exit code of the command above
assert $state equals 0
assert "$output" contains "Downloading"
@ -104,7 +109,7 @@ # Check if we downloaded the file correctly and if it is readable
}
```
You should of course also check out the existing tests ;)
You should, of course, also check out the existing tests ;)
3. To run your new test:
@ -112,17 +117,17 @@ # Check if we downloaded the file correctly and if it is readable
zunit --verbose tests/your_test.zunit
```
## Debugging tests
### Debugging tests
If you ever need to inspect the `ZINIT[HOME_DIR]` dir, where zinit's internal data is stored you can do so by commenting
If you ever need to inspect the `ZINIT[HOME_DIR]` dir, where zinit's internal data is stored, you can do so by commenting
out the `@teardown` section in your test. Then you can re-run said test and head over to `${TMPDIR:-/tmp}/zunit-zinit`.
Good luck!
# Misc
## Misc
## Get the list of supported ices
### Get the list of supported ices
To get the list in a quick-and-dirty fashion you issue:
To get the list in a quick-and-dirty fashion, you issue:
```zsh
zinit --help | tail -1

View file

@ -7,7 +7,7 @@
[IMAGE: MIT License (https://img.shields.io/badge/license-MIT-blue.svg)]
[IMAGE: image (https://img.shields.io/github/tag/zdharma-continuum/zinit.svg)] (https://github.com/zdharma-continuum/zinit/releases)
[IMAGE: Join the chat at
https://gitter.im/zdharma-continuum/zinit (https://badges.gitter.im/zdharma-continuum/zinit.svg)] (https://gitter.im/zdharma-continuum/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
https://matrix.to/#/#zdharma-continuum_community:gitter.im (https://badges.gitter.im/zdharma-continuum/zinit.svg)] (https://gitter.im/zdharma-continuum/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
.RS
.PP
\f[B]Note\f[R]: The original author (https://github.com/psprint) of
@ -1750,5 +1750,5 @@ Do you need help or wish to get in touch with other Zinit users?
Open a
discussion (https://github.com/zdharma-continuum/zinit/discussions).
.IP \[bu] 2
Or via reach out via Gitter [IMAGE: Join the chat at
https://gitter.im/zdharma-continuum/community (https://badges.gitter.im/zdharma-continuum/zinit.svg)] (https://gitter.im/zdharma-continuum/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Or via reach out via Matrix [IMAGE: Join the chat at
https://matrix.to/#/#zdharma-continuum_community:gitter.im (https://badges.gitter.im/zdharma-continuum/zinit.svg)] (https://gitter.im/zdharma-continuum/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

View file

@ -0,0 +1,185 @@
NAME
zinit-additional.zsh - a shell script
Documentation automatically generated with `zshelldoc'
== FUNCTIONS
+zinit-debug
.zinit-debug-clear
.zinit-debug-report
.zinit-debug-revert
.zinit-debug-start
.zinit-debug-status
.zinit-debug-stop
.zinit-service
.zinit-wrap-track-functions
:zinit-tmp-subst-source
=== DETAILS
==== Script Body
Has 1 line(s). No functions are called (may set up e.g. a hook, a Zle widget bound to a key, etc.).
==== +zinit-debug
____
Debug command entry point
____
Has 35 line(s). Doesn't call other functions.
Uses feature(s): _setopt_, _zmodload_, _zparseopts_
Called by:
zinit.zsh/zinit
==== .zinit-debug-clear
____
Clear latest debug report
____
Has 7 line(s). Calls functions:
.zinit-debug-clear
|-- zinit-autoload.zsh/.zinit-clear-report-for
`-- zinit.zsh/+zi-log
Called by:
zinit-autoload.zsh/.zinit-unload
==== .zinit-debug-report
____
Displays debug report (data recorded in interactive session).
____
Has 6 line(s). Calls functions:
.zinit-debug-report
|-- zinit-autoload.zsh/.zinit-show-report
`-- zinit.zsh/+zi-log
Uses feature(s): _source_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zinit-debug-revert
____
Revert changes made during debug mode
____
Has 7 line(s). Calls functions:
.zinit-debug-revert
|-- zinit-autoload.zsh/.zinit-unload
`-- zinit.zsh/+zi-log
Uses feature(s): _source_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zinit-debug-start
____
Start debug mode
____
Has 13 line(s). Calls functions:
.zinit-debug-start
|-- zinit.zsh/+zi-log
|-- zinit.zsh/.zinit-diff
`-- zinit.zsh/.zinit-tmp-subst-on
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zinit-debug-status
____
Revert changes made during debug mode
____
Has 2 line(s). Calls functions:
.zinit-debug-status
`-- zinit.zsh/+zi-log
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zinit-debug-stop
____
Stop debug mode
____
Has 14 line(s). Calls functions:
.zinit-debug-stop
|-- zinit.zsh/+zi-log
|-- zinit.zsh/.zinit-diff
`-- zinit.zsh/.zinit-tmp-subst-off
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zinit-service
____
Handles given service, i.e. obtains lock, runs it, or waits if no lock
$1 - type "p" or "s" (plugin or snippet)
$2 - mode - for plugin (light or load)
$3 - id - URL or plugin ID or alias name (from id-as'')
____
Has 37 line(s). Calls functions:
.zinit-service
|-- zinit.zsh/.zinit-load
`-- zinit.zsh/.zinit-load-snippet
Uses feature(s): _kill_, _read_, _setopt_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zinit-wrap-track-functions
Has 19 line(s). Doesn't call other functions.
Uses feature(s): _eval_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== :zinit-tmp-subst-source
Has 25 line(s). Calls functions:
:zinit-tmp-subst-source
`-- zinit.zsh/+zi-log
Uses feature(s): _eval_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,837 @@
NAME
zinit-install.zsh - a shell script
Documentation automatically generated with `zshelldoc'
== FUNCTIONS
+zinit-cmake-hook
.zi::get-architecture
.zinit-at-eval
.zinit-compinit
.zinit-download-file-stdout
.zinit-download-snippet
.zinit-extract
.zinit-forget-completion
.zinit-get-cygwin-package
.zinit-get-latest-gh-r-url-part
.zinit-get-package
.zinit-get-url-mtime
.zinit-install-completions
.zinit-jq-check
.zinit-json-get-value
.zinit-json-to-array
.zinit-mirror-using-svn
.zinit-setup-plugin-dir
.zinit-single-line
.zinit-update-snippet
__zinit-cmake-base-hook
zicp
ziextract
zimv
∞zinit-atclone-hook
∞zinit-atpull-e-hook
∞zinit-atpull-hook
∞zinit-compile-plugin-hook
∞zinit-configure-base-hook
∞zinit-configure-e-hook
∞zinit-configure-hook
∞zinit-cp-hook
∞zinit-extract-hook
∞zinit-file-cp-mv-operation
∞zinit-make-base-hook
∞zinit-make-e-hook
∞zinit-make-ee-hook
∞zinit-make-hook
∞zinit-mv-hook
∞zinit-ps-on-update-hook
∞zinit-reset-hook
AUTOLOAD compinit
=== DETAILS
==== Script Body
Has 6 line(s). No functions are called (may set up e.g. a hook, a Zle widget bound to a key, etc.).
Uses feature(s): _source_
==== +zinit-cmake-hook
Has 1 line(s). Calls functions:
+zinit-cmake-hook
`-- __zinit-cmake-base-hook
`-- zinit.zsh/+zi-log
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zi::get-architecture
Has 39 line(s). Calls functions:
.zi::get-architecture
`-- zinit.zsh/+zi-log
Uses feature(s): _setopt_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zinit-at-eval
Has 9 line(s). Calls functions:
.zinit-at-eval
`-- zinit.zsh/@zinit-substitute
Uses feature(s): _eval_
Called by:
∞zinit-atpull-e-hook
∞zinit-atpull-hook
==== .zinit-compinit
____
User-exposed `compinit' frontend which first ensures that all
completions managed by Zinit are forgotten by Zshell. After
that it runs normal `compinit', which should more easily detect
Zinit's completions.
No arguments.
____
Has 26 line(s). Calls functions:
.zinit-compinit
|-- .zinit-forget-completion
|-- compinit
`-- zinit.zsh/+zi-log
Uses feature(s): _autoload_, _compinit_, _setopt_, _unfunction_
Called by:
.zinit-install-completions
zinit-autoload.zsh/.zinit-uninstall-completions
zinit-autoload.zsh/.zinit-update-or-status-all
zinit.zsh/.zinit-prepare-home
zinit.zsh/zinit
==== .zinit-download-file-stdout
____
Downloads file to stdout. Supports following backend commands:
curl, wget, lftp, lynx. Used by snippet loading.
____
Has 53 line(s). Calls functions:
.zinit-download-file-stdout
`-- zinit.zsh/+zi-log
Uses feature(s): _setopt_, _trap_, _type_
Called by:
.zinit-download-snippet
.zinit-get-cygwin-package
.zinit-get-package
.zinit-setup-plugin-dir
==== .zinit-download-snippet
____
Downloads snippet
file with curl, wget, lftp or lynx,
directory, with Subversion when svn-ICE is active.
Github supports Subversion protocol and allows to clone subdirectories.
This is used to provide a layer of support for Oh-My-Zsh and Prezto.
____
Has 377 line(s). Calls functions:
.zinit-download-snippet
|-- .zinit-download-file-stdout
|   `-- zinit.zsh/+zi-log
|-- .zinit-get-url-mtime
|-- .zinit-install-completions
|   |-- .zinit-compinit
|   |   |-- .zinit-forget-completion
|   |   |-- compinit
|   |   `-- zinit.zsh/+zi-log
|   |-- .zinit-forget-completion
|   |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2
|   |-- zinit-side.zsh/.zinit-exists-physically-message
|   |-- zinit.zsh/+zi-log
|   `-- zinit.zsh/.zinit-any-to-user-plugin
|-- .zinit-mirror-using-svn
|-- zinit-side.zsh/.zinit-store-ices
|-- zinit.zsh/+zi-log
`-- zinit.zsh/is-at-least
Uses feature(s): _is-at-least_, _setopt_, _trap_, _zcompile_
Called by:
.zinit-update-snippet
zinit.zsh/.zinit-load-snippet
==== .zinit-extract
Has 30 line(s). Calls functions:
.zinit-extract
|-- ziextract
|   `-- zinit.zsh/+zi-log
`-- zinit.zsh/+zi-log
Uses feature(s): _setopt_
Called by:
∞zinit-extract-hook
==== .zinit-forget-completion
____
Implements alternation of Zsh state so that already initialized
completion stops being visible to Zsh.
$1 - completion function name, e.g. "_cp"; can also be "cp"
____
Has 20 line(s). Doesn't call other functions.
Uses feature(s): _setopt_, _unfunction_
Called by:
.zinit-compinit
.zinit-install-completions
zinit-autoload.zsh/.zinit-uninstall-completions
zinit.zsh/zinit
==== .zinit-get-cygwin-package
Has 70 line(s). Calls functions:
.zinit-get-cygwin-package
|-- .zinit-download-file-stdout
|   `-- zinit.zsh/+zi-log
`-- zinit.zsh/+zi-log
Uses feature(s): _setopt_
Called by:
.zinit-setup-plugin-dir
==== .zinit-get-latest-gh-r-url-part
____
Gets version string of latest release of given Github
package. Connects to Github releases page.
____
Has 66 line(s). Calls functions:
.zinit-get-latest-gh-r-url-part
`-- zinit.zsh/+zi-log
Uses feature(s): _setopt_
Called by:
.zinit-setup-plugin-dir
zinit-autoload.zsh/.zinit-update-or-status
==== .zinit-get-package
Has 195 line(s). Calls functions:
.zinit-get-package
|-- .zinit-download-file-stdout
|   `-- zinit.zsh/+zi-log
|-- .zinit-jq-check
|   `-- zinit.zsh/+zi-log
|-- .zinit-json-to-array
|   `-- .zinit-jq-check
|   `-- zinit.zsh/+zi-log
|-- ziextract
|   `-- zinit.zsh/+zi-log
|-- zinit.zsh/+zi-log
`-- zinit.zsh/@zinit-substitute
Uses feature(s): _eval_, _setopt_, _trap_
Called by:
zinit.zsh/.zinit-load
==== .zinit-get-url-mtime
____
For the given URL returns the date in the Last-Modified
header as a time stamp
____
Has 35 line(s). Doesn't call other functions.
Uses feature(s): _read_, _setopt_, _trap_, _type_
Called by:
.zinit-download-snippet
==== .zinit-install-completions
____
Installs all completions of given plugin. After that they are visible to
'compinit'. Visible completions can be selectively disabled and enabled. User
can access completion data with 'completions' subcommand.
$1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
$2 - plugin if $1 (i.e., user) given
$3 - if 1, then reinstall, otherwise only install completions that are not present
____
Has 62 line(s). Calls functions:
.zinit-install-completions
|-- .zinit-compinit
|   |-- .zinit-forget-completion
|   |-- compinit
|   `-- zinit.zsh/+zi-log
|-- .zinit-forget-completion
|-- zinit-side.zsh/.zinit-any-colorify-as-uspl2
|-- zinit-side.zsh/.zinit-exists-physically-message
|-- zinit.zsh/+zi-log
`-- zinit.zsh/.zinit-any-to-user-plugin
Uses feature(s): _setopt_
Called by:
.zinit-download-snippet
.zinit-setup-plugin-dir
zinit.zsh/zinit
==== .zinit-jq-check
____
Check if jq is available and outputs an error message with instructions if
that's not the case
____
Has 8 line(s). Calls functions:
.zinit-jq-check
`-- zinit.zsh/+zi-log
Called by:
.zinit-get-package
.zinit-json-get-value
.zinit-json-to-array
==== .zinit-json-get-value
____
Wrapper around jq that return the value of a property
$1: JSON structure
$2: jq path
____
Has 4 line(s). Calls functions:
.zinit-json-get-value
`-- .zinit-jq-check
`-- zinit.zsh/+zi-log
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zinit-json-to-array
____
Wrapper around jq that sets key/values of an associative array, replicating
the structure of a given JSON object
$1: JSON structure
$2: jq path
$3: name of the associative array to store the key/value pairs in
____
Has 13 line(s). Calls functions:
.zinit-json-to-array
`-- .zinit-jq-check
`-- zinit.zsh/+zi-log
Uses feature(s): _eval_, _setopt_
Called by:
.zinit-get-package
==== .zinit-mirror-using-svn
____
Used to clone subdirectories from Github. If in update mode
(see $2), then invokes `svn update', in normal mode invokes
`svn checkout --non-interactive -q <URL>'. In test mode only
compares remote and local revision and outputs true if update
is needed.
$1 - URL
$2 - mode, "" - normal, "-u" - update, "-t" - test
$3 - subdirectory (not path) with working copy, needed for -t and -u
____
Has 29 line(s). Doesn't call other functions.
Uses feature(s): _setopt_
Called by:
.zinit-download-snippet
==== .zinit-setup-plugin-dir
____
Clones given plugin into PLUGIN_DIR. Supports multiple
sites (respecting `from' and `proto' ice modifiers).
Invokes compilation of plugin's main file.
$1 - user
$2 - plugin
____
Has 220 line(s). Calls functions:
.zinit-setup-plugin-dir
|-- .zinit-download-file-stdout
|   `-- zinit.zsh/+zi-log
|-- .zinit-get-cygwin-package
|   |-- .zinit-download-file-stdout
|   |   `-- zinit.zsh/+zi-log
|   `-- zinit.zsh/+zi-log
|-- .zinit-get-latest-gh-r-url-part
|   `-- zinit.zsh/+zi-log
|-- .zinit-install-completions
|   |-- .zinit-compinit
|   |   |-- .zinit-forget-completion
|   |   |-- compinit
|   |   `-- zinit.zsh/+zi-log
|   |-- .zinit-forget-completion
|   |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2
|   |-- zinit-side.zsh/.zinit-exists-physically-message
|   |-- zinit.zsh/+zi-log
|   `-- zinit.zsh/.zinit-any-to-user-plugin
|-- ziextract
|   `-- zinit.zsh/+zi-log
|-- zinit-side.zsh/.zinit-any-colorify-as-uspl2
|-- zinit-side.zsh/.zinit-store-ices
|-- zinit.zsh/+zi-log
`-- zinit.zsh/.zinit-get-object-path
Uses feature(s): _setopt_, _trap_
Called by:
zinit-autoload.zsh/.zinit-update-or-status
zinit.zsh/.zinit-load
==== .zinit-single-line
____
Display cURL progress bar on a single line
____
Has 20 line(s). Doesn't call other functions.
Uses feature(s): _read_, _setopt_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zinit-update-snippet
Has 76 line(s). Calls functions:
.zinit-update-snippet
|-- .zinit-download-snippet
|   |-- .zinit-download-file-stdout
|   |   `-- zinit.zsh/+zi-log
|   |-- .zinit-get-url-mtime
|   |-- .zinit-install-completions
|   |   |-- .zinit-compinit
|   |   |   |-- .zinit-forget-completion
|   |   |   |-- compinit
|   |   |   `-- zinit.zsh/+zi-log
|   |   |-- .zinit-forget-completion
|   |   |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2
|   |   |-- zinit-side.zsh/.zinit-exists-physically-message
|   |   |-- zinit.zsh/+zi-log
|   |   `-- zinit.zsh/.zinit-any-to-user-plugin
|   |-- .zinit-mirror-using-svn
|   |-- zinit-side.zsh/.zinit-store-ices
|   |-- zinit.zsh/+zi-log
|   `-- zinit.zsh/is-at-least
|-- zinit.zsh/+zi-log
|-- zinit.zsh/.zinit-get-object-path
`-- zinit.zsh/.zinit-pack-ice
Uses feature(s): _eval_, _setopt_
Called by:
zinit-autoload.zsh/.zinit-update-or-status-snippet
==== __zinit-cmake-base-hook
____
FUNCTION: __zinit-cmake-base-hook [[[
A base common implementation of the cmake ice
____
Has 23 line(s). Calls functions:
__zinit-cmake-base-hook
`-- zinit.zsh/+zi-log
Uses feature(s): _eval_, _setopt_
Called by:
+zinit-cmake-hook
==== zicp
Has 30 line(s). Doesn't call other functions.
Uses feature(s): _setopt_
Called by:
zimv
==== ziextract
____
If the file is an archive, it is extracted by this function.
Next stage is scanning of files with the common utility file
to detect executables. They are given +x mode. There are also
messages to the user on performed actions.
$1 - url
$2 - file
____
Has 283 line(s). Calls functions:
ziextract
`-- zinit.zsh/+zi-log
Uses feature(s): _setopt_, _unfunction_, _zparseopts_
Called by:
.zinit-extract
.zinit-get-package
.zinit-setup-plugin-dir
==== zimv
Has 3 line(s). Calls functions:
zimv
`-- zicp
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-atclone-hook
Has 26 line(s). Calls functions:
∞zinit-atclone-hook
|-- zinit-side.zsh/.zinit-countdown
`-- zinit.zsh/@zinit-substitute
Uses feature(s): _eval_, _setopt_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-atpull-e-hook
Has 22 line(s). Calls functions:
∞zinit-atpull-e-hook
|-- .zinit-at-eval
|   `-- zinit.zsh/@zinit-substitute
`-- zinit-side.zsh/.zinit-countdown
Uses feature(s): _setopt_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-atpull-hook
Has 22 line(s). Calls functions:
∞zinit-atpull-hook
|-- .zinit-at-eval
|   `-- zinit.zsh/@zinit-substitute
`-- zinit-side.zsh/.zinit-countdown
Uses feature(s): _setopt_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-compile-plugin-hook
Has 20 line(s). Calls functions:
∞zinit-compile-plugin-hook
`-- zinit-autoload.zsh/.zinit-compile-plugin
Uses feature(s): _setopt_, _source_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-configure-base-hook
____
A base common implementation of the configure ice
____
Has 46 line(s). Calls functions:
∞zinit-configure-base-hook
|-- zinit.zsh/+zi-log
`-- zinit.zsh/@zinit-substitute
Uses feature(s): _eval_, _setopt_
Called by:
∞zinit-configure-e-hook
∞zinit-configure-hook
==== ∞zinit-configure-e-hook
Has 1 line(s). Calls functions:
∞zinit-configure-e-hook
`-- ∞zinit-configure-base-hook
|-- zinit.zsh/+zi-log
`-- zinit.zsh/@zinit-substitute
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-configure-hook
____
The non-! version of configure'' ice. Runs in between
of make'!' and make''. Configure script naturally runs
before make.
____
Has 1 line(s). Calls functions:
∞zinit-configure-hook
`-- ∞zinit-configure-base-hook
|-- zinit.zsh/+zi-log
`-- zinit.zsh/@zinit-substitute
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-cp-hook
Has 1 line(s). Calls functions:
∞zinit-cp-hook
`-- ∞zinit-file-cp-mv-operation
|-- zinit.zsh/+zi-log
`-- zinit.zsh/@zinit-substitute
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-extract-hook
Has 10 line(s). Calls functions:
∞zinit-extract-hook
|-- .zinit-extract
|   |-- ziextract
|   |   `-- zinit.zsh/+zi-log
|   `-- zinit.zsh/+zi-log
`-- zinit.zsh/@zinit-substitute
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-file-cp-mv-operation
Has 49 line(s). Calls functions:
∞zinit-file-cp-mv-operation
|-- zinit.zsh/+zi-log
`-- zinit.zsh/@zinit-substitute
Uses feature(s): _setopt_
Called by:
∞zinit-cp-hook
∞zinit-mv-hook
==== ∞zinit-make-base-hook
____
A base common implementation of the make ice
____
Has 57 line(s). Calls functions:
∞zinit-make-base-hook
|-- zinit.zsh/+zi-log
`-- zinit.zsh/@zinit-substitute
Uses feature(s): _eval_, _setopt_
Called by:
∞zinit-make-e-hook
∞zinit-make-ee-hook
∞zinit-make-hook
==== ∞zinit-make-e-hook
Has 1 line(s). Calls functions:
∞zinit-make-e-hook
`-- ∞zinit-make-base-hook
|-- zinit.zsh/+zi-log
`-- zinit.zsh/@zinit-substitute
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-make-ee-hook
Has 1 line(s). Calls functions:
∞zinit-make-ee-hook
`-- ∞zinit-make-base-hook
|-- zinit.zsh/+zi-log
`-- zinit.zsh/@zinit-substitute
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-make-hook
Has 1 line(s). Calls functions:
∞zinit-make-hook
`-- ∞zinit-make-base-hook
|-- zinit.zsh/+zi-log
`-- zinit.zsh/@zinit-substitute
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-mv-hook
Has 1 line(s). Calls functions:
∞zinit-mv-hook
`-- ∞zinit-file-cp-mv-operation
|-- zinit.zsh/+zi-log
`-- zinit.zsh/@zinit-substitute
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-ps-on-update-hook
Has 18 line(s). Calls functions:
∞zinit-ps-on-update-hook
`-- zinit.zsh/+zi-log
Uses feature(s): _eval_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-reset-hook
Has 79 line(s). Calls functions:
∞zinit-reset-hook
`-- zinit.zsh/+zi-log
Uses feature(s): _eval_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== compinit
____
Initialisation for new style completion. This mainly contains some helper
functions and setup. Everything else is split into different files that
will automatically be made autoloaded (see the end of this file). The
names of the files that will be considered for autoloading are those that
begin with an underscores (like `_condition).
The first line of each of these files is read and must indicate what
should be done with its contents:
`#compdef <names ...>'
____
Has 573 line(s). Doesn't call other functions.
Uses feature(s): _autoload_, _bindkey_, _compdef_, _compdump_, _eval_, _read_, _setopt_, _unfunction_, _zle_, _zstyle_
Called by:
.zinit-compinit

View file

@ -0,0 +1,285 @@
NAME
zinit-side.zsh - a shell script
Documentation automatically generated with `zshelldoc'
== FUNCTIONS
.zinit-any-colorify-as-uspl2
.zinit-compute-ice
.zinit-countdown
.zinit-exists-physically
.zinit-exists-physically-message
.zinit-first
.zinit-store-ices
.zinit-two-paths
=== DETAILS
==== Script Body
Has 1 line(s). No functions are called (may set up e.g. a hook, a Zle widget bound to a key, etc.).
==== .zinit-any-colorify-as-uspl2
____
Returns ANSI-colorified "user/plugin" string, from any supported
plugin spec (user---plugin, user/plugin, user plugin, plugin).
$1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
$2 - plugin (only when $1 - i.e. user - given)
$REPLY - ANSI-colorified "user/plugin" string
____
Has 22 line(s). Calls functions:
.zinit-any-colorify-as-uspl2
|-- zinit.zsh/.zinit-any-to-pid
`-- zinit.zsh/.zinit-any-to-user-plugin
Called by:
.zinit-exists-physically-message
zinit-autoload.zsh/.zinit-clear-completions
zinit-autoload.zsh/.zinit-compiled
zinit-autoload.zsh/.zinit-create
zinit-autoload.zsh/.zinit-exists-message
zinit-autoload.zsh/.zinit-get-completion-owner-uspl2col
zinit-autoload.zsh/.zinit-list-bindkeys
zinit-autoload.zsh/.zinit-recently
zinit-autoload.zsh/.zinit-search-completions
zinit-autoload.zsh/.zinit-show-completions
zinit-autoload.zsh/.zinit-show-times
zinit-autoload.zsh/.zinit-unload
zinit-autoload.zsh/.zinit-update-all-parallel
zinit-autoload.zsh/.zinit-update-or-status-all
zinit-autoload.zsh/.zinit-update-or-status
zinit-install.zsh/.zinit-install-completions
zinit-install.zsh/.zinit-setup-plugin-dir
zinit.zsh/.zinit-formatter-pid
==== .zinit-compute-ice
____
Computes ICE array
- input
- static
- saved
taking priorities into account.
Can also pack resulting ices into ZINIT_SICE (see $2).
Returns filepath to snippet directory and optional snippet file name (only
valid if ICE[svn] is not set).
$1 - URL (also plugin-spec)
$2 - "pack" or "nopack" or "pack-nf" - packing means ICE
wins with static ice; "pack-nf" means that disk-ices will
be ignored (no-file?)
$3 - name of output associative array, "ICE" is the default
$4 - name of output string parameter, to hold path to directory ("local_dir")
$5 - name of output string parameter, to hold filename ("filename")
$6 - name of output string parameter, to hold is-snippet 0/1-bool ("is_snippet")
$REPLY - snippet directory filepath
____
Has 110 line(s). Calls functions:
.zinit-compute-ice
|-- .zinit-exists-physically-message
|   |-- .zinit-any-colorify-as-uspl2
|   |   |-- zinit.zsh/.zinit-any-to-pid
|   |   `-- zinit.zsh/.zinit-any-to-user-plugin
|   |-- .zinit-exists-physically
|   |   `-- zinit.zsh/.zinit-any-to-user-plugin
|   |-- zinit.zsh/+zi-log
|   |-- zinit.zsh/.zinit-any-to-pid
|   `-- zinit.zsh/.zinit-any-to-user-plugin
|-- .zinit-two-paths
|   |-- .zinit-first
|   |   |-- zinit.zsh/.zinit-any-to-pid
|   |   |-- zinit.zsh/.zinit-any-to-user-plugin
|   |   |-- zinit.zsh/.zinit-find-other-matches
|   |   `-- zinit.zsh/.zinit-get-object-path
|   `-- zinit.zsh/.zinit-get-object-path
|-- zinit.zsh/.zinit-any-to-user-plugin
`-- zinit.zsh/.zinit-pack-ice
Uses feature(s): _setopt_
Called by:
zinit-autoload.zsh/.zinit-compile-plugin
zinit-autoload.zsh/.zinit-edit
zinit-autoload.zsh/.zinit-recall
zinit-autoload.zsh/.zinit-uncompile-plugin
zinit-autoload.zsh/.zinit-update-or-status-snippet
zinit-autoload.zsh/.zinit-update-or-status
==== .zinit-countdown
____
Displays a countdown 5...4... etc.
$REPLY - 1 if Ctrl-C is pressed, otherwise 0
____
Has 20 line(s). Calls functions:
.zinit-countdown
`-- zinit.zsh/+zi-log
Uses feature(s): _trap_
Called by:
zinit-install.zsh/∞zinit-atclone-hook
zinit-install.zsh/∞zinit-atpull-e-hook
zinit-install.zsh/∞zinit-atpull-hook
==== .zinit-exists-physically
____
Checks if directory of given plugin exists in PLUGIN_DIR.
$1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
$2 - plugin (only when $1 - i.e. user - given)
____
Has 8 line(s). Calls functions:
.zinit-exists-physically
`-- zinit.zsh/.zinit-any-to-user-plugin
Called by:
.zinit-exists-physically-message
zinit-autoload.zsh/.zinit-create
zinit-autoload.zsh/.zinit-update-or-status
==== .zinit-exists-physically-message
____
Checks if directory of given plugin exists in PLUGIN_DIR, and outputs error
message if it doesn't.
$1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
$2 - plugin (only when $1 - i.e. user - given)
____
Has 25 line(s). Calls functions:
.zinit-exists-physically-message
|-- .zinit-any-colorify-as-uspl2
|   |-- zinit.zsh/.zinit-any-to-pid
|   `-- zinit.zsh/.zinit-any-to-user-plugin
|-- .zinit-exists-physically
|   `-- zinit.zsh/.zinit-any-to-user-plugin
|-- zinit.zsh/+zi-log
|-- zinit.zsh/.zinit-any-to-pid
`-- zinit.zsh/.zinit-any-to-user-plugin
Uses feature(s): _setopt_
Called by:
.zinit-compute-ice
zinit-autoload.zsh/.zinit-changes
zinit-autoload.zsh/.zinit-glance
zinit-autoload.zsh/.zinit-stress
zinit-autoload.zsh/.zinit-update-or-status
zinit-install.zsh/.zinit-install-completions
==== .zinit-first
____
Finds the main file of plugin. There are multiple file name formats, they are
ordered in order starting from more correct ones, and matched.
.zinit-load-plugin() has similar code parts and doesn't call .zinit-first()
for performance. Obscure matching is done in .zinit-find-other-matches, here
and in .zinit-load(). Obscure = non-standard main-file naming convention.
$1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
$2 - plugin (only when $1 - i.e. user - given)
____
Has 20 line(s). Calls functions:
.zinit-first
|-- zinit.zsh/.zinit-any-to-pid
|-- zinit.zsh/.zinit-any-to-user-plugin
|-- zinit.zsh/.zinit-find-other-matches
`-- zinit.zsh/.zinit-get-object-path
Called by:
.zinit-two-paths
zinit-autoload.zsh/.zinit-compile-plugin
zinit-autoload.zsh/.zinit-glance
zinit-autoload.zsh/.zinit-stress
==== .zinit-store-ices
____
Saves ice mods in given hash onto disk.
$1 - directory where to create or delete files
$2 - name of hash that holds values
$3 - additional keys of hash to store, space separated
$4 - additional keys of hash to store, empty-meaningful ices, space separated
$5 URL, if applicable
$6 mode, svn=1, 0=single file
____
Has 30 line(s). Doesn't call other functions.
Called by:
zinit-autoload.zsh/.zinit-update-or-status
zinit-install.zsh/.zinit-download-snippet
zinit-install.zsh/.zinit-setup-plugin-dir
==== .zinit-two-paths
____
Obtains a snippet URL without specification if it is an SVN URL (points to
directory) or regular URL (points to file), returns 2 possible paths for
further examination
$REPLY - two filepaths
____
Has 24 line(s). Calls functions:
.zinit-two-paths
|-- .zinit-first
|   |-- zinit.zsh/.zinit-any-to-pid
|   |-- zinit.zsh/.zinit-any-to-user-plugin
|   |-- zinit.zsh/.zinit-find-other-matches
|   `-- zinit.zsh/.zinit-get-object-path
`-- zinit.zsh/.zinit-get-object-path
Uses feature(s): _setopt_
Called by:
.zinit-compute-ice
zinit-autoload.zsh/.zinit-update-or-status

1966
doc/zsdoc/zinit.zsh.adoc Normal file

File diff suppressed because it is too large Load diff

View file

@ -58,7 +58,7 @@ echo_error() {
}
check_dependencies() {
zsh_min_version=5.5
zsh_min_version=5.8
if ! zsh -sfc \
'autoload is-at-least;
is-at-least $1 $ZSH_VERSION' "$zsh_min_version"; then
@ -284,7 +284,7 @@ Now to get started you can check out the following:
🧊 https://github.com/${ZINIT_REPO}#ice-modifiers
- There's also an ${COLOR_BOLD_WHITE_ON_BLACK}introduction${COLOR_RESET} to Zinit on the wiki:
📚 https://zdharma-continuum.github.io/zinit/wiki/INTRODUCTION/
- The ${COLOR_BOLD_WHITE_ON_BLACK}For-Syntax${COLOR_RESET} article on the wiki, which hilights some best practises:
- The ${COLOR_BOLD_WHITE_ON_BLACK}For-Syntax${COLOR_RESET} article on the wiki, which highlights some best practices:
📖 https://zdharma-continuum.github.io/zinit/wiki/For-Syntax/
💁 Need help?

View file

@ -6,7 +6,8 @@
HOME="$zi_test_dir" # Stops programs creating directories in user home
typeset -gx ZBIN="$zi_test_dir/polaris/bin" os_type="${OSTYPE//[0-9\.]*/}"
[[ ! -d $ZBIN ]] && mkdir -p "$ZBIN"
zinit default-ice --quiet from'gh-r' lbin'!'
arch=$(uname -m)
zinit default-ice --quiet from'gh-r' lbin'!' null
}
@test 'act' { # Run your GitHub Actions locally
@ -15,7 +16,7 @@
run "$act" --version; assert $state equals 0
}
@test 'akamai' { # Manage and configure Akamai from the Command Line.
run zinit id-as'akamai' lbin'akamai*->akamai' for @akamai/cli; assert $state equals 0
run zinit id-as'akamai' lbin'!akamai*->akamai' for @akamai/cli; assert $state equals 0
local cli="$ZBIN/akamai"; assert "$cli" is_executable
run "$cli" --version; assert $state equals 0
}
@ -26,7 +27,7 @@
run "$alacritty" --version; assert $state equals 0
}
@test 'alist' { # A file list program that supports multiple storage, powered by Gin and React
run zinit lbin'!* -> alist' for @alist-org/alist; assert $state equals 0
run zinit lbin'!* -> alist' for @alistgo/alist; assert $state equals 0
local alist="$ZBIN/alist"; assert "$alist" is_executable
run "$alist" version; assert $state equals 0
}
@ -41,7 +42,7 @@
run "$assh" --version; assert $state equals 0
}
@test 'atuin' { # Magical shell history
run zinit for @atuinsh/atuin; assert $state equals 0
run zinit lbin'!atuin*->atuin' bpick'^*update*' for @atuinsh/atuin; assert $state equals 0
local atuin="$ZBIN/atuin"; assert "$atuin" is_executable
run "$atuin" --version; assert $state equals 0
}
@ -84,7 +85,7 @@
}
@test 'broot' { # A new way to see and navigate directory trees
[[ $OSTYPE =~ 'darwin*' ]] && skip " on $os_type"
run zinit lbin'!*${OSTYPE}*/* -> broot' for @Canop/broot; assert $state equals 0
run zinit lbin"!*$MACHTYPE*$OSTYPE*/broot" for @Canop/broot; assert $state equals 0
local broot="$ZBIN/broot"; assert "$broot" is_executable
run "$broot" --version; assert $state equals 0
}
@ -104,7 +105,7 @@
run "$certificates" --version; assert $state equals 0
}
@test 'checkmake' { # experimental linter/analyzer for Makefiles
run zinit lbin'!checkmake* -> checkmake' for @mrtazz/checkmake; assert $state equals 0
run zinit lbin'!checkmake* -> checkmake' for @checkmake/checkmake; assert $state equals 0
local checkmake="$ZBIN/checkmake"; assert "$checkmake" is_executable
run $checkmake --version; assert $state equals 0
}
@ -197,7 +198,7 @@
}
@test 'dysk' { # A linux utility to get information on filesystems, like df but better
[[ $OSTYPE =~ 'darwin*' ]] && skip "skipped on $os_type"
run zinit lbin'!**/x86_64-linux/* -> dysk' for @Canop/dysk; assert $state equals 0
run zinit lbin"!**/$arch*$os_type/* -> dysk" for @Canop/dysk; assert $state equals 0
local dysk="$ZBIN/dysk"; assert "$dysk" is_executable
run $dysk --version; assert $state equals 0
}
@ -215,7 +216,7 @@
[[ $OSTYPE =~ 'darwin*' ]] && skip "on $os_type"
run zinit ver'v0.31.0' for @pkolaczk/fclones; assert $state equals 0
local fclones="$ZBIN/fclones"; assert "$fclones" is_executable
run "$fclones" --help; assert $state equals 0
run "$fclones" --version; assert $state equals 0
}
@test 'fd' { # A fast, simple, and user-friendly alternative to find
run zinit for @sharkdp/fd; assert $state equals 0
@ -233,7 +234,7 @@
run $fogg version; assert $state equals 0
}
@test 'fx' { # Terminal JSON viewer
run zinit lbin'!* -> fx' for @antonmedv/fx; assert $state equals 0
run zinit lbin'!* -> fx' ver'32.0.0' for @antonmedv/fx; assert $state equals 0
local fx="$ZBIN/fx"; assert "$fx" is_executable
run $fx -v; assert $state equals 0
}
@ -242,12 +243,6 @@
local fzf="$ZBIN/fzf"; assert "$fzf" is_executable
run $fzf --version; assert $state equals 0
}
@test 'gaper' { # Builds and restarts a Go project when it crashes or some watched file changes
[[ $OSTYPE =~ "linux*" ]] && skip "on $os_type"
run zinit lbin'!**/gaper' for @maxcnunes/gaper; assert $state equals 0
local gaper="$ZBIN/gaper"; assert "$gaper" is_executable
run $gaper --version; assert $state equals 0
}
@test 'gdu' { # Fast disk usage analyzer with console interface written in Go
run zinit lbin'!* -> gdu' for @dundee/gdu; assert $state equals 0
local gdu="$ZBIN/gdu"; assert "$gdu" is_executable
@ -288,10 +283,10 @@
local git_absorb="$ZBIN/git-absorb"; assert "$git_absorb" is_executable
run "$git_absorb" --version; assert $state equals 0
}
@test 'git-chglog' { # CHANGELOG generator implemented in Go (Golang).
run zinit for @git-chglog/git-chglog; assert $state equals 0
local git_chglog="$ZBIN/git-chglog"; assert "$git_chglog" is_executable
run "$git_chglog" --version; assert $state equals 0
@test 'git-cliff' { # CHANGELOG generator implemented in Go (Golang).
run zinit for @orhun/git-cliff; assert $state equals 0
local git_cliff="$ZBIN/git-cliff"; assert "$git_cliff" is_executable
run "$git_cliff" --version; assert $state equals 0
}
@test 'git-mkver' { # Automatic Semantic Versioning for git based software development
run zinit ver'v1.2.2' for @idc101/git-mkver; assert $state equals 0
@ -304,7 +299,7 @@
run "$git_sizer" --version; assert $state equals 0
}
@test 'gitui' { # Blazing fast terminal-ui for git written in rust
run zinit for @extrawurst/gitui; assert $state equals 0
run zinit for @gitui-org/gitui; assert $state equals 0
local gitui="$ZBIN/gitui"; assert "$gitui" is_executable
run "$gitui" --version; assert $state equals 0
}
@ -386,11 +381,6 @@
local hexyl="$ZBIN/hexyl"; assert "$hexyl" is_executable
run $hexyl --version; assert $state equals 0
}
@test 'hit-on' { # Git Workflow Helper Tool
run zinit lbin'!* -> hit' for kowainik/hit-on; assert $state equals 0
local hit="$ZBIN/hit"; assert "$hit" is_executable
run $hit --version; assert $state equals 0
}
@test 'hoofli' { # Generate PlantUML diagrams from Chrome or Firefox network inspection
run zinit lbin'!* -> hoofli' for @dnnrly/hoofli; assert $state equals 0
local hoofli="$ZBIN/hoofli"; assert "$hoofli" is_executable
@ -412,11 +402,6 @@
local hyperfine="$ZBIN/hyperfine"; assert "$hyperfine" is_executable
run $hyperfine --version; assert $state equals 0
}
@test 'ignite' { # Ignite CLI is the all-in-one platform to build, launch, and maintain any crypto application on a sovereign and secured blockchain
run zinit for id-as'ignite' @ignite/cli; assert $state equals 0
local cli="$ZBIN/ignite"; assert "$cli" is_executable
run "$cli" version; assert $state equals 0
}
@test 'igo' { # Improved Go Syntax (transpiler)
run zinit for @rocketlaunchr/igo; assert $state equals 0
local igo="$ZBIN/igo"; assert "$igo" is_executable
@ -428,7 +413,7 @@
run $insect help; assert $state equals 0
}
@test 'ipinfo' { # Official Command Line Interface for the IPinfo API (IP geolocation and other types of IP data)
run zinit for id-as'ipinfo' lbin'*->ipinfo' @ipinfo/cli; assert $state equals 0
run zinit for id-as'ipinfo' lbin'!*->ipinfo' @ipinfo/cli; assert $state equals 0
local cli="$ZBIN/ipinfo"; assert "$cli" is_executable
run "$cli" --version; assert $state equals 0
}
@ -468,11 +453,6 @@
local krew="$ZBIN/krew"; assert "$krew" is_executable
run $krew version; assert $state equals 0
}
@test 'kubedb' { # `kubectl` plugin for KubeDB
run zinit for lbin'kube*->kubedb' @kubedb/cli; assert $state equals 0
local cli="$ZBIN/kubedb"; assert "$cli" is_executable
run "$cli" version; assert $state equals 0
}
@test 'kubectl-plugins' { # Faster way to switch between clusters and namespaces in kubectl
[[ $OSTYPE =~ 'darwin*' ]] && skip "skipped on $os_type"
load_bin_gem_node
@ -483,6 +463,11 @@
run "$prog" --help; assert $state equals 0
done
}
@test 'kubedb' { # `kubectl` plugin for KubeDB
run zinit for lbin'!kube*->kubedb' @kubedb/cli; assert $state equals 0
local cli="$ZBIN/kubedb"; assert "$cli" is_executable
run "$cli" version; assert $state equals 0
}
@test 'lazygit' { # simple terminal UI for git commands
run zinit for @jesseduffield/lazygit; assert $state equals 0
local lazygit="$ZBIN/lazygit"; assert "$lazygit" is_executable
@ -525,12 +510,6 @@
local mage="$ZBIN/mage"; assert "$mage" is_executable
run $mage -version; assert $state equals 0
}
@test 'mas' { # Mac App Store command line interface
[[ $OSTYPE =~ 'linux*' ]] && skip "skipped on $os_type"
run zinit for @mas-cli/mas; assert $state equals 0
local mas="$ZBIN/mas"; assert "$mas" is_executable
run $mas version; assert $state equals 0
}
@test 'mcfly' { # Fly through your shell history. Great Scott
run zinit ver'v0.8.3' for @cantino/mcfly; assert $state equals 0
local mcfly="$ZBIN/mcfly"; assert "$mcfly" is_executable
@ -556,13 +535,8 @@
run "$mdbook" --version;
assert $state equals 127; assert $output contains 'no such file or directory'
}
@test 'mdcat' { # cat for markdown
run zinit for @swsnr/mdcat; assert $state equals 0
local mdcat="$ZBIN/mdcat"; assert "$mdcat" is_executable
run "$mdcat" --version; assert $state equals 0
}
@test 'micro' { # A modern and intuitive terminal-based text editor
run zinit for @zyedidia/micro; assert $state equals 0
run zinit for @micro-editor/micro; assert $state equals 0
local micro="$ZBIN/micro"; assert "$micro" is_executable
run $micro --version; assert $state equals 0
}
@ -570,7 +544,7 @@
[[ $OSTYPE =~ 'darwin*' ]] && skip "skipped on $os_type"
run zinit lbin'!* -> miniserve' for @svenstaro/miniserve; assert $state equals 0
local miniserve="$ZBIN/miniserve"; assert "$miniserve" is_executable
run $miniserve --help; assert $state equals 0
run $miniserve --version; assert $state equals 0
}
@test 'mkcert' { # A simple zero-config tool to make locally trusted development certificates
run zinit lbin'!* -> mkcert' for @FiloSottile/mkcert; assert $state equals 0
@ -609,7 +583,8 @@
run $moonwalk --version; assert $state equals 0
}
@test 'navi' { # An interactive cheatsheet tool for the command-line
run zinit lbin'* -> navi' for @denisidoro/navi; assert $state equals 0
[[ $OSTYPE =~ 'darwin*' ]] && skip "skipped on $os_type"
run zinit lbin'!* -> navi' for @denisidoro/navi; assert $state equals 0
local navi="$ZBIN/navi"; assert "$navi" is_executable
run $navi --version; assert $state equals 0
}
@ -659,8 +634,8 @@
local pulumi="$ZBIN/pulumi"; assert "$pulumi" is_executable
run "$pulumi" version; assert $state equals 0
}
@test 'qsv' { # CSVs sliced, diced & analyzed.
run zinit ver'0.112.0' for @jqnatividad/qsv; assert $state equals 0
@test 'qsv' { # Blazing-fast Data-Wrangling toolkit
run zinit for @dathere/qsv; assert $state equals 0
local qsv="$ZBIN/qsv"; assert "$qsv" is_executable
run "$qsv" --version; assert $state equals 0
}
@ -737,7 +712,7 @@
run $shfmt --version; assert $state equals 0
}
@test 'skim' { # Fuzzy Finder in rust
run zinit ver'v0.9.4' for @lotabout/skim; assert $state equals 0
run zinit for lbin'!sk->sk' @skim-rs/skim; assert $state equals 0
local skim="$ZBIN/sk"; assert "$skim" is_executable
run "$skim" --version; assert $state equals 0
}
@ -762,7 +737,7 @@
run "$stern" --version; assert $state equals 0
}
@test 'tealdeer' { # A very fast implementation of tldr in Rust
run zinit lbin'!tealdeer* -> tealdeer' for @dbrgn/tealdeer; assert $state equals 0
run zinit lbin'!tealdeer* -> tealdeer' for @tealdeer-rs/tealdeer; assert $state equals 0
local tealdeer="$ZBIN/tealdeer"; assert "$tealdeer" is_executable
run "$tealdeer" --version; assert $state equals 0
}
@ -786,11 +761,6 @@
local tre="$ZBIN/tre"; assert "$tre" is_executable
run $tre --version; assert $state equals 0
}
@test 'tv' { # A cross-platform CLI csv pretty printer that uses column styling to maximize viewer enjoyment
run zinit for @uzimaru0000/tv; assert $state equals 0
local tv="$ZBIN/tv"; assert "$tv" is_executable
run $tv --version; assert $state equals 0
}
@test 'up' { # Deploy infinitely scalable serverless apps, apis, and sites in seconds to AWS
run zinit lbin'!up* -> up' for akavel/up; assert $state equals 0
local up="$ZBIN/up"; assert "$up" is_executable
@ -835,7 +805,7 @@
}
@test 'yabai' { # A tiling window manager for macOS based on binary space partitioning
[[ $OSTYPE =~ 'linux*' ]] && skip 'Yabai skipped on Linux'
run zinit for @koekeishiya/yabai; assert $state equals 0
run zinit for @asmvik/yabai; assert $state equals 0
local yabai="$ZBIN/yabai"; assert "$yabai" is_executable
run $yabai --version; assert $state equals 0
}
@ -845,7 +815,8 @@
run $yq --version; assert $state equals 0
}
@test 'zed' { # Tooling for super-structured data: a new and easier way to manipulate data
run zinit for @brimdata/zed; assert $state equals 0
skip "Official Doc: SuperDB is still under development so there's not yet a GA release."
run zinit for @brimdata/super; assert $state equals 0
local zed="$ZBIN/zed"; assert "$zed" is_executable
run $zed --version; assert $state equals 0
}

64
tests/hook-handler.zunit Executable file
View file

@ -0,0 +1,64 @@
#!/usr/bin/env zunit
# Tests for issue #728: Empty hook handlers cause "permission denied" errors
# https://github.com/zdharma-continuum/zinit/issues/728
@setup {
# Set up minimal zinit environment
HOME="$zi_test_dir"
typeset -gA ZINIT ZINIT_EXTS ZINIT_EXTS2 ICE
ZINIT[BIN_DIR]="${PWD}"
ZINIT[PLUGINS_DIR]="$zi_test_dir/plugins"
ZINIT[SNIPPETS_DIR]="$zi_test_dir/snippets"
ZINIT[HOME_DIR]="$zi_test_dir"
# Source zinit
source "${PWD}/zinit.zsh"
}
@test 'empty hook handler error is prevented by fix' {
# This test verifies the fix for issue #728
# Without the fix, empty hook handlers cause "permission denied:" errors
# Register extension with empty handler (the exact pattern that triggers the bug)
ZINIT_EXTS["zinit hook:preinit-pre 10"]="10 z-annex-data: test-annex hook:preinit-pre '' '' ''"
# Test the hook processing logic directly
# This simulates what happens in .zinit-load at line 1648-1652
local output=""
local error_code=0
# Get the hook keys (simulating the reply array)
local -a test_keys
test_keys=( "zinit hook:preinit-pre 10" )
# Process hooks
for ___key in "${test_keys[@]}"; do
local -a ___arr
___arr=( "${(Q)${(z@)ZINIT_EXTS[$___key]:-$ZINIT_EXTS2[$___key]}[@]}" )
# With our fix, this checks if handler is non-empty before executing
if [[ -n "${___arr[5]:-}" ]]; then
output="would execute handler"
else
output="skipped empty handler"
fi
done
# Verify the fix prevented execution of empty handler
assert "$output" same_as "skipped empty handler"
}
@test 'direct test of empty command execution fails' {
# This demonstrates the underlying issue reported in #728
local empty_var=""
# Executing an empty variable causes "permission denied:"
run zsh -c 'empty_var=""; "${empty_var}"'
# Verify it fails with permission denied
assert $state equals 126 # 126 is the error code for permission denied
assert "$output" contains "permission denied:"
}
# vim:ft=zsh:sw=2:sts=2:et:foldmarker={,}:foldmethod=marker

View file

@ -16,7 +16,7 @@
run zinit as"null" id-as"test/mv" mv"readme.md -> mv.md" for zdharma-continuum/null
assert $state equals 0
assert "$ZPLUGINS/test---mv/mv.md" is_file
assert "$ZPLUGINS/test---mv/mv.md" is_file
assert "$ZPLUGINS/test---mv/mv.md" is_readable
assert "$ZPLUGINS/test---mv/readme.md" not_exists
}
@test 'cp' {

View file

@ -24,7 +24,7 @@
run "$htop" --version; assert $state equals 0
}
@test 'bash' {
run zinit build for @bminor/bash; assert $state equals 0
run zinit build for @tianon/mirror-bash; assert $state equals 0
local bash="$ZBIN/bash"; assert $bash is_executable
run "$bash" --version; assert $state equals 0
}

View file

@ -46,13 +46,13 @@
setup_snippet_ok $state $output "$ZINIT[COMPLETIONS_DIR]"/_fd
}
@test 'tldr-completion::snippet' {
run install_completion 'tldr-completion/_tldr' 'dbrgn/tealdeer/main/completion/zsh_tealdeer'
run install_completion 'tldr-completion/_tldr' 'tealdeer-rs/tealdeer/main/completion/zsh_tealdeer'
setup_snippet_ok $state $output "$ZINIT[COMPLETIONS_DIR]"/_tldr
zinit delete --yes tldr-completion/_tldr; zinit cclear
}
@test 'tldr-completion::gh-r' {
artifact="$ZINIT[PLUGINS_DIR]/tldr-completion---gh-r"
run zinit for as"completion" from"gh-r" id-as'tldr-completion/gh-r' bpick"completions_zsh" mv"completions_zsh -> _tldr_ghr" pick"_tldr_ghr" @dbrgn/tealdeer
run zinit for as"completion" from"gh-r" id-as'tldr-completion/gh-r' bpick"completions_zsh" mv"completions_zsh -> _tldr_ghr" pick"_tldr_ghr" @tealdeer-rs/tealdeer
assert $state equals 0
assert "$artifact/_tldr_ghr" is_file
assert $artifact/_tldr_ghr is_readable
@ -65,7 +65,7 @@
cat<<EOF >$actual
alias foo=date
EOF
run zinit is-snippet link id-as'mysnippet' for $actual
run zinit is-snippet link nocompile id-as'mysnippet' for $actual
assert $state equals 0
assert "$output" contains "Setting up snippet"

View file

@ -691,20 +691,40 @@ ZINIT[EXTENDED_GLOB]=""
# BusyBox less lacks the -X and -i options, so it can use more
.zinit-pager() {
setopt LOCAL_OPTIONS EQUALS
# Quiet mode ? → no pager.
if (( OPTS[opt_-n,--no-pager] )) {
cat
# Check if a non-interactive mode has been requested, either via a flag or a global setting.
if (( OPTS[opt_-n,--no-pager] )) || [[ ${ZINIT[NO_PAGER]} = (1|true|on|yes) ]]; then
# NON-INTERACTIVE MODE
local max_lines=${ZINIT[NO_PAGER_MAX_LINES]}
# Check if a line limit is explicitly set and is a valid non-negative integer.
if [[ $max_lines =~ ^[0-9]+$ ]]; then
if (( max_lines > 0 )); then
# A positive number means limit the output to that many lines.
head -n "$max_lines"
else
# A value of 0 means suppress all output from the pager completely.
# `cat > /dev/null` is the most robust way to achieve this.
cat > /dev/null
fi
else
# No valid line limit is set, so show the full output without interaction.
cat
fi
return 0
}
if [[ ${${:-=less}:A:t} = busybox* ]] {
more 2>/dev/null
(( ${+commands[more]} ))
} else {
less -FRXi 2>/dev/null
(( ${+commands[less]} ))
}
(( $? )) && cat
return 0
else
# INTERACTIVE MODE (Original Behavior)
# Fall back to the default interactive pager if no non-interactive mode is set.
if [[ ${${:-=less}:A:t} = busybox* ]] {
more 2>/dev/null
(( ${+commands[more]} ))
} else {
less -FRXi 2>/dev/null
(( ${+commands[less]} ))
}
(( $? )) && cat
return 0
fi
} # ]]]
# FUNCTION: .zinit-build-module [[[
@ -1602,7 +1622,7 @@ EOF
—— unload ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} unload plugin loaded with \`zinit load ...', -q quiet
—— update [-q] ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]}|URL Git update plugin or snippet (or all plugins and snippets if ——all passed); besides -q accepts also ——quiet, and also -r/--reset this option causes to run git reset --hard / svn revert before pulling changes
—— version display zinit version
—— zstatus overall Zinit statu
—— zstatus overall Zinit status
—— add-fpath|fpath ${ZINIT[col-info]}[-f|--front]${ZINIT[col-rst]} \\
${ZINIT[col-pname]}plg-spec ${ZINIT[col-info]}[subdirectory]${ZINIT[col-rst]} adds given plugin directory to \$fpath; if the second argument is given, it is appended to the directory path; if the option -f/--front is given, the directory path is prepended instead of appended to \$fpath. The ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} can be absolute path
—— run [-l] [plugin] {command} runs the given command in the given plugin's directory; if the option -l will be given then the plugin should be skipped the option will cause the previous plugin to be reused"
@ -1969,14 +1989,19 @@ print -- "\nAvailable ice-modifiers:\n\n${ice_order[*]}"
[[ $1 = -q ]] && +zi-log "{pre}[self-update]{info} updating zinit repository{msg2}" \
local nl=$'\n' escape=$'\x1b['
local current_branch=$(git -C $ZINIT[BIN_DIR] rev-parse --abbrev-ref HEAD)
# local current_branch='main'
# Dynamically get the current branch name for logging and pulling
local current_branch=$(command git -C $ZINIT[BIN_DIR] rev-parse --abbrev-ref HEAD)
# Warn if user is not on main (requested by maintainer)
if [[ -n $current_branch && $current_branch != main ]]; then
+zi-log "{pre}[self-update]{warn} non-{obj}main{warn} branch detected: {obj}${current_branch}{warn}. Self-update will pull from the branchs configured upstream.{rst}"
fi
local -a lines
(
builtin cd -q "$ZINIT[BIN_DIR]" \
&& +zi-log -n "{pre}[self-update]{info} fetching latest changes from {obj}$current_branch{info} branch$nl{rst}" \
&& command git fetch --quiet \
&& lines=( ${(f)"$(command git log --color --date=short --pretty=format:'%Cgreen%cd %h %Creset%s %Cred%d%Creset || %b' ..origin/HEAD)"} )
&& lines=( ${(f)"$(command git log --color --date=short --pretty=format:'%Cgreen%cd %h %Creset%s %Cred%d%Creset || %b' ..@\{u\})"} )
# Use '..@{u}' which refers to the configured upstream branch, instead of '..origin/HEAD'
if (( ${#lines} > 0 )); then
# Remove the (origin/main ...) segments, to expect only tags to appear
lines=( "${(S)lines[@]//\(([,[:blank:]]#(origin|HEAD|master|main)[^a-zA-Z]##(HEAD|origin|master|main)[,[:blank:]]#)#\)/}" )
@ -1992,10 +2017,11 @@ print -- "\nAvailable ice-modifiers:\n\n${ice_order[*]}"
builtin print -rl -- "${lines[@]}" | .zinit-pager
builtin print
fi
# Do not use hardcoded 'origin main' to let git use the configured upstream
if [[ $1 != -q ]] {
command git pull --no-stat --ff-only origin main
command git pull --no-stat --ff-only
} else {
command git pull --no-stat --quiet --ff-only origin main
command git pull --no-stat --quiet --ff-only
}
)
if [[ $1 != -q ]] {
@ -3168,7 +3194,7 @@ print -- "\nAvailable ice-modifiers:\n\n${ice_order[*]}"
}
}
if [[ -d $local_dir/.git ]] && ( builtin cd -q $local_dir ; git show-ref --verify --quiet refs/heads/main ); then
if [[ -d $local_dir/.git ]] && ( builtin cd -q $local_dir ; command git show-ref --verify --quiet refs/heads/main ); then
local main_branch=main
else
local main_branch=master
@ -3264,10 +3290,11 @@ print -- "\nAvailable ice-modifiers:\n\n${ice_order[*]}"
fi
if [[ -n ${(v)ice[(I)(mv|cp|atpull|ps-on-update|cargo)]} || $+ice[sbin]$+ice[make]$+ice[extract]$+ice[configure] -ne 0 ]] {
if (( !OPTS[opt_-q,--quiet] && ZINIT[annex-multi-flag:pull-active] == 1 )) {
+zi-log -n "{pre}[update]{msg3} Continuing with the update because "
(( ${+ice[run-atpull]} )) && \
+zi-log "{ice}run-atpull{apo}''{msg3} ice given.{rst}" || \
+zi-log "{opt}-u{msg3}/{opt}--urge{msg3} given.{rst}"
if (( ${+ice[run-atpull]} )); then
+zi-log "{info}[{pre}update{info}]{rst} No new commits found, but running post-update hooks as requested by the {ice}run-atpull{apo}{rst} ice."
else
+zi-log "{info}[{pre}update{info}]{rst} No new commits found, but running post-update hooks as requested by the {opt}-u{rst}/{opt}--urge{rst} option."
fi
}
}
@ -3574,7 +3601,7 @@ print -- "\nAvailable ice-modifiers:\n\n${ice_order[*]}"
#
# User-action entry point.
zi::version() {
+zi-log "zinit{cmd} $(git --git-dir=$(realpath ${ZINIT[BIN_DIR]}/.git) describe --tags) {rst}(${OSTYPE}_${CPUTYPE})"
+zi-log "zinit{cmd} $(command git --git-dir=$(realpath ${ZINIT[BIN_DIR]}/.git) describe --tags) {rst}(${OSTYPE}_${CPUTYPE})"
return $?
} # ]]]

View file

@ -356,7 +356,8 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
if [[ $site = */releases ]] {
local tag_version=${ICE[ver]}
if [[ -z $tag_version ]]; then
tag_version="$({.zinit-download-file-stdout $site/latest || .zinit-download-file-stdout $site/latest 1;} 2>/dev/null | command grep -i -m 1 -o 'href=./'$user'/'$plugin'/releases/tag/[^"]\+')"
local url="https://$site/latest"
tag_version="$({.zinit-download-file-stdout $url || .zinit-download-file-stdout $url 1;} 2>/dev/null | command grep -i -m 1 -o 'href=./'$user'/'$plugin'/releases/tag/[^"]\+')"
tag_version=${tag_version##*/}
fi
local url=$site/expanded_assets/$tag_version
@ -414,11 +415,17 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
) || return $?
} elif [[ $tpe = github ]] {
case ${ICE[proto]} in
(|https|git|http|ftp|ftps|rsync|ssh)
(|ftp(|s)|git|http(|s)|rsync|ssh)
:zinit-git-clone() {
local clone_url
if [[ ${ICE[proto]} == "ssh" ]]; then
clone_url="git@${site:-${ICE[from]:-github.com}}:$remote_url_path"
else
clone_url="${ICE[proto]:-https}://${site:-${ICE[from]:-github.com}}/$remote_url_path"
fi
command git clone --progress ${(s: :)ICE[cloneopts]---recursive} \
${(s: :)ICE[depth]:+--depth ${ICE[depth]}} \
"${ICE[proto]:-https}://${site:-${ICE[from]:-github.com}}/$remote_url_path" \
"$clone_url" \
"$local_path" \
--config transfer.fsckobjects=false \
--config receive.fsckobjects=false \
@ -889,8 +896,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
ZINIT[annex-multi-flag:pull-active]=${${${(M)update:#-u}:+${ZINIT[annex-multi-flag:pull-active]}}:-2}
(
if [[ $url = (http|https|ftp|ftps|scp)://* ]] {
# URL
if [[ $url = (ftp(|s)|http(|s)|scp)://* ]] {
(
() { setopt localoptions noautopushd; builtin cd -q "$local_dir"; } || return 4
@ -1440,14 +1446,29 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
if [[ -z $urlpart ]]; then
local tag_version=${ICE[ver]}
if [[ -z $tag_version ]]; then
local releases_url=https://github.com/$user/$plugin/releases/latest
tag_version="$( { .zinit-download-file-stdout $releases_url || .zinit-download-file-stdout $releases_url 1; } 2>/dev/null | command grep -m1 -o 'href=./'$user'/'$plugin'/releases/tag/[^"]\+' )"
# Try GitHub API first, fallback to HTML parsing
local api_url=https://api.github.com/repos/$user/$plugin/releases/latest
tag_version="$( { .zinit-download-file-stdout $api_url || .zinit-download-file-stdout $api_url 1; } 2>/dev/null | command grep -o '"tag_name"[[:space:]]*:[[:space:]]*"[^"]\+"' | command grep -o '"[^"]*"$' | tr -d '"' )"
# Fallback to original method if API fails
if [[ -z $tag_version ]]; then
local releases_url=https://github.com/$user/$plugin/releases/latest
tag_version="$( { .zinit-download-file-stdout $releases_url || .zinit-download-file-stdout $releases_url 1; } 2>/dev/null | command grep -m1 -o 'href=./'$user'/'$plugin'/releases/tag/[^"]\+' )"
fi
tag_version=${tag_version##*/}
fi
local url=https://github.com/$user/$plugin/releases/expanded_assets/$tag_version
else
local url=https://$urlpart
fi
if [[ "${ICE[bpick]}" == "src" ]]; then
+zi-log "{dbg} {b}gh-r{rst}: bpick\"src\" detected, targeting source code tarball for tag: {version}$tag_version{rst}"
# Construct the URL path for the auto-generated source code archive
reply=( "/$user/$plugin/archive/refs/tags/$tag_version.tar.gz" )
# Ensure the reply isn't empty if tag_version was somehow missed
[[ -n "$tag_version" ]] && return 0
+zi-log "{e} {b}gh-r{rst}: Could not determine tag version, cannot use bpick\"src\"."
return 1
fi
init_list=( ${(@f)"$( { .zinit-download-file-stdout $url || .zinit-download-file-stdout $url 1; } 2>/dev/null | command grep -i -o 'href=./'$user'/'$plugin'/releases/download/[^"]\+')"} )
init_list=(${(L)init_list[@]#href=?})
bpicks=(${(s.;.)ICE[bpick]})
@ -2256,78 +2277,68 @@ __zinit-cmake-base-hook () {
.zinit-extract plugin "$extract" "$dir"
} # ]]]
# FUNCTION: ∞zinit-cp-mv-operation-hook [[[
∞zinit-file-cp-mv-operation() {
local cmd="$1" # Either "cp" or "mv"
local ice_key="$cmd"
[[ -z $ICE[$ice_key] ]] && return 0
[[ "$2" = plugin ]] && \
local dir="${6#%}" hook="$7" subtype="$8" || \
local dir="${5#%}" hook="$6" subtype="$7"
# Parse and clean up the ICE directive
local -a pairs
pairs=( ${(s[;])ICE[$ice_key]} ) # Split on semicolons
pairs=( "${pairs[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" ) # Trim spaces
local pair retval=0
for pair in "${pairs[@]}"; do
if [[ $pair == *("->"|"→")* ]]; then
local from="${pair%%[[:space:]]#(->|→)*}"
local to="${pair##*(->|→)[[:space:]]#}"
else
local from="${pair%%[[:space:]]##*}"
local to="${pair##*[[:space:]]##}"
fi
@zinit-substitute from to
local -a cmd_args=("-f")
local -a afr
(
() { setopt localoptions noautopushd; builtin cd -q "$dir"; } || return 1
afr=( ${~from}(DN) ) # Expand glob patterns
if (( ! ${#afr} )); then
+zi-log "{warn}Warning: $ice_key ice didn't match any file. [{error}$pair{warn}]" \
"{nl}{warn}Available files:{nl}{obj}$(ls -1)"
retval=1
continue
fi
if (( !OPTS[opt_-q,--quiet] )); then
cmd_args+=("-v")
fi
for file in "${afr[@]}"; do
command "$cmd" "${cmd_args[@]}" "$file" "$to" || retval=$?
# Handle .zwc files if they exist
command "$cmd" "${cmd_args[@]}" "$file.zwc" "$to.zwc" 2>/dev/null
done
)
done
return $retval
} # ]]]
# FUNCTION: ∞zinit-mv-hook [[[
∞zinit-mv-hook() {
[[ -z $ICE[mv] ]] && return 0
[[ "$1" = plugin ]] && \
local dir="${5#%}" hook="$6" subtype="$7" || \
local dir="${4#%}" hook="$5" subtype="$6"
if [[ $ICE[mv] == *("->"|"→")* ]] {
local from=${ICE[mv]%%[[:space:]]#(->|→)*} to=${ICE[mv]##*(->|→)[[:space:]]#} || \
} else {
local from=${ICE[mv]%%[[:space:]]##*} to=${ICE[mv]##*[[:space:]]##}
}
@zinit-substitute from to
local -a mv_args=("-f")
local -a afr
(
() { setopt localoptions noautopushd; builtin cd -q "$dir"; } || return 1
afr=( ${~from}(DN) )
if (( ! ${#afr} )) {
+zi-log "{warn}Warning: mv ice didn't match any file. [{error}$ICE[mv]{warn}]" \
"{nl}{warn}Available files:{nl}{obj}$(ls -1)"
return 1
}
if (( !OPTS[opt_-q,--quiet] )) {
mv_args+=("-v")
}
command mv "${mv_args[@]}" "${afr[1]}" "$to"
local retval=$?
command mv "${mv_args[@]}" "${afr[1]}".zwc "$to".zwc 2>/dev/null
return $retval
)
∞zinit-file-cp-mv-operation "mv" "$@"
} # ]]]
# FUNCTION: ∞zinit-cp-hook [[[
∞zinit-cp-hook() {
[[ -z $ICE[cp] ]] && return
[[ "$1" = plugin ]] && \
local dir="${5#%}" hook="$6" subtype="$7" || \
local dir="${4#%}" hook="$5" subtype="$6"
if [[ $ICE[cp] == *("->"|"→")* ]] {
local from=${ICE[cp]%%[[:space:]]#(->|→)*} to=${ICE[cp]##*(->|→)[[:space:]]#} || \
} else {
local from=${ICE[cp]%%[[:space:]]##*} to=${ICE[cp]##*[[:space:]]##}
}
@zinit-substitute from to
local -a afr retval
( () { setopt localoptions noautopushd; builtin cd -q "$dir"; } || return 1
afr=( ${~from}(DN) )
if (( ${#afr} )) {
if (( !OPTS[opt_-q,--quiet] )) {
command cp -vf "${afr[1]}" "$to"
retval=$?
# ignore errors if no compiled file is found
command cp -vf "${afr[1]}".zwc "$to".zwc 2>/dev/null
} else {
command cp -f "${afr[1]}" "$to"
retval=$?
# ignore errors if no compiled file is found
command cp -f "${afr[1]}".zwc "$to".zwc 2>/dev/null
}
}
return $retval
)
∞zinit-file-cp-mv-operation "cp" "$@"
} # ]]]
# FUNCTION: ∞zinit-compile-plugin-hook [[[
∞zinit-compile-plugin-hook () {

View file

@ -63,7 +63,9 @@ if [[ -z ${ZINIT[HOME_DIR]} ]]; then
fi
if [[ -z ${ZINIT[LIST_COMMAND]} ]]; then
if (( ${+commands[exa]} )); then
if (( ${+commands[eza]} )); then
ZINIT[LIST_COMMAND]='eza --color=always --tree --icons -L3'
elif (( ${+commands[exa]} )); then
ZINIT[LIST_COMMAND]='exa --color=always --tree --icons -L3'
elif (( ${+commands[tree]} )); then
ZINIT[LIST_COMMAND]='tree -L 3 -C --charset utf-8'
@ -147,6 +149,12 @@ typeset -g ZPFX
ZINIT[PLUGINS_DIR]=${~ZINIT[PLUGINS_DIR]} ZINIT[COMPLETIONS_DIR]=${~ZINIT[COMPLETIONS_DIR]}
ZINIT[SNIPPETS_DIR]=${~ZINIT[SNIPPETS_DIR]} ZINIT[SERVICES_DIR]=${~ZINIT[SERVICES_DIR]}
# 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}/zinit"
fi
export ZPFX=${~ZPFX} ZSH_CACHE_DIR="${ZSH_CACHE_DIR:-${XDG_CACHE_HOME:-$HOME/.cache}/zinit}" \
PMSPEC=0uUpiPsf
[[ -z ${path[(re)$ZPFX/bin]} ]] && [[ -d "$ZPFX/bin" ]] && path=( "$ZPFX/bin" "${path[@]}" )
@ -163,6 +171,11 @@ hash -d zpfx=${ZINIT[HOME_DIR]}/polaris
[[ ! -d $ZSH_CACHE_DIR ]] && command mkdir -p "$ZSH_CACHE_DIR"
[[ -n ${ZINIT[ZCOMPDUMP_PATH]} ]] && ZINIT[ZCOMPDUMP_PATH]=${~ZINIT[ZCOMPDUMP_PATH]}
# Create "$ZSH_CACHE_DIR/completions" directory
[[ ! -d "$ZSH_CACHE_DIR/completions" ]] && command mkdir -p "$ZSH_CACHE_DIR/completions"
# Add "$ZSH_CACHE_DIR/completions" diretory to fpath
[[ -z ${fpath[(re)$ZSH_CACHE_DIR/completions]} ]] && fpath=( "$ZSH_CACHE_DIR/completions" "${fpath[@]}" )
ZINIT[UPAR]=";:^[[A;:^[OA;:\\e[A;:\\eOA;:${termcap[ku]/$'\e'/^\[};:${terminfo[kcuu1]/$'\e'/^\[};:"
ZINIT[DOWNAR]=";:^[[B;:^[OB;:\\e[B;:\\eOB;:${termcap[kd]/$'\e'/^\[};:${terminfo[kcud1]/$'\e'/^\[};:"
ZINIT[RIGHTAR]=";:^[[C;:^[OC;:\\e[C;:\\eOC;:${termcap[kr]/$'\e'/^\[};:${terminfo[kcuf1]/$'\e'/^\[};:"
@ -1430,8 +1443,10 @@ builtin setopt noaliases
)
for key in "${reply[@]}"; do
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]:-$ZINIT_EXTS2[$key]}[@]}" )
"${arr[5]}" snippet "$save_url" "$id_as" "$local_dir/$dirname" "${${key##(zinit|z-annex) hook:}%% <->}" load || \
return $(( 10 - $? ))
if [[ -n "${arr[5]:-}" ]]; then
"${arr[5]}" snippet "$save_url" "$id_as" "$local_dir/$dirname" "${${key##(zinit|z-annex) hook:}%% <->}" load || \
return $(( 10 - $? ))
fi
done
# Download or copy the file.
@ -1634,8 +1649,10 @@ builtin setopt noaliases
)
for ___key in "${reply[@]}"; do
___arr=( "${(Q)${(z@)ZINIT_EXTS[$___key]:-$ZINIT_EXTS2[$___key]}[@]}" )
"${___arr[5]}" plugin "$___user" "$___plugin" "$___id_as" "$___pdir_orig" "${${___key##(zinit|z-annex) hook:}%% <->}" load || \
return $(( 10 - $? ))
if [[ -n "${___arr[5]:-}" ]]; then
"${___arr[5]}" plugin "$___user" "$___plugin" "$___id_as" "$___pdir_orig" "${${___key##(zinit|z-annex) hook:}%% <->}" load || \
return $(( 10 - $? ))
fi
done
if [[ $___user != % && ! -d ${ZINIT[PLUGINS_DIR]}/${___id_as//\//---} ]] {