feat: expand linted file types to markdown and shell

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
This commit is contained in:
Vladislav Doster 2022-04-17 17:26:08 -05:00
parent 704f4beca0
commit 96fe03f85b
9 changed files with 711 additions and 731 deletions

View file

@ -1,47 +1,38 @@
name: 👮 linting
on: [push, pull_request, workflow_dispatch]
jobs:
build-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: "📡 Check out repository code"
uses: actions/checkout@v3
name: Lint
- name: "💬 Set matrix output"
id: set-matrix
run: |
MATRIX="$(find . -type d -name 'doc' -prune -o -type f -iname '*.zsh' -print | jq -ncR '{"include": [{"file": inputs}]}')"
echo "MATRIX=${MATRIX}" >&2
echo "::set-output name=matrix::${MATRIX}"
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
needs: build-matrix
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.build-matrix.outputs.matrix) }}
steps:
- name: "📡 Check out repository code"
uses: actions/checkout@v3
- uses: actions/checkout@v3
- name: "📦 Install dependencies"
- name: install dependencies
run: |
sudo apt install -y zsh
brew install shellcheck shfmt zsh
pip3 install --user linkify-it-py mdformat mdformat-config mdformat-gfm mdformat-shfmt mdformat-tables mdformat-toc
- name: "👓 zsh -n ${{ matrix.file }}"
env:
ZSH_FILE: ${{ matrix.file }}
run: |
zsh -n "${ZSH_FILE}"
- name: run mdformat
run: find . -name '*.md' -type f -print0 | xargs -0 -n1 -P4 python3 -m mdformat --check --wrap 120
- name: "💎 zcompile ${{ matrix.file }}"
env:
ZSH_FILE: ${{ matrix.file }}
run: |
zsh -fc "zcompile ${ZSH_FILE}"
rc=$?
ls -al "${ZSH_FILE}.zwc"
exit "$rc"
- name: run shfmt
run: find . -name '*.sh' -type f -print0 | xargs -0 -n1 -P4 shfmt -bn -ci -d -i 2 -ln bash -s -sr
- name: run shellcheck
run: find . -name '*.sh' -type f -print0 | xargs -0 -n1 -P4 shellcheck
- name: "run zsh"
run: find . -name '*.zsh' -type f -print0 | xargs -0 -n1 -P4 zsh -n
- name: "run zcompile"
run: find . -name '*.zsh' -type f -exec zsh -fc "zcompile {}" \;

435
README.md
View file

@ -1,22 +1,23 @@
<p align="center">
<a href="https://github.com/zdharma-continuum/zinit">
<img src="https://raw.githubusercontent.com/zdharma-continuum/zinit/images/zinit.png"/>
</a>
<a href="https://github.com/zdharma-continuum/zinit">
<img src="https://raw.githubusercontent.com/zdharma-continuum/zinit/images/zinit.png"/>
</a>
</p>
[![MIT License][mit-badge]][mit-link]
[![zinit version][ver-badge]][ver-link]
[![zunit tests][tests-badge]][tests-link]
[![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]
> **Note**: [The original author](https://github.com/psprint) of zinit deleted the `zdharma` organization randomly.
> **Note**: [The original author](https://github.com/psprint) of Zinit deleted the `zdharma` organization randomly.
>
> This is a reliable fork / place for the continuation of the project.
> This is a reliable fork/place for the continuation of the project.
>
> 🚧 For migration instructions please refer [to this wiki entry](https://github.com/zdharma-continuum/zinit/wiki/%F0%9F%9A%9A-Migration-to-zdharma-continuum)
> 🚧 For migration instructions please refer
> [to this wiki entry](https://github.com/zdharma-continuum/zinit/wiki/%F0%9F%9A%9A-Migration-to-zdharma-continuum)
<!-- START doctoc generated TOC please keep comment here to allow auto-update -->
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
- [News](#news)
@ -66,7 +67,7 @@
- [Supporting](#supporting)
- [Getting Help and Community](#getting-help-and-community)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- END doctoc generated TOC please keep comment here to allow auto-update -->
# News
@ -80,56 +81,45 @@ # Zinit
</a>
</p>
Zinit is a flexible and fast Zshell plugin manager that will allow you to
install everything from GitHub and other sites. Its characteristics are:
Zinit is a flexible and fast Zshell plugin manager that will allow you to install everything from GitHub and other
sites. Its characteristics are:
1. Zinit is currently the only plugin manager out there that provides Turbo mode
which yields **50-80% faster Zsh startup** (i.e.: the shell will start up to
**5** times faster!). Check out a speed comparison with other popular plugin
1. Zinit is currently the only plugin manager that provides Turbo mode, which yields **50-80% faster Zsh startup**
(i.e., the shell will start up to **5** times faster!). Check out a speed comparison with other popular plugin
managers [here](https://github.com/zdharma-continuum/pm-perf-test).
1. The plugin manager gives **reports** from plugin loadings describing what
**aliases**, functions, **bindkeys**, Zle widgets, zstyles, **completions**,
variables, `PATH` and `FPATH` elements a plugin has set up. This allows to
quickly familiarize oneself with a new plugin and provides rich and easy to
digest information which might be helpful on various occasions.
1. The plugin manager gives **reports** from plugin loadings describing what **aliases**, functions, **bindkeys**, Zle
widgets, zstyles, **completions**, variables, `PATH` and `FPATH` elements a plugin has set up. This allows one to
quickly familiarize oneself with a new plugin and provides rich and easy-to-digest information which might be helpful
on various occasions.
1. Supported is unloading of plugin and ability to list, (un)install and
**selectively disable**, **enable** plugin's completions.
1. Supported is the unloading of plugin and ability to list, (un)install and **selectively disable**, **enable**
plugin's completions.
1. The plugin manager supports loading Oh My Zsh and Prezto plugins and
libraries, however the implementation isn't framework specific and doesn't
bloat the plugin manager with such code (more on this topic can be found on
the Wiki, in the
[Introduction](https://zdharma-continuum.github.io/zinit/wiki/INTRODUCTION/#oh_my_zsh_prezto)).
1. The plugin manager supports loading plugins and libraries from Oh My Zsh or Prezto. However, the implementation isn't
framework-specific and doesn't bloat the plugin manager with such code (more on this topic can be found on the Wiki,
in the [Introduction](https://zdharma-continuum.github.io/zinit/wiki/INTRODUCTION/#oh_my_zsh_prezto)).
1. The system does not use `$FPATH`, loading multiple plugins doesn't clutter
`$FPATH` with the same number of entries (e.g. `10`, `15` or more). Code is
immune to `KSH_ARRAYS` and other options typically causing compatibility
problems.
1. The system does not use `$FPATH`, loading multiple plugins doesn't clutter `$FPATH` with the same number of entries
(e.g. `10`, `15` or more). Code is immune to `KSH_ARRAYS` and other options typically causing compatibility problems.
1. Zinit supports special, dedicated **packages** that offload the user from
providing long and complex commands. See the
[zinit-packages repository](https://github.com/zdharma-continuum/zinit-packages)
for a growing, complete list of Zinit packages and the [Wiki
page](https://zdharma-continuum.github.io/zinit/wiki/Zinit-Packages/) for an article about
the feature.
1. Zinit supports special, dedicated **packages** that offload the user from providing long and complex commands. See
the [zinit-packages repository](https://github.com/zdharma-continuum/zinit-packages) for a growing, complete list of
Zinit packages and the [Wiki page](https://zdharma-continuum.github.io/zinit/wiki/Zinit-Packages/) for an article
about the feature.
1. Also, specialized Zinit extensions — called **annexes** — allow to extend the
plugin manager with new commands, URL-preprocessors (used by e.g.:
[zinit-annex-readurl](https://github.com/zdharma-continuum/zinit-annex-readurl) annex),
post-install and post-update hooks and much more. See the
[zdharma-continuum](https://github.com/zdharma-continuum) organization for a growing,
complete list of available Zinit extensions and refer to the [Wiki
article](https://zdharma-continuum.github.io/zinit/wiki/Annexes/) for an introduction on
creating your own annex.
1. Also, specialized Zinit extensions — called **annexes** — have the ability to extend the plugin manager with new
commands, URL-preprocessors (used by e.g.:
[zinit-annex-readurl](https://github.com/zdharma-continuum/zinit-annex-readurl) annex), post-install and post-update
hooks, and much more. See the [zdharma-continuum](https://github.com/zdharma-continuum) organization for a growing,
complete list of available Zinit extensions and refer to the
[Wiki article](https://zdharma-continuum.github.io/zinit/wiki/Annexes/) for an introduction on creating your annex.
# Zinit Wiki
The information in this README is complemented by the [Zinit
Wiki](https://zdharma-continuum.github.io/zinit/wiki/). The README is an introductory overview of
Zinit while the Wiki gives a complete information with examples. Make sure to
read it to get the most out of Zinit.
The information in this README is complemented by the [Zinit Wiki](https://zdharma-continuum.github.io/zinit/wiki/). The
README is an introductory overview of Zinit, while the Wiki gives complete information with examples. Make sure to read
it to get the most out of Zinit.
# Quick Start
@ -143,15 +133,18 @@ ### Automatic Installation (Recommended)
sh -c "$(curl -fsSL https://git.io/zinit-install)"
```
This will install Zinit in `~/.local/share/zinit/zinit.git`.
`.zshrc` will be updated with three lines of code that will be added to the bottom.
The lines will be sourcing `zinit.zsh` and setting up completion for command `zinit`.
This will install Zinit in `~/.local/share/zinit/zinit.git`. `.zshrc` will be updated with three lines of code that will
be added to the bottom. The lines will be sourcing `zinit.zsh` and setting up completion for command `zinit`.
After installing and reloading the shell compile Zinit with `zinit self-update`.
After installing and reloading the shell, compile Zinit via:
```zsh
zinit self-update
```
### Manual Installation
To manually install Zinit clone the repo to e.g. `~/.local/share/zinit/zinit.git`:
To manually install Zinit, clone the repo to, e.g. `~/.local/share/zinit/zinit.git`:
```sh
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
@ -159,7 +152,8 @@ ### Manual Installation
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
```
and source `zinit.zsh` from your `.zshrc` (above [compinit](http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Initialization)):
and source `zinit.zsh` from your `.zshrc` (above
[compinit](http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Initialization)):
```sh
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
@ -168,24 +162,26 @@ ### Manual Installation
If you place the `source` below `compinit`, then add those two lines after the `source`:
```sh
```zsh
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
```
Various paths can be customized, see section [Customizing Paths](#customizing-paths).
Various paths can be customized; see section [Customizing Paths](#customizing-paths).
After installing and reloading the shell compile Zinit with `zinit self-update`.
After installing and reloading the shell, compile Zinit with `zinit self-update`.
## Usage
### Introduction
[Click here to read the introduction to Zinit](https://zdharma-continuum.github.io/zinit/wiki/INTRODUCTION/). It explains basic usage and some of the more unique features of Zinit such as the Turbo mode. If you're new to Zinit we highly recommend you read it at least once.
[Click here to read the introduction to Zinit](https://zdharma-continuum.github.io/zinit/wiki/INTRODUCTION/). It
explains basic usage and some of the more unique features of Zinit, such as the Turbo mode. If you're new to Zinit, we
recommend you read it at least once.
### Plugins and snippets
Plugins can be loaded using `load` or `light`.
Plugins can be loaded using `load` or `light`.
```zsh
zinit load <repo/plugin> # Load with reporting/investigating.
@ -198,9 +194,8 @@ ### Plugins and snippets
zinit snippet <URL>
```
Such lines should be added to `.zshrc`. Snippets are cached locally, use `-f` option to download
a fresh version of a snippet, or `zinit update {URL}`. Can also use `zinit update --all` to
update all snippets (and plugins).
Such lines should be added to `.zshrc`. Snippets are cached locally. Use the `-f` option to download a new version of a
snippet or `zinit update {URL}`. You can also use `zinit update --all` to update all snippets (and plugins).
**Example**
@ -218,7 +213,8 @@ # Snippet
**Prompt(Theme) Example**
This is [powerlevel10k](https://github.com/romkatv/powerlevel10k), [pure](https://github.com/sindresorhus/pure), [starship](https://github.com/starship/starship) sample:
This is [powerlevel10k](https://github.com/romkatv/powerlevel10k), [pure](https://github.com/sindresorhus/pure),
[starship](https://github.com/starship/starship) sample:
```zsh
# Load powerlevel10k theme
@ -265,7 +261,7 @@ ### Turbo and lucid
Usually used as `zinit ice wait"<SECONDS>"`, let's use the previous example:
```zsh
zinit ice wait # wait is same wait"0"
zinit ice wait # wait is the same as wait"0"
zinit load zdharma-continuum/history-search-multi-word
zinit ice wait"2" # load after 2 seconds
@ -282,7 +278,7 @@ ### Turbo and lucid
Turbo mode is verbose, so you need an option for quiet.
You can use with `lucid`:
You can use `lucid`:
```zsh
zinit ice wait lucid
@ -293,8 +289,8 @@ ### Turbo and lucid
***F&A:*** What is `ice`?
`ice` is zinit's option command. The option melts like ice and is used only once.
(more: [Ice Modifiers](#ice-modifiers))
`ice` is zinit's options command. The option melts like ice and is used only once. (more:
[Ice Modifiers](#ice-modifiers))
### Migration
@ -313,7 +309,8 @@ ### Migration
**Library**
Importing the [clipboard](https://github.com/ohmyzsh/ohmyzsh/blob/master/lib/clipboard.zsh) and [termsupport](https://github.com/ohmyzsh/ohmyzsh/blob/master/lib/termsupport.zsh) Oh-My-Zsh Library Sample:
Importing the [clipboard](https://github.com/ohmyzsh/ohmyzsh/blob/master/lib/clipboard.zsh) and
[termsupport](https://github.com/ohmyzsh/ohmyzsh/blob/master/lib/termsupport.zsh) Oh-My-Zsh Library Sample:
```zsh
# Raw Syntax
@ -333,16 +330,15 @@ # OMZL Shorthand Syntax
To use **themes** created for Oh My Zsh you might want to first source the `git` library there.
Then you can use the themes as snippets (`zinit snippet <file path or GitHub URL>`).
Some themes require not only Oh My Zsh's Git **library**, but also Git **plugin** (error
about `current_branch` may appear). Load this Git-plugin as single-file
snippet directly from OMZ.
Then you can use the themes as snippets (`zinit snippet <file path or GitHub URL>`). Some themes require not only Oh My
Zsh's Git **library**, but also Git **plugin** (error about `current_branch` may appear). Load this Git-plugin as
single-file snippet directly from OMZ.
Most themes require `promptsubst` option (`setopt promptsubst` in `zshrc`), if it isn't set, then
prompt will appear as something like: `... $(build_prompt) ...`.
Most themes require `promptsubst` option (`setopt promptsubst` in `zshrc`), if it isn't set, then prompt will appear as
something like: `... $(build_prompt) ...`.
You might want to suppress completions provided by the git plugin by issuing `zinit cdclear -q`
(`-q` is for quiet)  see below **Ignoring Compdefs**.
You might want to suppress completions provided by the git plugin by issuing `zinit cdclear -q` (`-q` is for quiet)
see below **Ignoring Compdefs**.
To summarize:
@ -384,9 +380,11 @@ # Load Prompt
zinit light NicoSantangelo/Alpharized
```
***F&A:*** Error occurs when loading OMZ's theme.
***FAQ***
If the `git` library will not be loaded, then similar to following errors will be appearing:
Error occurs when loading OMZ's theme.
If the `git` library will not be loaded, the following errors will appear:
```zsh
........:1: command not found: git_prompt_status
@ -415,8 +413,9 @@ ## Zinit Setting
zinit snippet OMZP::ruby
```
Use `zinit ice svn` if multiple files require an entire subdirectory.
Like [gitfast](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/gitfast), [osx](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/osx):
Use `zinit ice svn` if multiple files require an entire subdirectory. Like
[gitfast](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/gitfast),
[osx](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/osx):
```zsh
zinit ice svn
@ -426,8 +425,9 @@ ## Zinit Setting
zinit snippet OMZP::osx
```
Use `zinit ice as"completion"` to directly add single file completion snippets.
Like [docker](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/docker), [fd](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/fd):
Use `zinit ice as"completion"` to directly add single file completion snippets. Like
[docker](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/docker),
[fd](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/fd):
```zsh
zinit ice as"completion"
@ -454,7 +454,8 @@ ## Zinit Setting
**Modules**
Importing the [environment](https://github.com/sorin-ionescu/prezto/tree/master/modules/environment) and [terminal](https://github.com/sorin-ionescu/prezto/tree/master/modules/terminal) Prezto Modules Sample:
Importing the [environment](https://github.com/sorin-ionescu/prezto/tree/master/modules/environment) and
[terminal](https://github.com/sorin-ionescu/prezto/tree/master/modules/terminal) Prezto Modules Sample:
```zsh
## Prezto Setting
@ -474,8 +475,9 @@ # PZTM Shorthand Syntax
zinit snippet PZTM::terminal
```
Use `zinit ice svn` if multiple files require an entire subdirectory.
Like [docker](https://github.com/sorin-ionescu/prezto/tree/master/modules/docker), [git](https://github.com/sorin-ionescu/prezto/tree/master/modules/git):
Use `zinit ice svn` if multiple files require an entire subdirectory. Like
[docker](https://github.com/sorin-ionescu/prezto/tree/master/modules/docker),
[git](https://github.com/sorin-ionescu/prezto/tree/master/modules/git):
```zsh
zinit ice svn
@ -485,16 +487,16 @@ # PZTM Shorthand Syntax
zinit snippet PZTM::git
```
Use `zinit ice as"null"` if don't exist `*.plugin.zsh`, `init.zsh`, `*.zsh-theme*` files in module.
Like [archive](https://github.com/sorin-ionescu/prezto/tree/master/modules/archive):
Use `zinit ice as"null"` if don't exist `*.plugin.zsh`, `init.zsh`, `*.zsh-theme*` files in module. Like
[archive](https://github.com/sorin-ionescu/prezto/tree/master/modules/archive):
```zsh
zinit ice svn as"null"
zinit snippet PZTM::archive
```
Use `zinit ice atclone"git clone <repo> <location>"` if module have external module.
Like [completion](https://github.com/sorin-ionescu/prezto/tree/master/modules/completion):
Use `zinit ice atclone"git clone <repo> <location>"` if module have external module. Like
[completion](https://github.com/sorin-ionescu/prezto/tree/master/modules/completion):
```shell
zplugin ice svn blockf \ # use blockf to prevent any unnecessary additions to fpath, as zinit manages fpath
@ -504,7 +506,8 @@ # PZTM Shorthand Syntax
***F&A:*** What is `zstyle`?
Read [zstyle](http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fzutil-Module) doc (more: [What does `zstyle` do?](https://unix.stackexchange.com/questions/214657/what-does-zstyle-do)).
Read [zstyle](http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fzutil-Module) doc (more:
[What does `zstyle` do?](https://unix.stackexchange.com/questions/214657/what-does-zstyle-do)).
</details>
@ -626,20 +629,20 @@ # grep operating system name and architecture automatically when there's no `bpi
zinit load docker/compose
# Vim repository on GitHub a typical source code that needs compilation Zinit
# can manage it for you if you like, run `./configure` and other `make`, etc. stuff.
# can manage it for you if you like, run `./configure` and other `make`, etc.
# Ice-mod `pick` selects a binary program to add to $PATH. You could also install the
# package under the path $ZPFX, see: https://zdharma-continuum.github.io/zinit/wiki/Compiling-programs
zinit ice as"program" atclone"rm -f src/auto/config.cache; ./configure" \
atpull"%atclone" make pick"src/vim"
zinit light vim/vim
# Scripts that are built at install (there's single default make target, "install",
# Scripts built at install (there's single default make target, "install",
# and it constructs scripts by `cat'ing a few files). The make'' ice could also be:
# `make"install PREFIX=$ZPFX"`, if "install" wouldn't be the only, default target.
# `make"install PREFIX=$ZPFX"`, if "install" wouldn't be the only default target.
zinit ice as"program" pick"$ZPFX/bin/git-*" make"PREFIX=$ZPFX"
zinit light tj/git-extras
# Handle completions without loading any plugin, see "clist" command.
# Handle completions without loading any plugin; see "clist" command.
# This one is to be ran just once, in interactive session.
zinit creinstall %HOME/my_completions
```
@ -661,15 +664,14 @@ # make'!...' -> run make before atclone & atpull
[You can see an extended explanation of direnv in the Wiki.](https://zdharma-continuum.github.io/zinit/wiki/Direnv-explanation/)
If you're interested in more examples then check out the [zinit-configs
repository](https://github.com/zdharma-continuum/zinit-configs) where users have uploaded their
If you're interested in more examples, then check out the
[zinit-configs repository](https://github.com/zdharma-continuum/zinit-configs), where users have uploaded their
`~/.zshrc` and Zinit configurations. Feel free to
[submit](https://github.com/zdharma-continuum/zinit-configs/issues/new?template=request-to-add-zshrc-to-the-zinit-configs-repo.md)
your `~/.zshrc` there if it contains Zinit commands.
You can also check out the [Gallery of Zinit
Invocations](https://zdharma-continuum.github.io/zinit/wiki/GALLERY/) for some additional
examples.
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
@ -679,52 +681,49 @@ # How to Use
## Ice Modifiers
Following `ice` modifiers are to be
[passed](https://zdharma-continuum.github.io/zinit/wiki/Alternate-Ice-Syntax/) to `zinit ice ...` to
obtain described effects. The word `ice` means something that's added (like ice to a
drink) and in Zinit it means adding modifier to a next `zinit` command, and also
something that's temporary because it melts and this means that the modification will
last only for a **single** next `zinit` command.
Following `ice` modifiers are to be [passed](https://zdharma-continuum.github.io/zinit/wiki/Alternate-Ice-Syntax/) to
`zinit ice ...` to obtain described effects. The word `ice` means something that's added (like ice to a drink) and in
Zinit it means adding modifier to a next `zinit` command, and also something that's temporary because it melts and
this means that the modification will last only for a **single** next `zinit` command.
Some Ice-modifiers are highlighted and clicking on them will take you to the
appropriate Wiki page for an extended explanation.
Some Ice-modifiers are highlighted and clicking on them will take you to the appropriate Wiki page for an extended
explanation.
You may safely assume a given ice works with both plugins and snippets unless
explicitly stated otherwise.
You may safely assume a given ice works with both plugins and snippets unless explicitly stated otherwise.
### Cloning Options
| Modifier | Description |
| :-------------------------------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `proto` | <div align="justify" style="text-align: justify;">Change protocol to `git`,`ftp`,`ftps`,`ssh`, `rsync`, etc. Default is `https`. **Does not work with snippets.** </div> |
| [**`from`**](https://zdharma-continuum.github.io/zinit/wiki/Private-Repositories/) | <div align="justify" style="text-align: justify;">Clone plugin from given site. Supported are `from"github"` (default), `..."github-rel"`, `..."gitlab"`, `..."bitbucket"`, `..."notabug"` (short names: `gh`, `gh-r`, `gl`, `bb`, `nb`). Can also be a full domain name (e.g. for GitHub enterprise). **Does not work with snippets.**</div> |
| `ver` | <div align="justify" style="text-align: justify;">Used with `from"gh-r"` (i.e. downloading a binary release, e.g. for use with `as"program"`) selects which version to download. Default is latest, can also be explicitly `ver"latest"`. Works also with regular plugins and packages (`pack` ice) checkouts e.g. `ver"abranch"`, i.e. a specific version. **Does not work with snippets.**</div> |
| `bpick` | <div align="justify" style="text-align: justify;">Used to select which release from GitHub Releases to download, e.g. `zini ice from"gh-r" as"program" bpick"*Darwin*"; zini load docker/compose`. **Does not work with snippets.** </div> |
| `depth` | <div align="justify" style="text-align: justify;">Pass `--depth` to `git`, i.e. limit how much of history to download. **Does not work with snippets.**</div> |
| `cloneopts` | <div align="justify" style="text-align: justify;">Pass the contents of `cloneopts` to `git clone`. Defaults to `--recursive`. I.e.: change cloning options. Pass empty ice to disable recursive cloning. **Does not work with snippets.** </div> |
| `pullopts` | <div align="justify" style="text-align: justify;">Pass the contents of `pullopts` to `git pull` used when updating plugins. **Does not work with snippets.** </div> |
| `svn` | <div align="justify" style="text-align: justify;">Use Subversion for downloading snippet. GitHub supports `SVN` protocol, this allows to clone subdirectories as snippets, e.g. `zinit ice svn; zinit snippet OMZP::git`. Other ice `pick` can be used to select file to source (default are: `*.plugin.zsh`, `init.zsh`, `*.zsh-theme`). **Does not work with plugins.**</div> |
| Modifier | Description |
| :--------------------------------------------------------------------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `proto` | <div align="justify" style="text-align: justify;">Change protocol to `git`,`ftp`,`ftps`,`ssh`, `rsync`, etc. Default is `https`. **Does not work with snippets.** </div> |
| [**`from`**](https://zdharma-continuum.github.io/zinit/wiki/Private-Repositories/) | <div align="justify" style="text-align: justify;">Clone plugin from given site. Supported are `from"github"` (default), `..."github-rel"`, `..."gitlab"`, `..."bitbucket"`, `..."notabug"` (short names: `gh`, `gh-r`, `gl`, `bb`, `nb`). Can also be a full domain name (e.g. for GitHub enterprise). **Does not work with snippets.**</div> |
| `ver` | <div align="justify" style="text-align: justify;">Used with `from"gh-r"` (i.e. downloading a binary release, e.g. for use with `as"program"`) selects which version to download. Default is latest, can also be explicitly `ver"latest"`. Works also with regular plugins and packages (`pack` ice) checkouts e.g. `ver"abranch"`, i.e. a specific version. **Does not work with snippets.**</div> |
| `bpick` | <div align="justify" style="text-align: justify;">Used to select which release from GitHub Releases to download, e.g. `zini ice from"gh-r" as"program" bpick"*Darwin*"; zini load docker/compose`. **Does not work with snippets.** </div> |
| `depth` | <div align="justify" style="text-align: justify;">Pass `--depth` to `git`, i.e. limit how much of history to download. **Does not work with snippets.**</div> |
| `cloneopts` | <div align="justify" style="text-align: justify;">Pass the contents of `cloneopts` to `git clone`. Defaults to `--recursive`. I.e.: change cloning options. Pass empty ice to disable recursive cloning. **Does not work with snippets.** </div> |
| `pullopts` | <div align="justify" style="text-align: justify;">Pass the contents of `pullopts` to `git pull` used when updating plugins. **Does not work with snippets.** </div> |
| `svn` | <div align="justify" style="text-align: justify;">Use Subversion for downloading snippet. GitHub supports `SVN` protocol, this allows to clone subdirectories as snippets, e.g. `zinit ice svn; zinit snippet OMZP::git`. Other ice `pick` can be used to select file to source (default are: `*.plugin.zsh`, `init.zsh`, `*.zsh-theme`). **Does not work with plugins.**</div> |
### Selection of Files (To Source, …)
| Modifier | Description |
| :-------------------------------------------------------------------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Modifier | Description |
| :--------------------------------------------------------------------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [**`pick`**](https://zdharma-continuum.github.io/zinit/wiki/Sourcing-multiple-files/) | <div align="justify" style="text-align: justify;">Select the file to source, or the file to set as command (when using `snippet --command` or the ice `as"program"`); it is a pattern, alphabetically first matched file is being chosen; e.g. `zinit ice pick"*.plugin.zsh"; zinit load …`.</div> |
| [**`src`**](https://zdharma-continuum.github.io/zinit/wiki/Sourcing-multiple-files) | <div align="justify" style="text-align: justify;">Specify additional file to source after sourcing main file or after setting up command (via `as"program"`). It is not a pattern but a plain file name.</div> |
| [**`multisrc`**](https://zdharma-continuum.github.io/zinit/wiki/Sourcing-multiple-files) | <div align="justify" style="text-align: justify;">Allows to specify multiple files for sourcing, enumerated with spaces as the separators (e.g. `multisrc'misc.zsh grep.zsh'`) and also using brace-expansion syntax (e.g. `multisrc'{misc,grep}.zsh'`). Supports patterns.</div> |
### Conditional Loading
| Modifier | Description |
| :---------------------------------------------------------------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Modifier | Description |
| :----------------------------------------------------------------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [**`wait`**](https://zdharma-continuum.github.io/zinit/wiki/Example-wait-conditions) | <div align="justify" style="text-align: justify;">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'`.</div> |
| [**`load`**](https://zdharma-continuum.github.io/zinit/wiki/Multiple-prompts) | <div align="justify" style="text-align: justify;">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* ]]'`.</div> |
| [**`unload`**](https://zdharma-continuum.github.io/zinit/wiki/Multiple-prompts) | <div align="justify" style="text-align: justify;">A condition to check causing plugin to unload. It will unload once, then only if loaded again. E.g.: `unload'[[ $PWD != */github* ]]'`.</div> |
| `cloneonly` | <div align="justify" style="text-align: justify;">Don't load the plugin / snippet, only download it </div> |
| `if` | <div align="justify" style="text-align: justify;">Load plugin or snippet only when given condition is fulfilled, for example: `zinit ice if'[[ -n "$commands[otool]" ]]'; zinit load ...`.</div> |
| `has` | <div align="justify" style="text-align: justify;">Load plugin or snippet only when given command is available (in $PATH), e.g. `zinit ice has'git' ...` </div> |
| `subscribe` / `on-update-of` | <div align="justify" style="text-align: justify;">Postpone loading of a plugin or snippet until the given file(s) get updated, e.g. `subscribe'{~/files-*,/tmp/files-*}'` </div> |
| `trigger-load` | <div align="justify" style="text-align: justify;">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 `;`.</div> |
| `cloneonly` | <div align="justify" style="text-align: justify;">Don't load the plugin / snippet, only download it </div> |
| `if` | <div align="justify" style="text-align: justify;">Load plugin or snippet only when given condition is fulfilled, for example: `zinit ice if'[[ -n "$commands[otool]" ]]'; zinit load ...`.</div> |
| `has` | <div align="justify" style="text-align: justify;">Load plugin or snippet only when given command is available (in $PATH), e.g. `zinit ice has'git' ...` </div> |
| `subscribe` / `on-update-of` | <div align="justify" style="text-align: justify;">Postpone loading of a plugin or snippet until the given file(s) get updated, e.g. `subscribe'{~/files-*,/tmp/files-*}'` </div> |
| `trigger-load` | <div align="justify" style="text-align: justify;">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 `;`.</div> |
### Plugin Output
@ -743,19 +742,19 @@ ### Completions
### Command Execution After Cloning, Updating or Loading
| Modifier | Description |
| :-------------------------------------------------------------------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mv` | <div align="justify" style="text-align: justify;">Move file after cloning or after update (then, only if new commits were downloaded). Example: `mv "fzf-* -> fzf"`. It uses `->` as separator for old and new file names. Works also with snippets.</div> |
| `cp` | <div align="justify" style="text-align: justify;">Copy file after cloning or after update (then, only if new commits were downloaded). Example: `cp "docker-c* -> dcompose"`. Ran after `mv`.</div> |
| Modifier | Description |
| :--------------------------------------------------------------------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mv` | <div align="justify" style="text-align: justify;">Move file after cloning or after update (then, only if new commits were downloaded). Example: `mv "fzf-* -> fzf"`. It uses `->` as separator for old and new file names. Works also with snippets.</div> |
| `cp` | <div align="justify" style="text-align: justify;">Copy file after cloning or after update (then, only if new commits were downloaded). Example: `cp "docker-c* -> dcompose"`. Ran after `mv`.</div> |
| [**`atclone`**](https://zdharma-continuum.github.io/zinit/wiki/atload-and-other-at-ices) | <div align="justify" style="text-align: justify;">Run command after cloning, within plugin's directory, e.g. `zinit ice atclone"echo Cloned"`. Ran also after downloading snippet.</div> |
| [**`atpull`**](https://zdharma-continuum.github.io/zinit/wiki/atload-and-other-at-ices) | <div align="justify" style="text-align: justify;">Run command after updating (**only if new commits are waiting for download**), within plugin's directory. If starts with "!" then command will be ran before `mv` & `cp` ices and before `git pull` or `svn update`. Otherwise it is ran after them. Can be `atpull'%atclone'`, to repeat `atclone` Ice-mod.</div> |
| [**`atinit`**](https://zdharma-continuum.github.io/zinit/wiki/atload-and-other-at-ices) | <div align="justify" style="text-align: justify;">Run command after directory setup (cloning, checking it, etc.) of plugin/snippet but before loading.</div> |
| [**`atload`**](https://zdharma-continuum.github.io/zinit/wiki/atload-and-other-at-ices) | <div align="justify" style="text-align: justify;">Run command after loading, within plugin's directory. Can be also used with snippets. Passed code can be preceded with `!`, it will then be investigated (if using `load`, not `light`).</div> |
| `run-atpull` | <div align="justify" style="text-align: justify;">Always run the atpull hook (when updating), not only when there are new commits to be downloaded.</div> |
| `nocd` | <div align="justify" style="text-align: justify;">Don't switch the current directory into the plugin's directory when evaluating the above ice-mods `atinit''`,`atload''`, etc.</div> |
| `run-atpull` | <div align="justify" style="text-align: justify;">Always run the atpull hook (when updating), not only when there are new commits to be downloaded.</div> |
| `nocd` | <div align="justify" style="text-align: justify;">Don't switch the current directory into the plugin's directory when evaluating the above ice-mods `atinit''`,`atload''`, etc.</div> |
| [**`make`**](https://zdharma-continuum.github.io/zinit/wiki/Installing-with-make) | <div align="justify" style="text-align: justify;">Run `make` command after cloning/updating and executing `mv`, `cp`, `atpull`, `atclone` Ice mods. Can obtain argument, e.g. `make"install PREFIX=/opt"`. If the value starts with `!` then `make` is ran before `atclone`/`atpull`, e.g. `make'!'`.</div> |
| `countdown` | <div align="justify" style="text-align: justify;">Causes an interruptable (by Ctrl-C) countdown 5…4…3…2…1…0 to be displayed before executing `atclone''`,`atpull''` and `make` ices</div> |
| `reset` | <div align="justify" style="text-align: justify;">Invokes `git reset --hard HEAD` for plugins or `svn revert` for SVN snippets before pulling any new changes. This way `git` or `svn` will not report conflicts if some changes were done in e.g.: `atclone''` ice. For file snippets and `gh-r` plugins it invokes `rm -rf *`.</div> |
| `countdown` | <div align="justify" style="text-align: justify;">Causes an interruptable (by Ctrl-C) countdown 5…4…3…2…1…0 to be displayed before executing `atclone''`,`atpull''` and `make` ices</div> |
| `reset` | <div align="justify" style="text-align: justify;">Invokes `git reset --hard HEAD` for plugins or `svn revert` for SVN snippets before pulling any new changes. This way `git` or `svn` will not report conflicts if some changes were done in e.g.: `atclone''` ice. For file snippets and `gh-r` plugins it invokes `rm -rf *`.</div> |
### Sticky-Emulation Of Other Shells
@ -768,26 +767,27 @@ ### Sticky-Emulation Of Other Shells
### Others
| Modifier | Description |
| :--------------------------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `as` | <div align="justify" style="text-align: justify;">Can be `as"program"` (also the alias: `as"command"`), and will cause to add script/program to `$PATH` instead of sourcing (see `pick`). Can also be `as"completion"` use with plugins or snippets in whose only underscore-starting `_*` files you are interested in. The third possible value is `as"null"` a shorthand for `pick"/dev/null" nocompletions` i.e.: it disables the default script-file sourcing and also the installation of completions.</div> |
| Modifier | Description |
| :---------------------------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `as` | <div align="justify" style="text-align: justify;">Can be `as"program"` (also the alias: `as"command"`), and will cause to add script/program to `$PATH` instead of sourcing (see `pick`). Can also be `as"completion"` use with plugins or snippets in whose only underscore-starting `_*` files you are interested in. The third possible value is `as"null"` a shorthand for `pick"/dev/null" nocompletions` i.e.: it disables the default script-file sourcing and also the installation of completions.</div> |
| [**`id-as`**](https://zdharma-continuum.github.io/zinit/wiki/id-as/) | <div align="justify" style="text-align: justify;">Nickname a plugin or snippet, to e.g. create a short handler for long-url snippet.</div> |
| `compile` | <div align="justify" style="text-align: justify;">Pattern (+ possible `{...}` expansion, like `{a/*,b*}`) to select additional files to compile, e.g. `compile"(pure\|async).zsh"` for `sindresorhus/pure`.</div> |
| `nocompile` | <div align="justify" style="text-align: justify;">Don't try to compile `pick`-pointed files. If passed the exclamation mark (i.e. `nocompile'!'`), then do compile, but after `make''` and `atclone''` (useful if Makefile installs some scripts, to point `pick''` at the location of their installation).</div> |
| `service` | <div align="justify" style="text-align: justify;">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-).</div> |
| `reset-prompt` | <div align="justify" style="text-align: justify;">Reset the prompt after loading the plugin/snippet (by issuing `zle .reset-prompt`). Note: normally it's sufficient to precede the value of `wait''` ice with `!`.</div> |
| `bindmap` | <div align="justify" style="text-align: justify;">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.**</div> |
| `trackbinds` | <div align="justify" style="text-align: justify;">Shadow but only `bindkey` calls even with `zinit light ...`, i.e. even with investigating disabled (fast loading), to allow `bindmap` to remap the key-binds. The same effect has `zinit light -b ...`, i.e. additional `-b` option to the `light`-subcommand. **Does not work with snippets.**</div> |
| `compile` | <div align="justify" style="text-align: justify;">Pattern (+ possible `{...}` expansion, like `{a/*,b*}`) to select additional files to compile, e.g. `compile"(pure\|async).zsh"` for `sindresorhus/pure`.</div> |
| `nocompile` | <div align="justify" style="text-align: justify;">Don't try to compile `pick`-pointed files. If passed the exclamation mark (i.e. `nocompile'!'`), then do compile, but after `make''` and `atclone''` (useful if Makefile installs some scripts, to point `pick''` at the location of their installation).</div> |
| `service` | <div align="justify" style="text-align: justify;">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-).</div> |
| `reset-prompt` | <div align="justify" style="text-align: justify;">Reset the prompt after loading the plugin/snippet (by issuing `zle .reset-prompt`). Note: normally it's sufficient to precede the value of `wait''` ice with `!`.</div> |
| `bindmap` | <div align="justify" style="text-align: justify;">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.**</div> |
| `trackbinds` | <div align="justify" style="text-align: justify;">Shadow but only `bindkey` calls even with `zinit light ...`, i.e. even with investigating disabled (fast loading), to allow `bindmap` to remap the key-binds. The same effect has `zinit light -b ...`, i.e. additional `-b` option to the `light`-subcommand. **Does not work with snippets.**</div> |
| [**`wrap-track`**](https://zdharma-continuum.github.io/zinit/wiki/wrap-track) | <div align="justify" style='text-align: justify;'> Takes a `;`-separated list of function names that are to be investigated (meaning gathering report and unload data) **once** during execution. It works by wrapping the functions with a investigating-enabling and disabling snippet of code. In summary, `wrap-track` allows to extend the investigating beyond the moment of loading of a plugin. Example use is to `wrap-track` a precmd function of a prompt (like `_p9k_precmd()` of powerlevel10k) or other plugin that _postpones its initialization till the first prompt_ (like e.g.: zsh-autosuggestions). **Does not work with snippets.**</div> |
| `aliases` | <div align="justify" style="text-align: justify;">Load the plugin with the aliases mechanism enabled. Use with plugins that define **and use** aliases in their scripts.</div> |
| `light-mode` | <div align="justify" style="text-align: justify;">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</div> |
| `aliases` | <div align="justify" style="text-align: justify;">Load the plugin with the aliases mechanism enabled. Use with plugins that define **and use** aliases in their scripts.</div> |
| `light-mode` | <div align="justify" style="text-align: justify;">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</div> |
| [**`extract`**](https://zdharma-continuum.github.io/zinit/wiki/extract-Ice/) | <div align="justify" style="text-align: justify;">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.</div> |
| `subst` | <div align="justify" style="text-align: justify;">Substitute the given string into another string when sourcing the plugin script, e.g.: `zinit subst'autoload → autoload -Uz' …`.</div> |
| `autoload` | <div align="justify" style="text-align: justify;">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'`.</div> |
| `subst` | <div align="justify" style="text-align: justify;">Substitute the given string into another string when sourcing the plugin script, e.g.: `zinit subst'autoload → autoload -Uz' …`.</div> |
| `autoload` | <div align="justify" style="text-align: justify;">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'`.</div> |
### Order of Execution
Order of execution of related Ice-mods: `atinit` -> `atpull!` -> `make'!!'` -> `mv` -> `cp` -> `make!` -> `atclone`/`atpull` -> `make` -> `(plugin script loading)` -> `src` -> `multisrc` -> `atload`.
Order of execution of related Ice-mods: `atinit` -> `atpull!` -> `make'!!'` -> `mv` -> `cp` -> `make!` ->
`atclone`/`atpull` -> `make` -> `(plugin script loading)` -> `src` -> `multisrc` -> `atload`.
## Zinit Commands
@ -881,38 +881,37 @@ ## Updating Zinit and Plugins
To update Zinit issue `zinit self-update` in the command line.
To update all plugins and snippets, issue `zinit update`. If you wish to update only
a single plugin/snippet instead issue `zinit update NAME_OF_PLUGIN`. A list of
commits will be shown:
To update all plugins and snippets, issue `zinit update`. If you wish to update only a single plugin/snippet instead
issue `zinit update NAME_OF_PLUGIN`. A list of commits will be shown:
<p align="center">
<img 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` ice modifier. For example, writing `zinit ice atpull'./configure'` before loading a plugin will execute `./configure` after a successful update. Refer to [Ice Modifiers](#ice-modifiers) for more information.
Some plugins require performing an action each time they're updated. One way you can do this is by using the `atpull`
ice modifier. For example, writing `zinit ice atpull'./configure'` before loading a plugin will execute `./configure`
after a successful update. Refer to [Ice Modifiers](#ice-modifiers) for more information.
The ice modifiers for any plugin or snippet are stored in their directory in a
`._zinit` subdirectory, hence the plugin doesn't have to be loaded to be correctly
updated. There's one other file created there, `.zinit_lstupd` it holds the log of
the new commits pulled-in in the last update.
The ice modifiers for any plugin or snippet are stored in their directory in a `._zinit` subdirectory, hence the plugin
doesn't have to be loaded to be correctly updated. There's one other file created there, `.zinit_lstupd` it holds the
log of the new commits pulled-in in the last update.
# Completions
## Calling `compinit` Without Turbo Mode
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`.
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 completion for a command. For example, `compdef _git git` defines that the `git` command should be completed by a `_git` function.
The `cdreplay` subcommand is provided to re-play all catched `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.
The `compdef` function is provided by `compinit` call. As it should be called later,
after loading all of the plugins, Zinit provides its own `compdef` function that
catches (i.e.: records in an array) the arguments of the call, so that the loaded
plugins can freely call `compdef`. Then, the `cdreplay` (*compdef-replay*) can be used,
after `compinit` will be called (and the original `compdef` function will become
available), to execute all detected `compdef` calls. To summarize:
The `compdef` function is provided by `compinit` call. As it should be called later, after loading all of the plugins,
Zinit provides its own `compdef` function that catches (i.e.: records in an array) the arguments of the call, so that
the loaded plugins can freely call `compdef`. Then, the `cdreplay` (*compdef-replay*) can be used, after `compinit` will
be called (and the original `compdef` function will become available), to execute all detected `compdef` calls. To
summarize:
```zsh
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
@ -939,24 +938,20 @@ ## Calling `compinit` Without Turbo Mode
# use with `zinit cdreplay')
```
This allows to call compinit once.
Performance gains are huge, example shell startup time with double `compinit`: **0.980** sec, with
`cdreplay` and single `compinit`: **0.156** sec.
This allows to call compinit once. Performance gains are huge, example shell startup time with double `compinit`:
**0.980** sec, with `cdreplay` and single `compinit`: **0.156** sec.
## Calling `compinit` With Turbo Mode
If you load completions using `wait''` Turbo mode then you can add
`atinit'zicompinit'` to syntax-highlighting plugin (which should be the last
one loaded, as their (2 projects, [z-sy-h](https://github.com/zsh-users/zsh-syntax-highlighting) &
[f-sy-h](https://github.com/zdharma-continuum/fast-syntax-highlighting))
documentation state), or `atload'zicompinit'` to last
completion-related plugin. `zicompinit` is a function that just runs `autoload
compinit; compinit`, created for convenience. There's also `zicdreplay` which
will replay any caught compdefs so you can also do: `atinit'zicompinit;
zicdreplay'`, etc. Basically, the whole topic is the same as normal `compinit` call,
but it is done in `atinit` or `atload` hook of the last related plugin with use of the
helper functions (`zicompinit`,`zicdreplay` & `zicdclear` see below for explanation
of the last one). To summarize:
If you load completions using `wait''` Turbo mode then you can add `atinit'zicompinit'` to syntax-highlighting plugin
(which should be the last one loaded, as their (2 projects,
[z-sy-h](https://github.com/zsh-users/zsh-syntax-highlighting) &
[f-sy-h](https://github.com/zdharma-continuum/fast-syntax-highlighting)) documentation state), or `atload'zicompinit'`
to last completion-related plugin. `zicompinit` is a function that just runs `autoload compinit; compinit`, created for
convenience. There's also `zicdreplay` which will replay any caught compdefs so you can also do:
`atinit'zicompinit; zicdreplay'`, etc. Basically, the whole topic is the same as normal `compinit` call, but it is done
in `atinit` or `atload` hook of the last related plugin with use of the helper functions (`zicompinit`,`zicdreplay` &
`zicdclear` see below for explanation of the last one). To summarize:
```zsh
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share/zinit}"
@ -974,9 +969,8 @@ # Load using the for-syntax
## Ignoring Compdefs
If you want to ignore compdefs provided by some plugins or snippets, place their load commands
before commands loading other plugins or snippets, and issue `zinit cdclear` (or
`zicdclear`, designed to be used in hooks like `atload''`):
If you want to ignore compdefs provided by some plugins or snippets, place their load commands before commands loading
other plugins or snippets, and issue `zinit cdclear` (or `zicdclear`, designed to be used in hooks like `atload''`):
```zsh
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
@ -995,16 +989,14 @@ ## Ignoring Compdefs
zinit cdlist # look at gathered compdefs
```
The `cdreplay` is important if you use plugins like
`OMZP::kubectl` or `asdf-vm/asdf`, because these plugins call
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)
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 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
`~/.zshenv`:
```zsh
@ -1020,10 +1012,9 @@ # Hints and Tips
## Customizing Paths
Following variables can be set to custom values, before sourcing Zinit. The
previous global variables like `$ZPLG_HOME` have been removed to not pollute
the namespace  there's single `$ZINIT` hash instead of `8` string
variables. Please update your dotfiles.
Following variables can be set to custom values, before sourcing Zinit. The previous global variables like `$ZPLG_HOME`
have been removed to not pollute the namespace there's single `$ZINIT` hash instead of `8` string variables. Please
update your dotfiles.
```zsh
declare -A ZINIT # initial Zinit's hash definition, if configuring before loading Zinit, and then:
@ -1031,9 +1022,9 @@ ## Customizing Paths
| Hash Field | Description |
| ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ZINIT\[BIN_DIR\] | Where Zinit code resides, e.g.: "~/.local/share/zinit/zinit.git" |
| ZINIT\[HOME_DIR\] | Where Zinit should create all working directories, e.g.: "~/.local/share/zinit" |
| ZINIT\[MAN_DIR\] | Directory where plugins can store their manpages (`atclone"cp -vf myplugin.1 $ZINIT[MAN_DIR]/man1"`). If overridden, this directory will not necessarily be used by `man` (See #8). Default: `$ZPFX/man` |
| ZINIT\[BIN_DIR\] | Where Zinit code resides, e.g.: "~/.local/share/zinit/zinit.git" |
| ZINIT\[HOME_DIR\] | Where Zinit should create all working directories, e.g.: "~/.local/share/zinit" |
| ZINIT\[MAN_DIR\] | Directory where plugins can store their manpages (`atclone"cp -vf myplugin.1 $ZINIT[MAN_DIR]/man1"`). If overridden, this directory will not necessarily be used by `man` (See #8). Default: `$ZPFX/man` |
| ZINIT\[PLUGINS_DIR\] | Override single working directory for plugins, e.g. "/opt/zsh/zinit/plugins" |
| ZINIT\[COMPLETIONS_DIR\] | As above, but for completion files, e.g. "/opt/zsh/zinit/root_completions" |
| ZINIT\[SNIPPETS_DIR\] | As above, but for snippets |
@ -1042,31 +1033,26 @@ ## Customizing Paths
| ZINIT\[MUTE_WARNINGS\] | If set to `1`, then mutes some of the Zinit warnings, specifically the `plugin already registered` warning |
| ZINIT\[OPTIMIZE_OUT_DISK_ACCESSES\] | If set to `1`, then Zinit will skip checking if a Turbo-loaded object exists on the disk. By default Zinit skips Turbo for non-existing objects (plugins or snippets) to install them before the first prompt without any delays, during the normal processing of `zshrc`. This option can give a performance gain of about 10 ms out of 150 ms (i.e.: Zsh will start up in 140 ms instead of 150 ms). |
There is also `$ZPFX`, set by default to `~/.local/share/zinit/polaris` a directory
where software with `Makefile`, etc. can be pointed to, by e.g. `atclone'./configure --prefix=$ZPFX'`.
There is also `$ZPFX`, set by default to `~/.local/share/zinit/polaris` a directory where software with `Makefile`,
etc. can be pointed to, by e.g. `atclone'./configure --prefix=$ZPFX'`.
## Non-GitHub (Local) Plugins
Use `create` subcommand with user name `_local` (the default) to create plugin's
skeleton in `$ZINIT[PLUGINS_DIR]`. It will be not connected with GitHub repository
(because of user name being `_local`). To enter the plugin's directory use `cd` command
with just plugin's name (without `_local`, it's optional).
Use `create` subcommand with user name `_local` (the default) to create plugin's skeleton in `$ZINIT[PLUGINS_DIR]`. It
will be not connected with GitHub repository (because of user name being `_local`). To enter the plugin's directory use
`cd` command with just plugin's name (without `_local`, it's optional).
If user name will not be `_local`, then Zinit will create repository also on GitHub
and setup correct repository origin.
If user name will not be `_local`, then Zinit will create repository also on GitHub and setup correct repository origin.
## Extending Git
There are several projects that provide git extensions. Installing them with
Zinit has many benefits:
There are several projects that provide git extensions. Installing them with Zinit has many benefits:
- all files are under `$HOME` no administrator rights needed,
- declarative setup (like Chef or Puppet) copying `.zshrc` to different account
brings also git-related setup,
- declarative setup (like Chef or Puppet) copying `.zshrc` to different account brings also git-related setup,
- easy update by e.g. `zinit update --all`.
Below is a configuration that adds multiple git extensions, loaded in Turbo mode,
1 second after prompt, with use of the
Below is a configuration that adds multiple git extensions, loaded in Turbo mode, 1 second after prompt, with use of the
[Bin-Gem-Node](https://github.com/zdharma-continuum/zinit-annex-bin-gem-node) annex:
```zsh
@ -1089,9 +1075,9 @@ ## Extending Git
# Supporting
Zinit is a personal, free-time project with no funding and a huge [feature request
backlog](https://github.com/zdharma-continuum/zinit/issues). If you love it, consider supporting its
development via GitHub Sponsors [pending]. Any help counts!
Zinit is a personal, free-time project with no funding and a huge
[feature request backlog](https://github.com/zdharma-continuum/zinit/issues). If you love it, consider supporting its
development via GitHub Sponsors \[pending\]. Any help counts!
# Getting Help and Community
@ -1099,15 +1085,16 @@ # Getting Help and Community
- [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 Gitter
[![Join the chat at https://gitter.im/zdharma-continuum/community][gitter-badge]][gitter-link]
<!-- vim:set ft=markdown tw=120 fo+=1n: -->
[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
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
[mit-link]: ./LICENSE
[ver-badge]: https://img.shields.io/github/tag/zdharma-continuum/zinit.svg
[ver-link]: https://github.com/zdharma-continuum/zinit/releases
[tests-badge]: https://github.com/zdharma-continuum/zinit/actions/workflows/tests.yaml/badge.svg
[tests-link]: https://github.com/zdharma-continuum/zinit/actions/workflows/tests.yaml
<!-- vim:set ft=markdown tw=80 fo+=1n: -->
[ver-badge]: https://img.shields.io/github/tag/zdharma-continuum/zinit.svg
[ver-link]: https://github.com/zdharma-continuum/zinit/releases

View file

@ -1,18 +1,20 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
- [Changelog](#changelog)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
# Changelog
All notable changes to this project will be documented in this file.
* 29-11-2021
- zinit calls no longer silently fail when ices such as `atclone`,
`atpull` or `compile` fail. Any hook returning with != 0 will log a warning to
stdout at runtime:
- 29-11-2021
- zinit calls no longer silently fail when ices such as `atclone`, `atpull` or `compile` fail. Any hook returning with
!= 0 will log a warning to stdout at runtime:
```zsh
zinit null atclone'echo "intentional failure"; return 69' \
@ -21,28 +23,28 @@ # Changelog
69
```
* 28-11-2021
- **‼️ BREAKING CHANGE** zinit now requires [jq](https://github.com/stedolan/jq)
for JSON parsing. This only affects the `pack` ice. Users who do not have jq
installed will be greeted with a warning when they try to install packages.
To install jq with zinit, you can follow [these instructions in the wiki](https://github.com/zdharma-continuum/zinit/wiki/%F0%9F%A7%8A-Recommended-ices#jq)
- `zinit pack` now better supports installation from local files (previously
only relative paths worked), and **custom repositories!**
By default, zinit uses [zhdarma-continuum/zinit-packages](https://github.com/p/zdharma-continuum/zinit-packages).
- 28-11-2021
- **‼️ BREAKING CHANGE** zinit now requires [jq](https://github.com/stedolan/jq) for JSON parsing. This only affects
the `pack` ice. Users who do not have jq installed will be greeted with a warning when they try to install packages.
To install jq with zinit, you can follow
[these instructions in the wiki](https://github.com/zdharma-continuum/zinit/wiki/%F0%9F%A7%8A-Recommended-ices#jq)
- `zinit pack` now better supports installation from local files (previously only relative paths worked), and **custom
repositories!** By default, zinit uses
[zhdarma-continuum/zinit-packages](https://github.com/p/zdharma-continuum/zinit-packages).
To use a custom repo you can set `ZINIT[PACKAGES_REPO]=github_org/repo`.
For installing from a specific branch you can:
1. Leverage the `ver` ice (eg: `ver"my-branch`)
2. Override zinit's default branch with `ZINIT[PACKAGES_BRANCH]=my-branch`
For installing from a specific branch you can:
zinit package repos that are not hosted on GitHub can be installed from the
local filesystem like so:
1. Leverage the `ver` ice (eg: `ver"my-branch`)
1. Override zinit's default branch with `ZINIT[PACKAGES_BRANCH]=my-branch`
zinit package repos that are not hosted on GitHub can be installed from the local filesystem like so:
`zinit pack"local/path/to/package.json:profile" for mypackage`
* 22-11-2021
- We updated zinit's main branch from `master` to `main`. `zinit self-update`
will try to update the branch locally. If it fails please try to:
- 22-11-2021
- We updated zinit's main branch from `master` to `main`. `zinit self-update` will try to update the branch locally.
If it fails please try to:
```zsh
cd ${ZINIT[BIN_DIR]}
@ -52,48 +54,44 @@ # Changelog
git remote set-head origin -a
```
* 21-11-2021
- [(z)unit tests](https://github.com/zdharma-continuum/zinit/actions/workflows/tests.yaml)
have been added to our dear repository. This should help us to sniff out
some bugs and improve the overall quality of zinit. Stay tuned! More information
available [here](https://github.com/zdharma-continuum/zinit/pull/96).
- 21-11-2021
* 20-11-2021
- zinit is now [XDG compliant](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html).
This means that the default value of `ZINIT[HOME_DIR]` is now
`XDG_DATA_HOME/zinit`, ie `HOME/.local/share/zinit`, we won't clutter your
`HOME` anymore! Fear not though: if you update zinit without moving your
config to the new default location it will still fall back to `HOME/.zinit` if
this directory exists. In the same spirit, if you overrode `ZINIT[HOME_DIR]`
yourself in your `zshrc` we will use that value instead.
NOTE: Since its rewrite the installer has been installing zinit's repo to
`XDG_DATA_HOME/zinit/zinit.git` (see 16-11-2021 entry)
- [(z)unit tests](https://github.com/zdharma-continuum/zinit/actions/workflows/tests.yaml) have been added to our dear
repository. This should help us to sniff out some bugs and improve the overall quality of zinit. Stay tuned! More
information available [here](https://github.com/zdharma-continuum/zinit/pull/96).
- 20-11-2021
- zinit is now [XDG compliant](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html). This
means that the default value of `ZINIT[HOME_DIR]` is now `XDG_DATA_HOME/zinit`, ie `HOME/.local/share/zinit`, we
won't clutter your `HOME` anymore! Fear not though: if you update zinit without moving your config to the new
default location it will still fall back to `HOME/.zinit` if this directory exists. In the same spirit, if you
overrode `ZINIT[HOME_DIR]` yourself in your `zshrc` we will use that value instead. NOTE: Since its rewrite the
installer has been installing zinit's repo to `XDG_DATA_HOME/zinit/zinit.git` (see 16-11-2021 entry)
- 18-11-2021
* 18-11-2021
- The packages (`zinit pack`) have all been migrated to
[a new repository](https://github.com/zdharma-continuum/zinit-packages). Nothing
fundamentally changes for users, the original repos have only been archived and
not deleted, so that older zinit versions can still use these.
[a new repository](https://github.com/zdharma-continuum/zinit-packages). Nothing fundamentally changes for users,
the original repos have only been archived and not deleted, so that older zinit versions can still use these.
For more information, please refer to
[this issue](https://github.com/zdharma-continuum/zinit/issues/69) and/or to
For more information, please refer to [this issue](https://github.com/zdharma-continuum/zinit/issues/69) and/or to
[the corresponding PR](https://github.com/zdharma-continuum/zinit/pull/75)
- The zinit module has been relocated to
[its own repository](https://github.com/zdharma-continuum/zinit-module)
- The zinit module has been relocated to [its own repository](https://github.com/zdharma-continuum/zinit-module)
* 17-11-2021
- Containers! If you want to try out zinit inside a container, you can now.
Several versions of zsh are available, as well as arm64. Check out the available
tags on [ghcr](https://github.com/zdharma-continuum/zinit/pkgs/container/zinit).
- Containers! If you want to try out zinit inside a container, you can now. Several versions of zsh are available, as
well as arm64. Check out the available tags on
[ghcr](https://github.com/zdharma-continuum/zinit/pkgs/container/zinit).
```shell
docker run -it --rm ghcr.io/zdharma-continuum/zinit:latest
```
* 16-11-2021
- A brand-new installer has been developed. A few new features have been
added. There are a bunch of new env vars you can set:
- 16-11-2021
- A brand-new installer has been developed. A few new features have been added. There are a bunch of new env vars you
can set:
- `NO_INPUT=1`: non-interactive mode (`NO_INPUT=1`)
- `NO_EDIT=1`: do not modify `.zshrc`
@ -108,64 +106,62 @@ # Changelog
For more details check out [PR #61](https://github.com/zdharma-continuum/zinit/pull/61)
* 11-11-2021
- The annexes repos have been renamed to improve discoverability. They used to
be called `z-a-${name}` and have been renamed to `zinit-annex-${name}`. You
don't *need* to update your configs right away since GitHub redirects to the
new URLs.
- 11-11-2021
- The annexes repos have been renamed to improve discoverability. They used to be called `z-a-${name}` and have been
renamed to `zinit-annex-${name}`. You don't *need* to update your configs right away since GitHub redirects to the
new URLs.
- 06-11-2021
* 06-11-2021
- 🚧 zinit has a new home: https://github.com/zdharma-continuum/zinit
- The migration from @zdharma, @Zsh-Packages and @zinit-zsh is still in
progress. If you are interested in helping or want to let us know that a
particular project is missing, please head to
[I_WANT_TO_HELP](https://github.com/zdharma-continuum/I_WANT_TO_HELP/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc)
- 📚 zinit now ensures that the man dirs under `$ZPFX/man` are created on
startup. Please note that these directories will not necessarily be part of your
`manpath`. You may need to set `$MANPATH`. See #8 (and #7) for more details.
- The migration from @zdharma, @Zsh-Packages and @zinit-zsh is still in progress. If you are interested in helping
or want to let us know that a particular project is missing, please head to
[I_WANT_TO_HELP](https://github.com/zdharma-continuum/I_WANT_TO_HELP/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc)
- 📚 zinit now ensures that the man dirs under `$ZPFX/man` are created on startup. Please note that these directories
will not necessarily be part of your `manpath`. You may need to set `$MANPATH`. See #8 (and #7) for more details.
* 21-01-2020
- A few tips for the project rename following the field reports (the issues created
by users):
- 21-01-2020
- A few tips for the project rename following the field reports (the issues created by users):
- the `ZPLGM` hash is now `ZINIT`,
- the annexes are moved under [zinit-zsh](https://github.com/zinit-zsh)
organization (it needs a logo, could you create one, if you're skilled in
graphics?).
- the annexes are moved under [zinit-zsh](https://github.com/zinit-zsh) organization (it needs a logo, could you
create one, if you're skilled in graphics?).
- 19-01-2020
* 19-01-2020
- The name has been changed to **Zinit** based on the results of the
[poll](https://web.archive.org/web/20201008014128/https://github.com/zdharma/zinit/issues/235)
- In general, you don't have to do anything after the name change.
- Only a run of `zinit update --all` might be necessary.
- You might also want to rename your `zplugin` calls in `zshrc` to `zinit`.
- Zinit will reuse `~/.zplugin` directory if it exists, otherwise it'll create
`~/.zinit`.
- Zinit will reuse `~/.zplugin` directory if it exists, otherwise it'll create `~/.zinit`.
* 15-01-2020
- There's a new function, `zpextract`, which unpacks the given file. It supports many
formats (notably also `dmg` images) if there's a format that's unsupported please
don't hesitate to [make a
request](https://github.com/zdharma-continuum/zinit/issues/new?assignees=&labels=%F0%9F%8E%81+feature+request%2C%F0%9F%8E%B2+triage&template=feature-request.yml&title=%F0%9F%8E%81+Feature+request%3A+)
- 15-01-2020
- There's a new function, `zpextract`, which unpacks the given file. It supports many formats (notably also `dmg`
images) if there's a format that's unsupported please don't hesitate to
[make a request](https://github.com/zdharma-continuum/zinit/issues/new?assignees=&labels=%F0%9F%8E%81+feature+request%2C%F0%9F%8E%B2+triage&template=feature-request.yml&title=%F0%9F%8E%81+Feature+request%3A+)
for it to be added. A few facts:
- the function is available only at the time of the plugin/snippet installation,
- it's to be used within `atclone` and `atpull` ices,
- it has an optional `--move` option which moves all the files from a subdirectory
up one level,
- it has an optional `--move` option which moves all the files from a subdirectory up one level,
- one other option `--norm` prevents the archive from being deleted upon unpacking.
- snippets now aren't re-downloaded unless they're newer on the HTTP server; use
this with the `--norm` option of `zpextract` to prevent unnecessary updates; for
example, the [firefox-dev package](https://github.com/zdharma-continuum/zsh-package-firefox-dev)
uses this option for this purpose,
- GitHub doesn't report proper `Last-Modified` HTTP server for the files in the
repositories so the feature doesn't yet work with such files.
- snippets now aren't re-downloaded unless they're newer on the HTTP server; use this with the `--norm` option of
`zpextract` to prevent unnecessary updates; for example, the
[firefox-dev package](https://github.com/zdharma-continuum/zsh-package-firefox-dev) uses this option for this
purpose,
- GitHub doesn't report proper `Last-Modified` HTTP server for the files in the repositories so the feature doesn't
yet work with such files.
* 13-12-2019
- The packages have been disconnected from NPM registry and now live only on Zsh
Packages organization. Publishing to NPM isn't needed.
- There are two interesting packages,
[any-gem](https://github.com/zdharma-continuum/zsh-package-any-gem) and
[any-node](https://github.com/zdharma-continuum/zsh-package-any-node). They allow to install any
Gem(s) or Node module(s) locally in a newly created plugin directory. For example:
- 13-12-2019
- The packages have been disconnected from NPM registry and now live only on Zsh Packages organization. Publishing to
NPM isn't needed.
- There are two interesting packages, [any-gem](https://github.com/zdharma-continuum/zsh-package-any-gem) and
[any-node](https://github.com/zdharma-continuum/zsh-package-any-node). They allow to install any Gem(s) or Node
module(s) locally in a newly created plugin directory. For example:
```zsh
zinit pack param='GEM -> rails' for any-gem
@ -177,19 +173,18 @@ # Changelog
```
The binaries will be exposed without altering the PATH via shims
([Bin-Gem-Node](https://github.com/zinit-zsh/zinit-annex-bin-gem-node) annex is needed).
Shims are correctly removed when deleting a plugin with `zinit delete …`.
([Bin-Gem-Node](https://github.com/zinit-zsh/zinit-annex-bin-gem-node) annex is needed). Shims are correctly removed
when deleting a plugin with `zinit delete …`.
* 11-12-2019
- Zinit now supports installing special-Zsh NPM packages! Bye-bye the long and
complex ice-lists! Check out the
[Wiki](https://zdharma-continuum.github.io/zinit/wiki/NPM-Packages/) for an introductory document
on the feature.
- 11-12-2019
* 25-11-2019
- A new subcommand `run` that executes a command in the given plugin's directory. It
has an `-l` option that will reuse the previously provided plugin. So that it's
possible to do:
- Zinit now supports installing special-Zsh NPM packages! Bye-bye the long and complex ice-lists! Check out the
[Wiki](https://zdharma-continuum.github.io/zinit/wiki/NPM-Packages/) for an introductory document on the feature.
- 25-11-2019
- A new subcommand `run` that executes a command in the given plugin's directory. It has an `-l` option that will
reuse the previously provided plugin. So that it's possible to do:
```zsh
zplg run my/plugin ls
@ -197,11 +192,11 @@ # Changelog
zplg run -l pwd
```
* 07-11-2019
- Added a prefix-char: `@` that can be used before plugins if their name collides
with one of the ice-names. For example `sharkdp/fd` collides with the `sh` ice
(which causes the plugin to be loaded with the POSIX `sh` emulation applied). To
load it, do e.g.:
- 07-11-2019
- Added a prefix-char: `@` that can be used before plugins if their name collides with one of the ice-names. For
example `sharkdp/fd` collides with the `sh` ice (which causes the plugin to be loaded with the POSIX `sh` emulation
applied). To load it, do e.g.:
```zsh
zinit as"null" wait"2" lucid from"gh-r" for \
@ -211,13 +206,14 @@ # Changelog
```
i.e.: precede the plugin name with `@`. Note: `sbin''` is an ice added by the
[zinit-annex-bin-gem-node](https://github.com/zinit/zinit-annex-bin-gem-node) annex, it provides
the command to the command line without altering `$PATH`.
[zinit-annex-bin-gem-node](https://github.com/zinit/zinit-annex-bin-gem-node) annex, it provides the command to the
command line without altering `$PATH`.
See the [Zinit Wiki](https://zdharma-continuum.github.io/zinit/wiki/For-Syntax/) for more
information on the for-syntax.
See the [Zinit Wiki](https://zdharma-continuum.github.io/zinit/wiki/For-Syntax/) for more information on the
for-syntax.
- 06-11-2019
* 06-11-2019
- A new syntax, called for-syntax. Example:
```zsh
@ -243,19 +239,19 @@ # Changelog
/root/.zinit/plugins/zdharma---null
```
To load in light mode, use a new `light-mode` ice. More examples and information
can be found on the [Zinit Wiki](https://zdharma-continuum.github.io/zinit/wiki/For-Syntax/).
To load in light mode, use a new `light-mode` ice. More examples and information can be found on the
[Zinit Wiki](https://zdharma-continuum.github.io/zinit/wiki/For-Syntax/).
* 03-11-2019
- A new value for the `as''` ice `null`. Specifying `as"null"` is like specifying
`pick"/dev/null" nocompletions`, i.e.: it disables the sourcing of the default
script file of a plugin or snippet and also disables the installation of
completions.
- 03-11-2019
* 30-10-2019
- A new ice `trigger-load''` create a function that loads given plugin/snippet,
with an option (to use it, precede the ice content with `!`) to automatically
forward the call afterwards. Example use:
- A new value for the `as''` ice `null`. Specifying `as"null"` is like specifying `pick"/dev/null" nocompletions`,
i.e.: it disables the sourcing of the default script file of a plugin or snippet and also disables the installation
of completions.
- 30-10-2019
- A new ice `trigger-load''` create a function that loads given plugin/snippet, with an option (to use it, precede
the ice content with `!`) to automatically forward the call afterwards. Example use:
```zsh
# Invoking the command `crasis' will load the plugin that
@ -265,29 +261,33 @@ # Changelog
zinit load zdharma/zinit-crasis
```
* 22-10-2019
- A new ice `countdown`  causes an interruptable (by Ctrl-C) countdown 5…4…3…2…1…0
to be displayed before running the `atclone''`, `atpull''` and `make` ices.
- 22-10-2019
* 21-10-2019
- The `times` command has a new option `-m` it shows the **moments** of the plugin
load times i.e.: how late after loading Zinit a plugin has been loaded.
- A new ice `countdown` causes an interruptable (by Ctrl-C) countdown 5…4…3…2…1…0 to be displayed before running the
`atclone''`, `atpull''` and `make` ices.
* 20-10-2019
- The `zinit` completion now completes also snippets! The command `snippet`, but
also `delete`, `recall`, `edit`, `cd`, etc. all receive such completing.
- 21-10-2019
- The `times` command has a new option `-m` it shows the **moments** of the plugin load times i.e.: how late after
loading Zinit a plugin has been loaded.
- 20-10-2019
- The `zinit` completion now completes also snippets! The command `snippet`, but also `delete`, `recall`, `edit`,
`cd`, etc. all receive such completing.
- The `ice` subcommand can now be skipped just pass in the ices, e.g.:
```zsh
zinit atload"zicompinit; zicdreplay" blockf
zinit light zsh-users/zsh-completions
```
- The `compile` command is able to compile snippets.
- The plugins that add their subdirectories into `$fpath` can be now `blockf`-ed
the functions located in the dirs will be correctly auto-loaded.
- The plugins that add their subdirectories into `$fpath` can be now `blockf`-ed the functions located in the dirs
will be correctly auto-loaded.
* 12-10-2019
- Special value for the `id-as''` ice `auto`. It sets the plugin/snippet ID
automatically to the last component of its spec, e.g.:
- 12-10-2019
- Special value for the `id-as''` ice `auto`. It sets the plugin/snippet ID automatically to the last component of
its spec, e.g.:
```zsh
zinit ice id-as"auto"
@ -296,21 +296,22 @@ # Changelog
will load the plugin as `id-as'zinc'`.
* 14-09-2019
- There's a Vim plugin which extends syntax highlighting of zsh scripts with coloring
of the Zinit commands. [Project
homepage](https://github.com/zinit/zinit-vim-syntax).
- 14-09-2019
* 13-09-2019
- New ice `aliases` which loads plugin with the aliases mechanism enabled. Use for
plugins that define **and use** aliases in their scripts.
- There's a Vim plugin which extends syntax highlighting of zsh scripts with coloring of the Zinit commands.
[Project homepage](https://github.com/zinit/zinit-vim-syntax).
* 11-09-2019
- New ice-mods `sh`,`bash`,`ksh`,`csh` that load plugins (and snippets) with the
**sticky emulation** feature of Zsh all functions defined within the plugin will
automatically switch to the desired emulation mode before executing and switch back
thereafter. In other words it is now possible to load e.g. bash plugins with
Zinit, provided that the emulation level done by Zsh is sufficient, e.g.:
- 13-09-2019
- New ice `aliases` which loads plugin with the aliases mechanism enabled. Use for plugins that define **and use**
aliases in their scripts.
- 11-09-2019
- New ice-mods `sh`,`bash`,`ksh`,`csh` that load plugins (and snippets) with the **sticky emulation** feature of Zsh
all functions defined within the plugin will automatically switch to the desired emulation mode before executing and
switch back thereafter. In other words it is now possible to load e.g. bash plugins with Zinit, provided that the
emulation level done by Zsh is sufficient, e.g.:
```zsh
zinit ice bash pick"bash_it.sh" \
@ -319,83 +320,78 @@ # Changelog
zinit load Bash-it/bash-it
```
This script loads correctly thanks to the emulation, however it isn't functional
because it uses `type -t …` to check if a function exists.
This script loads correctly thanks to the emulation, however it isn't functional because it uses `type -t …` to
check if a function exists.
* 10-09-2019
- A new ice-mod `reset''` that ivokes `git reset --hard` (or the provided command)
before `git pull` and `atpull''` ice. It can be used it to implement altering (i.e.
patching) of the plugin's files inside the `atpull''` ice `git` will report no
conflicts when doing `pull`, and the changes can be then again introduced by the
`atpull''` ice..
- Three new Zplugin annexes (i.e.
[extensions](https://zdharma-continuum.github.io/zplugin/wiki/Annexes/)):
- 10-09-2019
- [zinit-annex-man](https://github.com/zplugin/zinit-annex-man)
- A new ice-mod `reset''` that ivokes `git reset --hard` (or the provided command) before `git pull` and `atpull''`
ice. It can be used it to implement altering (i.e. patching) of the plugin's files inside the `atpull''` ice `git`
will report no conflicts when doing `pull`, and the changes can be then again introduced by the `atpull''` ice..
Generates man pages and code-documentation man pages from plugin's README.md
and source files (the code documentation is obtained from
[Zshelldoc](https://github.com/zdharma/zshelldoc)).
- Three new Zplugin annexes (i.e. [extensions](https://zdharma-continuum.github.io/zplugin/wiki/Annexes/)):
- [zinit-annex-test](https://github.com/zplugin/zinit-annex-test)
- [zinit-annex-man](https://github.com/zplugin/zinit-annex-man)
Runs tests (if detected `test' target in a `Makefile` or any `*.zunit` files)
on plugin installation and non-empty update.
Generates man pages and code-documentation man pages from plugin's README.md and source files (the code
documentation is obtained from [Zshelldoc](https://github.com/zdharma/zshelldoc)).
- [zinit-annex-patch-dl](https://github.com/zplugin/zinit-annex-patch-dl)
- [zinit-annex-test](https://github.com/zplugin/zinit-annex-test)
Allows easy download and applying of patches, to e.g. aid building a binary
program equipped in the plugin.
Runs tests (if detected `test' target in a `Makefile`or any`\*.zunit\` files) on plugin installation and non-empty
update.
- A new variable is being recognized by the installation script:
`$ZPLG_BIN_DIR_NAME`. It configures the directory within `$ZPLG_HOME` to which
Zplugin should be cloned.
- [zinit-annex-patch-dl](https://github.com/zplugin/zinit-annex-patch-dl)
* 09-08-2019
- A new ice-mod `wrap-track''` which gets `;`-separated list of functions that are to
be tracked **once** when executing. In other words you can extend the tracking
beyond the moment of loading of a plugin.
- The unloading of Zle widgets is now more smart it takes into account the chains
of plugins that can overload the Zle widgets, and solves the interactions that
result out of it.
Allows easy download and applying of patches, to e.g. aid building a binary program equipped in the plugin.
- A new variable is being recognized by the installation script: `$ZPLG_BIN_DIR_NAME`. It configures the directory
within `$ZPLG_HOME` to which Zplugin should be cloned.
- 09-08-2019
- A new ice-mod `wrap-track''` which gets `;`-separated list of functions that are to be tracked **once** when
executing. In other words you can extend the tracking beyond the moment of loading of a plugin.
- The unloading of Zle widgets is now more smart it takes into account the chains of plugins that can overload the
Zle widgets, and solves the interactions that result out of it.
- 29-07-2019
* 29-07-2019
- `delete` now supports following options:
* `--all` deletes all plugins and snippets (a purge, similar to `rm -rf
${ZPLGM[PLUGINS_DIR]} ${ZPLGM[SNIPPETS_DIR]}`)
* `--clean` deletes only plugins and snippets that are **currently not loaded**
in the current session.
- `--all` deletes all plugins and snippets (a purge, similar to
`rm -rf ${ZPLGM[PLUGINS_DIR]} ${ZPLGM[SNIPPETS_DIR]}`)
- `--clean` deletes only plugins and snippets that are **currently not loaded** in the current session.
* 09-07-2019
- Zplugin can now have **its own plugins**, called **z-plugins**! Check out an
example but fully functional z-plugin
[zdharma/z-p-submods](https://github.com/zdharma/z-p-submods) and a document that
explains on how to implement your own z-plugin
([here](../../wiki/Z-PLUGINS)).
- 09-07-2019
* 08-07-2019
- You can now do `zplugin ice wait ...` and it will work as `zplugin ice wait'0' ...`
:) I.e. when there's no value to the `wait''` ice then a value of `0` is being
substituted.
- Zplugin can now have **its own plugins**, called **z-plugins**! Check out an example but fully functional z-plugin
[zdharma/z-p-submods](https://github.com/zdharma/z-p-submods) and a document that explains on how to implement your
own z-plugin ([here](../../wiki/Z-PLUGINS)).
* 02-07-2019
- [Cooperation of Fast-Syntax-Highlighting and
Zplugin](https://asciinema.org/a/254630) a new precise highlighting for
Zplugin in F-Sy-H.
- 08-07-2019
* 01-07-2019
- `atclone''`, `atpull''` & `make''` get run in the same subshell, thus an e.g.
export done in `atclone''` will be visible during the `make`.
- You can now do `zplugin ice wait ...` and it will work as `zplugin ice wait'0' ...` :) I.e. when there's no value to
the `wait''` ice then a value of `0` is being substituted.
* 26-06-2019
- `notify''` contents gets evaluated, i.e. can contain active code like `$(tail -1
/var/log/messages)`, etc.
- 02-07-2019
* 23-06-2019
- New ice mod `subscribe''`/`on-update-of''` which works like the
`wait''` ice-mod, i.e. defers loading of a plugin, but it **looks at
modification time of the given file(s)**, and when it changes, it then
triggers loading of the plugin/snippet:
- [Cooperation of Fast-Syntax-Highlighting and Zplugin](https://asciinema.org/a/254630) a new precise highlighting
for Zplugin in F-Sy-H.
- 01-07-2019
- `atclone''`, `atpull''` & `make''` get run in the same subshell, thus an e.g. export done in `atclone''` will be
visible during the `make`.
- 26-06-2019
- `notify''` contents gets evaluated, i.e. can contain active code like `$(tail -1 /var/log/messages)`, etc.
- 23-06-2019
- New ice mod `subscribe''`/`on-update-of''` which works like the `wait''` ice-mod, i.e. defers loading of a plugin,
but it **looks at modification time of the given file(s)**, and when it changes, it then triggers loading of the
plugin/snippet:
```zsh
% zplugin ice on-update-of'{~/files-*,/tmp/files-*}' lucid \
@ -407,15 +403,16 @@ # Changelog
%
Yes that's true :)
```
The plugin/snippet will be sourced as many times as the file gets updated.
* 22-06-2019
- New ice mod `reset-prompt` that will issue `zle .reset-prompt` after loading the
plugin or snippet, causing the prompt to be recomputed. Useful with themes &
turbo-mode.
- 22-06-2019
- New ice-mod `notify''` which will cause to display an under-prompt notification
when the plugin or snippet gets loaded. E.g.:
- New ice mod `reset-prompt` that will issue `zle .reset-prompt` after loading the plugin or snippet, causing the
prompt to be recomputed. Useful with themes & turbo-mode.
- New ice-mod `notify''` which will cause to display an under-prompt notification when the plugin or snippet gets
loaded. E.g.:
```zsh
% zplugin ice wait"0" lucid notify"zdharma/null has been loaded"
@ -435,9 +432,10 @@ # Changelog
Refer to [Ice Modifiers](#ice-modifiers) section for a complete description.
* 29-05-2019
- Turbo-Mode, i.e. the `wait''` ice-mode now supports a suffix the letter `a`, `b`
or `c`. The meaning is illustrated by the following example:
- 29-05-2019
- Turbo-Mode, i.e. the `wait''` ice-mode now supports a suffix the letter `a`, `b` or `c`. The meaning is
illustrated by the following example:
```zsh
zplugin ice wait"0b" as"command" pick"wd.sh" atinit"echo Firing 1" lucid
@ -450,38 +448,40 @@ # Changelog
Firing 1
```
As it can be seen, the second plugin has been loaded first. That's because there
are now three sub-slots (the `a`, `b` and `c`) in which the plugin/snippet loadings
can be put into. Plugins from the same time-slot with suffix `a` will be loaded
before plugins with suffix `b`, etc.
As it can be seen, the second plugin has been loaded first. That's because there are now three sub-slots (the `a`,
`b` and `c`) in which the plugin/snippet loadings can be put into. Plugins from the same time-slot with suffix `a`
will be loaded before plugins with suffix `b`, etc.
In other words, instead of `wait'1'` you can enter `wait'1a'`,
`wait'1b'` and `wait'1c'` to this way **impose order** on the loadings
**regardless of the order of `zplugin` commands**.
* 26-05-2019
- Turbo-Mode now divides the scheduled events (i.e. loadings of plugins or snippets)
into packs of 5. In other words, after loading each series of 5 plugins or snippets
the prompt is activated, i.e. it is feed an amount of CPU time. This will help to
deliver the promise of background loading without interferences visible to the
user. If you have some two slow-loading plugins and/or snippets, you can put them
into some separate blocks of 5 events.
In other words, instead of `wait'1'` you can enter `wait'1a'`, `wait'1b'` and `wait'1c'` to this way **impose
order** on the loadings **regardless of the order of `zplugin` commands**.
* 18-05-2019
- New ice-mod `nocd` it prevents changing current directory into the plugin's directory
before evaluating `atinit''`, `atload''` etc. ice-mods.
- 26-05-2019
* 12-03-2019
- Finally reorganizing the `README.md`. Went on asciidoc path, the
side-documents are written in it and the `README.md` will also be
converted (example page: [Introduction](doc/INTRODUCTION.adoc))
* 12-10-2018
- New `id-as''` ice-mod. You can nickname a plugin or snippet, to e.g. load it twice, with different `pick''`
ice-mod, or from Github binary releases and regular Github repository at the same time. More information
in [blog post](https://zdharma-continuum.github.io/2018-10-12/Nickname-a-plugin-or-snippet).
- Turbo-Mode now divides the scheduled events (i.e. loadings of plugins or snippets) into packs of 5. In other words,
after loading each series of 5 plugins or snippets the prompt is activated, i.e. it is feed an amount of CPU time.
This will help to deliver the promise of background loading without interferences visible to the user. If you have
some two slow-loading plugins and/or snippets, you can put them into some separate blocks of 5 events.
- 18-05-2019
- New ice-mod `nocd` it prevents changing current directory into the plugin's directory before evaluating
`atinit''`, `atload''` etc. ice-mods.
- 12-03-2019
- Finally reorganizing the `README.md`. Went on asciidoc path, the side-documents are written in it and the
`README.md` will also be converted (example page: [Introduction](doc/INTRODUCTION.adoc))
- 12-10-2018
- New `id-as''` ice-mod. You can nickname a plugin or snippet, to e.g. load it twice, with different `pick''` ice-mod,
or from Github binary releases and regular Github repository at the same time. More information in
[blog post](https://zdharma-continuum.github.io/2018-10-12/Nickname-a-plugin-or-snippet).
- 30-08-2018
- New `as''` ice-mod value: `completion`. Can be used to install completion-only "plugins", even single files:
* 30-08-2018
- New `as''` ice-mod value: `completion`. Can be used to install completion-only "plugins", even single
files:
```zsh
zplugin ice as"completion" mv"hub* -> _hub"
zplugin snippet https://github.com/github/hub/blob/master/etc/hub.zsh_completion
@ -491,27 +491,32 @@ # Changelog
![image](https://raw.githubusercontent.com/zdharma/zplugin/images/zplg-progress-bar.gif)
* 15-08-2018
- New `$ZPLGM` field `COMPINIT_OPTS` (also see [Customizing Paths](#customizing-paths--other)). You can pass
`-C` or `-i` there to mute the `insecure directories` messages. Typical use case could be:
- 15-08-2018
- New `$ZPLGM` field `COMPINIT_OPTS` (also see [Customizing Paths](#customizing-paths--other)). You can pass `-C` or
`-i` there to mute the `insecure directories` messages. Typical use case could be:
```zsh
zplugin ice wait"5" atinit"ZPLGM[COMPINIT_OPTS]=-C; zpcompinit; zpcdreplay" lucid
zplugin light zdharma/fast-syntax-highlighting
```
* 13-08-2018
- 13-08-2018
- `self-update` (subcommand used to update Zplugin) now lists new commits downloaded by the update:
![image](https://raw.githubusercontent.com/zdharma/zplugin/images/zplg-self-update.png)
![image](https://raw.githubusercontent.com/zdharma/zplugin/images/zplg-self-update.png)
- New subcommand `bindkeys` that lists what bindkeys each plugin has set up.
* 25-07-2018
- If you encountered a problem with loading Turbo-Mode plugins, it is fixed now. This occurred in versions
available between `10` and `23` of July. Issue `zplugin self-update` if you installed/updated in this period.
- 25-07-2018
- If you encountered a problem with loading Turbo-Mode plugins, it is fixed now. This occurred in versions available
between `10` and `23` of July. Issue `zplugin self-update` if you installed/updated in this period.
- New bug-fix release `v2.07`.
* 13-07-2018
- New `multisrc''` ice, it allows to specify multiple files for sourcing and it uses brace expansion syntax, so for example you can:
- 13-07-2018
- New `multisrc''` ice, it allows to specify multiple files for sourcing and it uses brace expansion syntax, so for
example you can:
```zsh
zplugin ice depth"1" multisrc="lib/{functions,misc}.zsh" pick"/dev/null"; zplugin load robbyrussell/oh-my-zsh
zplugin ice svn multisrc"{functions,misc}.zsh" pick"/dev/null"; zplugin snippet OMZ::lib
@ -521,50 +526,56 @@ # Changelog
array=( {functions,misc}.zsh ); zplg ice svn multisrc"$array" pick"/dev/null"; zplugin snippet OMZ::lib
zplugin ice svn multisrc"misc.zsh functions.zsh" pick"/dev/null"; zplugin snippet OMZ::lib
```
* 12-07-2018
- For docker and new machine provisioning, there's a trick that allows to install all [turbo-mode](#turbo-mode-zsh--53)
plugins by scripting:
- 12-07-2018
- For docker and new machine provisioning, there's a trick that allows to install all
[turbo-mode](#turbo-mode-zsh--53) plugins by scripting:
```zsh
zsh -i -c -- '-zplg-scheduler burst'
```
* 10-07-2018
- 10-07-2018
- Ice `wait'0'` now means actually short time you can load plugins and snippets **very quickly** after prompt.
* 02-03-2018
- Zplugin exports `$ZPFX` parameter. Its default value is `~/.zplugin/polaris` (user can
override it before sourcing Zplugin). This directory is like `/usr/local`, a prefix
for installed software, so it's possible to use ice like `make"PREFIX=$ZPFX"` or
`atclone"./configure --prefix=$ZPFX"`. Zplugin also setups `$MANPATH` pointing to the
- 02-03-2018
- Zplugin exports `$ZPFX` parameter. Its default value is `~/.zplugin/polaris` (user can override it before sourcing
Zplugin). This directory is like `/usr/local`, a prefix for installed software, so it's possible to use ice like
`make"PREFIX=$ZPFX"` or `atclone"./configure --prefix=$ZPFX"`. Zplugin also setups `$MANPATH` pointing to the
`polaris` directory. Checkout [gallery](GALLERY.md) for examples.
- [New README section](#hint-extending-git) about extending Git with Zplugin.
* 05-02-2018
- 05-02-2018
- I work much on this README however multi-file Wiki might be better to read it
[just has been created](https://github.com/zdharma/zplugin/wiki).
* 16-01-2018
- 16-01-2018
- New ice-mod `compile` which takes pattern to select additional files to compile, e.g.
`zplugin ice compile"(hsmw-*|history-*)"` (for `zdharma/history-search-multi-word` plugin).
See [Ice Modifiers](#ice-modifiers).
`zplugin ice compile"(hsmw-*|history-*)"` (for `zdharma/history-search-multi-word` plugin). See
[Ice Modifiers](#ice-modifiers).
* 14-01-2018
- Two functions have been exposed: `zpcdreplay` and `zpcompinit`. First one invokes compdef-replay,
second one is equal to `autoload compinit; compinit` (it also respects `$ZPLGM[ZCOMPDUMP_PATH]`).
You can use e.g. `atinit'zpcompinit'` ice-mod in a syntax-highlighting plugin, to initialize
completion right-before setting up syntax highlighting (because that should be done at the end).
- 14-01-2018
* 13-01-2018
- New customizable path `$ZPLGM[ZCOMPDUMP_PATH]` that allows to point zplugin to non-standard
`.zcompdump` location.
- Tilde-expansion is now performed on the [customizable paths](#customizing-paths--other) you can
assign paths like `~/.zplugin`, there's no need to use `$HOME/.zplugin`.
- Two functions have been exposed: `zpcdreplay` and `zpcompinit`. First one invokes compdef-replay, second one is
equal to `autoload compinit; compinit` (it also respects `$ZPLGM[ZCOMPDUMP_PATH]`). You can use e.g.
`atinit'zpcompinit'` ice-mod in a syntax-highlighting plugin, to initialize completion right-before setting up
syntax highlighting (because that should be done at the end).
- 13-01-2018
- New customizable path `$ZPLGM[ZCOMPDUMP_PATH]` that allows to point zplugin to non-standard `.zcompdump` location.
- Tilde-expansion is now performed on the [customizable paths](#customizing-paths--other) you can assign paths like
`~/.zplugin`, there's no need to use `$HOME/.zplugin`.
- 31-12-2017
* 31-12-2017
- For the new year there's a new feature: user-services spawned by Zshell :) Check out
[available services](https://github.com/zservices). They are configured like their
READMEs say, and controlled via:
[available services](https://github.com/zservices). They are configured like their READMEs say, and controlled via:
```
% zplugin srv redis next # current serving shell will drop the service, next Zshell will pick it up
@ -574,38 +585,44 @@ # Changelog
% zplugin srv redis restart # restart service, without changing the serving shell
```
This feature allows to configure everything in `.zshrc`, without the the need to deal with `systemd` or
`launchd`, and can be useful e.g. to configure shared-variables (across Zshells), stored in `redis` database
(details on [zservices/redis](https://github.com/zservices/redis)).
This feature allows to configure everything in `.zshrc`, without the the need to deal with `systemd` or `launchd`,
and can be useful e.g. to configure shared-variables (across Zshells), stored in `redis` database (details on
[zservices/redis](https://github.com/zservices/redis)).
* 24-12-2017
- Xmas present [fast-syntax-highlighting](https://github.com/zdharma/fast-syntax-highlighting)
now highlights the quoted part in `atinit"echo Initializing"`, i.e. it supports ICE syntax :)
- 24-12-2017
- Xmas present [fast-syntax-highlighting](https://github.com/zdharma/fast-syntax-highlighting) now highlights the
quoted part in `atinit"echo Initializing"`, i.e. it supports ICE syntax :)
- 08-12-2017
* 08-12-2017
- SVN snippets are compiled on install and update
- Resolved how should ice-mods be remembered general rule is that using `zplugin ice ...` makes
memory-saved and disk-saved ice-mods not used, and replaced on update. Calling e.g. `zplugin
update ...` without preceding `ice` uses memory, then disk-saved ices.
- Resolved how should ice-mods be remembered general rule is that using `zplugin ice ...` makes memory-saved and
disk-saved ice-mods not used, and replaced on update. Calling e.g. `zplugin update ...` without preceding `ice` uses
memory, then disk-saved ices.
* 07-12-2017
- New subcommand `delete` that obtains plugin-spec or URL and deletes plugin or snippet from disk.
It's good to forget wrongly passed Ice-mods (which are storred on disk e.g. for `update --all`).
- 07-12-2017
* 04-12-2017
- It's possible to set plugin loading and unloading on condition. ZPlugin supports plugin unloading,
so it's possible to e.g. **unload prompt and load another one**, on e.g. directory change. Checkout
- New subcommand `delete` that obtains plugin-spec or URL and deletes plugin or snippet from disk. It's good to forget
wrongly passed Ice-mods (which are storred on disk e.g. for `update --all`).
- 04-12-2017
- It's possible to set plugin loading and unloading on condition. ZPlugin supports plugin unloading, so it's possible
to e.g. **unload prompt and load another one**, on e.g. directory change. Checkout
[full story](#automatic-loadunload-on-condition) and [Asciinema video](https://asciinema.org/a/150825).
* 29-11-2017
- 29-11-2017
- **[Turbo Mode](https://github.com/zdharma/zplugin#turbo-mode-zsh--53)** **39-50% or more faster Zsh startup!**
- Subcommand `update` can update snippets, via given URL (up to this point snippets were updated via
`zplugin update --all`).
- Completion management is enabled for snippets (not only plugins).
* 13-11-2017
- New ice modifier `make`. It causes the `make`-command to be executed after cloning or updating
plugins and snippets. For example there's `Zshelldoc` that uses `Makefile` to build final scripts:
- 13-11-2017
- New ice modifier `make`. It causes the `make`-command to be executed after cloning or updating plugins and
snippets. For example there's `Zshelldoc` that uses `Makefile` to build final scripts:
```SystemVerilog
zplugin ice as"program" pick"build/zsd*" make; zplugin light zdharma/zshelldoc
@ -617,31 +634,34 @@ # Changelog
zplugin ice as"program" pick"build/zsd*" make"install PREFIX=/tmp"; zplugin light zdharma/zshelldoc
```
- Fixed problem with binary-release selection (`from"gh-r"`) by adding Ice-mod `bpick`, which
should be used for this purpose instead of `pick`, which selects file within plugin tree.
- Fixed problem with binary-release selection (`from"gh-r"`) by adding Ice-mod `bpick`, which should be used for this
purpose instead of `pick`, which selects file within plugin tree.
* 06-11-2017
- The subcommand `clist` now prints `3` completions per line (not `1`). This makes large amount
of completions to look better. Argument can be given, e.g. `6`, to increase the grouping.
- 06-11-2017
- The subcommand `clist` now prints `3` completions per line (not `1`). This makes large amount of completions to look
better. Argument can be given, e.g. `6`, to increase the grouping.
- New Ice-mod `silent` that mutes `stderr` & `stdout` of a plugin or snippet.
* 04-11-2017
- 04-11-2017
- New subcommand `ls` which lists snippets-directory in a formatted and colorized manner. Example:
![zplugin-ls](https://raw.githubusercontent.com/zdharma/zplugin/images/zplg-ls.png)
* 29-10-2017
- Subversion protocol (supported by Github) can be used to clone **subdirectories** when using
snippets. This allows to load multi-file snippets. For example:
- 29-10-2017
- Subversion protocol (supported by Github) can be used to clone **subdirectories** when using snippets. This allows
to load multi-file snippets. For example:
```SystemVerilog
zstyle ':prezto:module:prompt' theme smiley
zplugin ice svn silent; zplugin snippet PZT::modules/prompt
```
- Snippets support `Prezto` modules (with dependencies), and can use **PZT::** URL-shorthand,
like in the example above. One can load `Prezto` module as single file snippet, or use Subversion
to download whole directory (see also description of [Ice Modifiers](#ice-modifiers)):
- Snippets support `Prezto` modules (with dependencies), and can use **PZT::** URL-shorthand, like in the example
above. One can load `Prezto` module as single file snippet, or use Subversion to download whole directory (see also
description of [Ice Modifiers](#ice-modifiers)):
```zsh
# Single file snippet, URL points to file
@ -660,7 +680,8 @@ # Changelog
- Fixed a bug with `cURL` usage (snippets) for downloading, it will now be properly used
* 13-10-2017
- 13-10-2017
- Snippets can use "**OMZ::**" prefix to easily point to `Oh-My-Zsh` plugins and libraries, e.g.:
```SystemVerilog
@ -668,10 +689,11 @@ # Changelog
zplugin snippet OMZ::plugins/git/git.plugin.zsh
```
* 12-10-2017
- 12-10-2017
- The `cd` subcommand can now obtain URL and move session to **snippet** directory
- The `times` subcommand now includes statistics on snippets. Also, entries
are displayed in order of loading:
- The `times` subcommand now includes statistics on snippets. Also, entries are displayed in order of loading:
```zsh
% zplugin times
@ -683,10 +705,12 @@ # Changelog
0.003 sec - zsh-users/zsh-autosuggestions
```
* 24-09-2017
- 24-09-2017
- **[Code documentation](zsdoc)** for contributors and interested people.
* 13-06-2017
- 13-06-2017
- Plugins can now be absolute paths:
```SystemVerilog
@ -697,7 +721,8 @@ # Changelog
Completions are not automatically installed, but user can run `zplg creinstall %HOME/github/{directory}`, etc.
* 23-05-2017
- 23-05-2017
- New `ice` modifier: `if`, to which you can provide a conditional expression:
```SystemVerilog

View file

@ -3,7 +3,7 @@ # Documentation
## README: Update the table of content
1. Install [doctoc](https://github.com/thlorenz/doctoc)
2. To update the TOC run the following command:
1. To update the TOC run the following command:
```zsh
doctoc --github README.md
@ -11,26 +11,24 @@ ## README: Update the table of content
## 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:
1. 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`
1. [zshelldoc (zsd)](https://github.com/zdharma-continuum/zshelldoc)
1. [asciidoc](https://asciidoc.org/)
1. `make doc`
## Generate the manpage (doc/zinit.1)
1. Install [pandoc](https://pandoc.org/)
2. From the root of the repo run:
1. From the root of the repo run:
```zsh
pandoc --standalone --to man README.md -o doc/zinit.1
@ -39,17 +37,18 @@ ## Generate the manpage (doc/zinit.1)
## Updating the gh-pages (zdharma-continuum.github.io)
1. Check out the [documentation branch](https://github.com/zdharma-continuum/zinit/tree/documentation)
```shell
git fetch origin documentation
git checkout documentation
```
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.
**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
1. Keep an eye on [the CI logs](https://github.com/zdharma-continuum/zinit/actions/workflows/gh-pages.yaml)
1. If all went well you can 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
# Testing
@ -115,13 +114,12 @@ # Check if we downloaded the file correctly and if it is readable
## 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 out the `@teardown` section in your
test. Then you can re-run said test and head over to
`${TMPDIR:-/tmp}/zunit-zinit`. Good luck!
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
## Get the list of supported ices
To get the list in a quick-and-dirty fashion you issue:
@ -130,5 +128,6 @@ ## Get the list of supported ices
zinit --help | tail -1
```
See [zinit-autoload.zsh](https://github.com/zdharma-continuum/zinit/blob/2feb41cf70d2f782386bbaa6fda691e3bdc7f1ac/zinit-autoload.zsh#L3445-L3447)
See
[zinit-autoload.zsh](https://github.com/zdharma-continuum/zinit/blob/2feb41cf70d2f782386bbaa6fda691e3bdc7f1ac/zinit-autoload.zsh#L3445-L3447)
for implementation details.

View file

@ -1,18 +1,22 @@
# Code documentation
Here is `Asciidoc` code documentation generated using [Zshelldoc](https://github.com/zdharma-continuum/zshelldoc).
There are `4` Zinit's source files, the main one is [zinit.zsh](zinit.zsh.adoc). The documentation
lists all functions, interactions between them, their comments and features used.
Here is `Asciidoc` code documentation generated using [Zshelldoc](https://github.com/zdharma-continuum/zshelldoc). There
are `4` Zinit's source files, the main one is [zinit.zsh](zinit.zsh.adoc). The documentation lists all functions,
interactions between them, their comments and features used.
Github allows to directly view `Asciidoc` documents:
* [zinit.zsh](zinit.zsh.adoc) always loaded, in `.zshrc` ([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit.zsh))
* [zinit-side.zsh](zinit-side.zsh.adoc) common functions, loaded by `*-install` and `*-autoload` scripts ([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit-side.zsh))
* [zinit-install.zsh](zinit-install.zsh.adoc) functions used only when installing a plugin or snippet ([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit-install.zsh))
* [zinit-autoload.zsh](zinit-autoload.zsh.adoc) functions used only in interactive `Zinit` invocations ([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit-autoload.zsh/))
- [zinit.zsh](zinit.zsh.adoc) always loaded, in `.zshrc`
([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit.zsh))
- [zinit-side.zsh](zinit-side.zsh.adoc) common functions, loaded by `*-install` and `*-autoload` scripts
([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit-side.zsh))
- [zinit-install.zsh](zinit-install.zsh.adoc) functions used only when installing a plugin or snippet
([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit-install.zsh))
- [zinit-autoload.zsh](zinit-autoload.zsh.adoc) functions used only in interactive `Zinit` invocations
([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit-autoload.zsh/))
# PDFs, man pages, etc.
Formats other than `Asciidoc` can be produced by using provided Makefile. For example, issuing
`make pdf` will create and populate a new directory `pdf` (requires `asciidoctor`, install with
`gem install asciidoctor-pdf --pre`). `make man` will create man pages (requires package `asciidoc`,
uses its command `a2x`, which is quite slow).
Formats other than `Asciidoc` can be produced by using provided Makefile. For example, issuing `make pdf` will create
and populate a new directory `pdf` (requires `asciidoctor`, install with `gem install asciidoctor-pdf --pre`).
`make man` will create man pages (requires package `asciidoc`, uses its command `a2x`, which is quite slow).

View file

@ -1,7 +1,10 @@
#!/usr/bin/env bash
build() {
cd "$(cd "$(dirname "$0")" >/dev/null 2>&1; pwd -P)" || exit 9
cd "$(
cd "$(dirname "$0")" > /dev/null 2>&1
pwd -P
)" || exit 9
local image_name="${1:-zinit}"
local tag="${2:-latest}"
@ -10,15 +13,14 @@ build() {
local dockerfile="../docker/Dockerfile"
if [[ -n "$zsh_version" ]]
then
if [[ -n $zsh_version ]]; then
tag="zsh${zsh_version}-${tag}"
fi
echo -e "\e[34mBuilding image: ${image_name}\e[0m" >&2
local -a args
[[ -n "$NO_CACHE" ]] && args+=(--no-cache "$@")
[[ -n $NO_CACHE ]] && args+=(--no-cache "$@")
if docker build \
--build-arg "PUSERNAME=$(id -u -n)" \
@ -29,8 +31,7 @@ build() {
--file "$dockerfile" \
--tag "${image_name}:${tag}" \
"${args[@]}" \
"$(realpath ..)"
then
"$(realpath ..)"; then
{
echo -e "\e[34mTo use this image for zunit tests run: \e[0m"
echo -e "\e[34mexport CONTAINER_IMAGE=\"${image_name}\" CONTAINER_TAG=\"${tag}\"\e[0m"
@ -42,25 +43,23 @@ build() {
fi
}
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]
then
if [[ ${BASH_SOURCE[0]} == "${0}" ]]; then
BUILD_ZSH_VERSION="${BUILD_ZSH_VERSION:-}"
CONTAINER_IMAGE="${CONTAINER_IMAGE:-ghcr.io/zdharma-continuum/zinit}"
CONTAINER_TAG="${CONTAINER_TAG:-latest}"
NO_CACHE="${NO_CACHE:-}"
while [[ -n "$*" ]]
do
while [[ -n $* ]]; do
case "$1" in
--image|-i)
--image | -i)
CONTAINER_IMAGE="$2"
shift 2
;;
--no-cache|-N)
--no-cache | -N)
NO_CACHE=1
shift
;;
--zsh-version|-zv|--zv)
--zsh-version | -zv | --zv)
BUILD_ZSH_VERSION="${2}"
shift 2
;;

View file

@ -4,14 +4,12 @@ parent_process() {
local ppid pcmd
ppid="$(ps -o ppid= -p "$$" | awk '{ print $1 }')"
if [[ -z "$ppid" ]]
then
if [[ -z $ppid ]]; then
echo "Failed to determine parent process" >&2
return 1
fi
if pcmd="$(ps -o cmd= -p "$ppid")"
then
if pcmd="$(ps -o cmd= -p "$ppid")"; then
echo "$pcmd"
return
fi
@ -20,13 +18,11 @@ parent_process() {
}
running_interactively() {
if [[ -n "$CI" ]]
then
if [[ -n $CI ]]; then
return 1
fi
if ! [[ -t 1 ]]
then
if ! [[ -t 1 ]]; then
# return false if running non-interactively, unless run with zunit
parent_process | grep -q zunit
fi
@ -35,8 +31,7 @@ running_interactively() {
create_init_config_file() {
local tempfile
if [[ -z "$*" ]]
then
if [[ -z $* ]]; then
return 1
fi
@ -57,23 +52,19 @@ run() {
local cruntime=docker
local sudo_cmd
if [[ -z "$CI" ]] && command -v podman >/dev/null 2>&1
then
if [[ -z $CI ]] && command -v podman > /dev/null 2>&1; then
cruntime=podman
# rootless containers are a PITA
# https://www.tutorialworks.com/podman-rootless-volumes/
sudo_cmd=sudo
fi
if running_interactively
then
if running_interactively; then
args+=(--tty=true --interactive=true)
fi
if [[ -n "$init_config" ]]
then
if [[ -r "$init_config" ]]
then
if [[ -n $init_config ]]; then
if [[ -r $init_config ]]; then
args+=(--volume "${init_config}:/init.zsh")
else
echo "❌ Init config file is not readable" >&2
@ -81,34 +72,27 @@ run() {
fi
fi
if [[ -n "$CONTAINER_WORKDIR" ]]
then
if [[ -n $CONTAINER_WORKDIR ]]; then
args+=(--workdir "$CONTAINER_WORKDIR")
fi
# Inherit TERM
if [[ -n "$TERM" ]]
then
if [[ -n $TERM ]]; then
args+=(--env "TERM=${TERM}")
fi
if [[ -n "${CONTAINER_ENV[*]}" ]]
then
if [[ -n ${CONTAINER_ENV[*]} ]]; then
local e
for e in "${CONTAINER_ENV[@]}"
do
for e in "${CONTAINER_ENV[@]}"; do
args+=(--env "${e}")
done
fi
if [[ -n "${CONTAINER_VOLUMES[*]}" ]]
then
if [[ -n ${CONTAINER_VOLUMES[*]} ]]; then
local vol
for vol in "${CONTAINER_VOLUMES[@]}"
do
for vol in "${CONTAINER_VOLUMES[@]}"; do
# shellcheck disable=2076
if [[ ! " ${args[*]} " =~ " --volume ${vol} " ]]
then
if [[ ! " ${args[*]} " =~ " --volume ${vol} " ]]; then
args+=(--volume "${vol}")
fi
done
@ -116,15 +100,13 @@ run() {
local -a cmd=("$@")
if [[ -n "$WRAP_CMD" ]]
then
if [[ -n $WRAP_CMD ]]; then
local zsh_opts="ilsc"
[[ -n "$ZSH_DEBUG" ]] && zsh_opts="x${zsh_opts}"
[[ -n $ZSH_DEBUG ]] && zsh_opts="x${zsh_opts}"
cmd=(zsh "-${zsh_opts}" "${cmd[*]}")
fi
if [[ -n "$DEBUG" ]]
then
if [[ -n $DEBUG ]]; then
{
# The @Q below is necessary to keep the quotes intact
# https://stackoverflow.com/a/12985353/1872036
@ -136,8 +118,7 @@ run() {
${sudo_cmd} "${cruntime}" run "${args[@]}" "${image}:${tag}" "${cmd[@]}"
}
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]
then
if [[ ${BASH_SOURCE[0]} == "${0}" ]]; then
CONTAINER_ENV=()
CONTAINER_IMAGE="${CONTAINER_IMAGE:-ghcr.io/zdharma-continuum/zinit}"
CONTAINER_TAG="${CONTAINER_TAG:-latest}"
@ -149,32 +130,30 @@ then
WRAP_CMD="${WRAP_CMD:-}"
ZSH_DEBUG="${ZSH_DEBUG:-}"
while [[ -n "$*" ]]
do
while [[ -n $* ]]; do
case "$1" in
# Fetch init config from clipboard (Linux only)
--xsel|-b)
--xsel | -b)
INIT_CONFIG_VAL="$(xsel -b)"
shift
;;
-c|--config|--init-config|--init)
-c | --config | --init-config | --init)
INIT_CONFIG_VAL="$2"
shift 2
;;
-f|--config-file|--init-config-file|--file)
if ! [[ -r "$2" ]]
then
-f | --config-file | --init-config-file | --file)
if ! [[ -r $2 ]]; then
echo "Unable to read from file: $2" >&2
exit 2
fi
INIT_CONFIG_VAL="$(cat "$2")"
shift 2
;;
-d|--debug)
-d | --debug)
DEBUG=1
shift
;;
-D|--dev|--devel)
-D | --dev | --devel)
DEVEL=1
shift
;;
@ -182,36 +161,36 @@ then
PRESET=docs
shift
;;
-i|--image)
-i | --image)
CONTAINER_IMAGE="$2"
shift 2
;;
-t|--tag)
-t | --tag)
CONTAINER_TAG="$2"
shift 2
;;
# Additional container env vars
-e|--env|--environment)
-e | --env | --environment)
CONTAINER_ENV+=("$2")
shift 2
;;
# Additional container volumes
-v|--volume)
-v | --volume)
CONTAINER_VOLUMES+=("$2")
shift 2
;;
# Whether to wrap the command in zsh -silc
-w|--wrap)
-w | --wrap)
WRAP_CMD=1
shift
;;
--tests|--zunit|-z)
--tests | --zunit | -z)
PRESET=zunit
shift
;;
# Whether to enable debug tracing of zinit (zsh -x)
# Only applies to wrapped commands (--w|--wrap)
--zsh-debug|-x|-Z)
--zsh-debug | -x | -Z)
ZSH_DEBUG=1
shift
;;
@ -221,7 +200,10 @@ then
esac
done
GIT_ROOT_DIR="$(cd "$(dirname "$0")/.." >/dev/null 2>&1; pwd -P)" || exit 9
GIT_ROOT_DIR="$(
cd "$(dirname "$0")/.." > /dev/null 2>&1
pwd -P
)" || exit 9
CMD=("$@")
case "$PRESET" in
@ -259,13 +241,11 @@ then
;;
esac
if INIT_CONFIG="$(create_init_config_file "$INIT_CONFIG_VAL")"
then
if INIT_CONFIG="$(create_init_config_file "$INIT_CONFIG_VAL")"; then
trap 'rm -vf $INIT_CONFIG' EXIT INT
fi
if [[ -n "$DEVEL" ]]
then
if [[ -n $DEVEL ]]; then
# Mount root of the repo to /src
CONTAINER_VOLUMES+=(
"${GIT_ROOT_DIR}:/src"

View file

@ -27,8 +27,7 @@ echo_fancy() {
# wrap every word in color (needed in case there are custom colors in
# the message itself), unless NO_COLOR is set
for str in "$@"
do
for str in "$@"; do
# FIXME: NO_COLOR only applies if there are no colors in the msg
if [ -z "$NO_COLOR" ]; then
msg="${msg}${color}"
@ -61,13 +60,13 @@ echo_error() {
check_dependencies() {
zsh_min_version=5.5
if ! zsh -sfc \
'autoload is-at-least;
'autoload is-at-least;
is-at-least $1 $ZSH_VERSION' "$zsh_min_version"; then
echo_warning "ZSH version 5.5+ is recommended for zinit." \
"It'll still work, but be warned."
"It'll still work, but be warned."
fi
if ! command -v git >/dev/null 2>&1; then
if ! command -v git > /dev/null 2>&1; then
echo_error "${COLOR_BOLD_GREEN}git${COLOR_RESET} is not installed"
exit 1
fi
@ -77,8 +76,8 @@ check_dependencies() {
show_environment() {
echo_info "About to setup zinit from $ZINIT_REPO" \
"(branch: $ZINIT_BRANCH - commit: ${ZINIT_COMMIT:-N/A})" \
"to ${ZINIT_INSTALL_DIR}"
"(branch: $ZINIT_BRANCH - commit: ${ZINIT_COMMIT:-N/A})" \
"to ${ZINIT_INSTALL_DIR}"
}
create_zinit_home() {
@ -106,16 +105,15 @@ download_git_output_processor() {
script_path="${ZINIT_TMPDIR}/git-process-output.zsh"
echo_info "Fetching git-process-output.zsh from $url"
if command -v curl >/dev/null 2>&1; then
if command -v curl > /dev/null 2>&1; then
curl -fsSL -o "$script_path" "$url"
elif command -v wget >/dev/null 2>&1; then
elif command -v wget > /dev/null 2>&1; then
wget -q -O "$script_path" "$url"
fi
# shellcheck disable=2181
if [ "$?" -eq 0 ]
then
chmod a+x "$script_path" 2>/dev/null
if [ "$?" -eq 0 ]; then
chmod a+x "$script_path" 2> /dev/null
echo_success 'Download finished!'
else
echo_warning "Download failed."
@ -132,13 +130,12 @@ zinit_checkout_ref() {
ref="${ZINIT_BRANCH}"
git_obj_type="branch"
if [ -n "$ZINIT_COMMIT" ]
then
if [ -n "$ZINIT_COMMIT" ]; then
ref="$ZINIT_COMMIT"
git_obj_type="commit"
fi
if zinit_git_exec checkout "$ref" >/dev/null 2>&1; then
if zinit_git_exec checkout "$ref" > /dev/null 2>&1; then
echo_success "Checked out $git_obj_type $ref"
else
echo_error "Failed to check out $git_obj_type $ref"
@ -148,7 +145,7 @@ zinit_checkout_ref() {
}
zinit_current_version() {
zinit_git_exec describe --tags 2>/dev/null
zinit_git_exec describe --tags 2> /dev/null
}
zinit_update() {
@ -158,11 +155,11 @@ zinit_update() {
}
echo_info "Updating ${COLOR_BOLD_CYAN}zinit${COLOR_RESET} in" \
"in ${COLOR_BOLD_MAGENTA}${ZINIT_INSTALL_DIR}"
"in ${COLOR_BOLD_MAGENTA}${ZINIT_INSTALL_DIR}"
{ # Clean up repo
zinit_git_exec clean -d -f -f
zinit_git_exec reset --hard HEAD
} >/dev/null 2>&1
} > /dev/null 2>&1
# fetch our branch (to ensure the target commit exists locally)
zinit_git_exec fetch origin "$ZINIT_BRANCH"
@ -180,20 +177,20 @@ zinit_install() {
}
echo_info "Installing ${COLOR_BOLD_CYAN}zinit${COLOR_RESET} to " \
"${COLOR_BOLD_MAGENTA}${ZINIT_INSTALL_DIR}"
"${COLOR_BOLD_MAGENTA}${ZINIT_INSTALL_DIR}"
{
command git clone --progress --branch "$ZINIT_BRANCH" \
"https://github.com/${ZINIT_REPO}" \
"${ZINIT_REPO_DIR_NAME}" 2>&1 | {
"${ZINIT_TMPDIR}/git-process-output.zsh" || cat;
"${ZINIT_TMPDIR}/git-process-output.zsh" || cat
}
} 2>/dev/null
} 2> /dev/null
zinit_checkout_ref
if [ -d "${ZINIT_REPO_DIR_NAME}" ]; then
echo_success "Zinit succesfully installed to " \
"${COLOR_BOLD_GREEN}${ZINIT_INSTALL_DIR}"
"${COLOR_BOLD_GREEN}${ZINIT_INSTALL_DIR}"
echo_info "Zinit Version: ${COLOR_BOLD_GREEN}$(zinit_current_version)"
else
echo_error "Failed to install Zinit to ${COLOR_BOLD_YELLOW}${ZINIT_INSTALL_DIR}"
@ -203,7 +200,7 @@ zinit_install() {
# Modify .zshrc
edit_zshrc() {
rc_update=1
if grep -E '(zinit|zplugin)\.zsh' "${ZSHRC}" >/dev/null 2>&1; then
if grep -E '(zinit|zplugin)\.zsh' "${ZSHRC}" > /dev/null 2>&1; then
echo_warning "${ZSHRC} already contains zinit commands. Not making any changes."
rc_update=0
fi
@ -211,7 +208,7 @@ edit_zshrc() {
if [ $rc_update -eq 1 ]; then
echo_info "Updating ${ZSHRC} (10 lines of code, at the bottom)"
zinit_home_escaped="$(echo "${ZINIT_HOME}" | sed "s|$HOME|\$HOME|")"
command cat <<-EOF >> "$ZSHRC"
command cat <<- EOF >> "$ZSHRC"
### Added by Zinit's installer
if [[ ! -f ${zinit_home_escaped}/${ZINIT_REPO_DIR_NAME}/zinit.zsh ]]; then
@ -233,7 +230,7 @@ EOF
query_for_annexes() {
zshrc_annex_file="$(mktemp)"
command cat <<-EOF >>"$zshrc_annex_file"
command cat <<- EOF >> "$zshrc_annex_file"
# Load a few important annexes, without Turbo
# (this is currently required for annexes)
@ -248,14 +245,13 @@ EOF
# If NO_INPUT is set, but NO_ANNEXES is the annexes bit gets appended to the
# config (ie. default to yes if NO_INPUT, unless NO_ANNEXES)
reply=n
if [ -n "$NO_INPUT" ]
then
if [ -n "$NO_INPUT" ]; then
[ -z "$NO_ANNEXES" ] && reply=y
else
echo "${COLOR_PALE_MAGENTA}${COLOR_RESET} Would you like to add 4 useful plugins" \
"- the most useful annexes (Zinit extensions that add new" \
"functions-features to the plugin manager) to the zshrc as well?" \
"It will be the following snippet:"
"- the most useful annexes (Zinit extensions that add new" \
"functions-features to the plugin manager) to the zshrc as well?" \
"It will be the following snippet:"
command cat "$zshrc_annex_file"
# shellcheck disable=2059
printf "${COLOR_PALE_MAGENTA}${COLOR_RESET} Enter y/n and press Return: "
@ -271,15 +267,14 @@ EOF
echo_warning "Skipped the annexes."
fi
command cat <<-EOF >> "$ZSHRC"
command cat <<- EOF >> "$ZSHRC"
### End of Zinit's installer chunk
EOF
unset reply zshrc_annex_file
}
display_tutorial() {
command cat <<-EOF
command cat <<- EOF
🌻 ${COLOR_BOLD_WHITE_ON_BLACK}Welcome!${COLOR_RESET}
@ -301,7 +296,7 @@ EOF
# Globals. Can be overridden.
ZINIT_REPO="${ZINIT_REPO:-zdharma-continuum/zinit}"
ZINIT_BRANCH="${ZINIT_BRANCH:-main}"
ZINIT_COMMIT="${ZINIT_COMMIT:-}" # no default value
ZINIT_COMMIT="${ZINIT_COMMIT:-}" # no default value
ZINIT_HOME="${ZINIT_HOME:-${XDG_DATA_HOME:-${HOME}/.local/share}/zinit}"
ZINIT_REPO_DIR_NAME="${ZINIT_REPO_DIR_NAME:-zinit.git}"
ZINIT_INSTALL_DIR=${ZINIT_INSTALL_DIR:-${ZINIT_HOME}/${ZINIT_REPO_DIR_NAME}}
@ -320,14 +315,12 @@ else
zinit_install
fi
if [ -z "$NO_EDIT" ]
then
if [ -z "$NO_EDIT" ]; then
edit_zshrc
[ -z "$ZINIT_UPDATE" ] && query_for_annexes
fi
if [ -z "$NO_TUTORIAL" ]
then
if [ -z "$NO_TUTORIAL" ]; then
display_tutorial
fi

View file

@ -1,12 +1,14 @@
#!/usr/bin/env bash
run_tests() {
cd "$(cd "$(dirname "$0")" >/dev/null 2>&1; pwd -P)/.." || exit 9
cd "$(
cd "$(dirname "$0")" > /dev/null 2>&1
pwd -P
)/.." || exit 9
zunit run --verbose "$@"
}
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]
then
if [[ ${BASH_SOURCE[0]} == "${0}" ]]; then
run_tests "$@"
fi