ZINIT(1)
π ZINIT(1) β zinit, the flexible fast Zsh plugin manager π
okay so bestie, welcome to ZINIT(1) β the manual page for zinit, and no cap this thing is a whole era. β¨
The badges at the top are giving:
- MIT License badge β
https://img.shields.io/badge/license-MIT-blue.svg - GitHub tag badge β
https://img.shields.io/github/tag/zdharma-continuum/zinit.svg, pointing at releases:https://github.com/zdharma-continuum/zinit/releases - Join the chat at badge β Matrix:
https://matrix.to/#/#zdharma-continuum_community:gitter.im, badge image:https://badges.gitter.im/zdharma-continuum/zinit.svg, Gitter:https://gitter.im/zdharma-continuum/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
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. π§ For migration instructions please refer to this wiki entry:https://github.com/zdharma-continuum/zinit/wiki/%F0%9F%9A%9A-Migration-to-zdharma-continuum
π§ Table of Contents (DocToc made this, iykyk) π§
Table of Contents generated with DocToc: https://github.com/thlorenz/doctoc
- News
- Zinit
- Zinit Wiki
- Quick Start
- Install
- Automatic Installation (Recommended)
- Manual Installation
- Usage
- Introduction
- Plugins and snippets
- Upgrade Zinit and plugins
- Turbo and lucid
- Migration
- More Examples
- Install
- How to Use
- Ice Modifiers
- Cloning Options
- Selection of Files (To Source, ...)
- Conditional Loading
- Plugin Output
- Completions
- Command Execution After Cloning, Updating or Loading
- Sticky-Emulation Of Other Shells
- Others
- Order of Execution
- Zinit Commands
- Help
- Loading and Unloading
- Completions
- Tracking of the Active Session
- Reports and Statistics
- Compiling
- Other
- Updating Zinit and Plugins
- Ice Modifiers
- Completions
- Calling compinit Without Turbo Mode
- Calling compinit With Turbo Mode
- Ignoring Compdefs
- Disabling System-Wide compinit Call (Ubuntu)
- Zinit Module
- Hints and Tips
- Customizing Paths
- Non-GitHub (Local) Plugins
- Extending Git
- Supporting
- Getting Help and Community
π° News
See here. To see the full history check the changelog. π
π Zinit
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 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 managers here:
https://github.com/zdharma-continuum/pm-perf-test. - 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 you to quickly familiarize yourself with a new plugin and provides rich and easy-to-digest information which might be helpful on various occasions. π
- Supported is unloading of plugin and the ability to list, (un)install and selectively disable, enable pluginβs completions. slay.
- 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). - The system does not use
$FPATH; loading multiple plugins doesnβt clutter$FPATHwith the same number of entries (e.g. 10, 15 or more). Code is immune toKSH_ARRAYSand other options typically causing compatibility problems. β¨ - Zinit supports special, dedicated packages that offload the user from providing long and complex commands. See the zinit-packages repository for a growing, complete list of Zinit packages:
https://github.com/zdharma-continuum/zinit-packagesβ and the Wiki page for an article about the feature:https://zdharma-continuum.github.io/zinit/wiki/Zinit-Packages/. - Also, specialized Zinit extensions β called annexes β allow you to extend the plugin manager with new commands, URL-preprocessors (used by e.g.:
zinit-annex-as-monitorannex:https://github.com/zdharma-continuum/zinit-annex-as-monitor), post-install and post-update hooks and much more. See the zdharma-continuum organization for a growing, complete list of available Zinit extensions:https://github.com/zdharma-continuumβ and refer to the Wiki article for an introduction on creating your own annex:https://zdharma-continuum.github.io/zinit/wiki/Annexes/.
π 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 complete information with examples. Make sure to read it to get the most out of Zinit. π«Ά
πΈ Quick Start
π§Έ Install
π Automatic Installation (Recommended)
The easiest way to install Zinit is to execute:
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.
After installing and reloading the shell compile Zinit with zinit self-update.
π οΈ Manual Installation
To manually install Zinit clone the repo to e.g. ~/.local/share/zinit/zinit.git:
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
mkdir -p "$(dirname $ZINIT_HOME)"
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):
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
source "${ZINIT_HOME}/zinit.zsh"
If you place the source below compinit, then add those two lines after the source:
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
Various paths can be customized, see section Customizing Paths.
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. no cap, itβs worth it.
π§© Plugins and snippets
Plugins can be loaded using load or light.
zinit load <repo/plugin> # Load with reporting/investigating.
zinit light <repo/plugin> # Load without reporting/investigating.
If you want to source local or remote files (using direct URL), you can do so with snippet.
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). π₯
Example
# Plugin history-search-multi-word loaded with investigating.
zinit load zdharma-continuum/history-search-multi-word
# Two regular plugins loaded without investigating.
zinit light zsh-users/zsh-autosuggestions
zinit light zdharma-continuum/fast-syntax-highlighting
# Snippet
zinit snippet https://gist.githubusercontent.com/hightemp/5071909/raw/
Prompt(Theme) Example
This is powerlevel10k (https://github.com/romkatv/powerlevel10k), pure (https://github.com/sindresorhus/pure), starship (https://github.com/starship/starship) sample:
# Load powerlevel10k theme
zinit ice depth"1" # git clone depth
zinit light romkatv/powerlevel10k
# Load pure theme
zinit ice pick"async.zsh" src"pure.zsh" # with zsh-async library that's bundled with it.
zinit light sindresorhus/pure
# Load starship theme
zinit ice as"command" from"gh-r" \ # `starship` binary as command, from github release
atclone"./starship init zsh > init.zsh; ./starship completions zsh > _starship" \ # starship setup at clone(create init.zsh, completion)
atpull"%atclone" src"init.zsh" # pull behavior same as clone, source init.zsh
zinit light starship/starship
π Upgrade Zinit and plugins
Zinit can be updated to self-update and plugins to update.
# Self update
zinit self-update
# Plugin update
zinit update
# Plugin parallel update
zinit update --parallel
# Increase the number of jobs in a concurrent-set to 40
zinit update --parallel 40
β‘ Turbo and lucid
Turbo and lucid are the most used options.
Turbo Mode
Turbo mode is the key to performance. It can be loaded asynchronously, which makes a huge difference when the amount of plugins increases.
Usually used as zinit ice wait"<SECONDS>", letβs use the previous example:
zinit ice wait # wait is same wait"0"
zinit load zdharma-continuum/history-search-multi-word
zinit ice wait"2" # load after 2 seconds
zinit load zdharma-continuum/history-search-multi-word
zinit ice wait # also be used in `light` and `snippet`
zinit snippet https://gist.githubusercontent.com/hightemp/5071909/raw/
Lucid
Turbo mode is verbose, so you need an option for quiet.
You can use with lucid:
zinit ice wait lucid
zinit load zdharma-continuum/history-search-multi-word
F&A: What is ice?
ice is zinitβs option command. The option melts like ice and is used only once. (more: Ice Modifiers) π§
π Migration
Migration from Oh-My-ZSH
Basic
zinit snippet <URL> # Raw Syntax with URL
zinit snippet OMZ::<PATH> # Shorthand OMZ/ (https://github.com/ohmyzsh/ohmyzsh/raw/master/)
zinit snippet OMZL::<PATH> # Shorthand OMZ/lib/
zinit snippet OMZT::<PATH> # Shorthand OMZ/themes/
zinit snippet OMZP::<PATH> # Shorthand OMZ/plugins/
π Library
Okay so the 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) β is literally right here and it's so clean π
# Raw Syntax
zinit snippet https://github.com/ohmyzsh/ohmyzsh/blob/master/lib/clipboard.zsh
zinit snippet https://github.com/ohmyzsh/ohmyzsh/blob/master/lib/termsupport.zsh
# OMZ Shorthand Syntax
zinit snippet OMZ::lib/clipboard.zsh
zinit snippet OMZ::lib/termsupport.zsh
# OMZL Shorthand Syntax
zinit snippet OMZL::clipboard.zsh
zinit snippet OMZL::termsupport.zsh
π Theme π
To use themes made for Oh My Zsh, you might want to first source the git library from over there, bestie.
Then you can use the themes as snippets: zinit snippet <file path or GitHub URL>. Some themes need not only Oh My Zsh's Git library but the Git plugin too (an error about current_branch may appear π). Load that Git plugin as a single-file snippet straight from OMZ.
Most themes require the promptsubst option (setopt promptsubst in zshrc) β if it isn't set, then the prompt will appear as something like: ... $(build_prompt) ....
You might want to suppress the completions the git plugin gives you by running zinit cdclear -q (-q is for quiet) β see below Ignoring Compdefs π.
To summarize:
## Oh My Zsh Setting
ZSH_THEME="robbyrussell"
## Zinit Setting
# Must Load OMZ Git library
zinit snippet OMZL::git.zsh
# Load Git plugin from OMZ
zinit snippet OMZP::git
zinit cdclear -q # <- forget completions provided up to this moment
setopt promptsubst
# Load Prompt
zinit snippet OMZT::robbyrussell
π External Theme Sample: NicoSantangelo/Alpharized (https://github.com/nicosantangelo/Alpharized)
## Oh My Zsh Setting
ZSH_THEME="alpharized"
## Zinit Setting
# Must Load OMZ Git library
zinit snippet OMZL::git.zsh
# Load Git plugin from OMZ
zinit snippet OMZP::git
zinit cdclear -q # <- forget completions provided up to this moment
setopt promptsubst
# Load Prompt
zinit light NicoSantangelo/Alpharized
π F&A: Error occurs when loading OMZ's theme.
If the git library won't be loaded, then errors like the following will appear:
........:1: command not found: git_prompt_status
........:1: command not found: git_prompt_short_sha
π§© Plugin π§©
If it consists of a single file, you can just load it. Easy.
## Oh-My-Zsh Setting
plugins=(
git
dotenv
rake
rbenv
ruby
)
## Zinit Setting
zinit snippet OMZP::git
zinit snippet OMZP::dotenv
zinit snippet OMZP::rake
zinit snippet OMZP::rbenv
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):
zinit ice svn
zinit snippet OMZP::gitfast
zinit ice svn
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):
zinit ice as"completion"
zinit snippet OMZP::docker/_docker
zinit ice as"completion"
zinit snippet OMZP::fd/_fd
You can see an extended explanation of the Oh-My-Zsh setup in the Wiki (https://zdharma-continuum.github.io/zinit/wiki/Example-Oh-My-Zsh-setup/) β¨
π Migration from Prezto π
Basic π±
zinit snippet <URL> # Raw Syntax with URL
zinit snippet PZT::<PATH> # Shorthand PZT/ (https://github.com/sorin-ionescu/prezto/tree/master/)
zinit snippet PZTM::<PATH> # Shorthand PZT/modules/
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:
## Prezto Setting
zstyle ':prezto:load' pmodule 'environment' 'terminal'
## Zinit Setting
# Raw Syntax
zinit snippet https://github.com/sorin-ionescu/prezto/blob/master/modules/environment/init.zsh
zinit snippet https://github.com/sorin-ionescu/prezto/blob/master/modules/terminal/init.zsh
# PZT Shorthand Syntax
zinit snippet PZT::modules/environment
zinit snippet PZT::modules/terminal
# PZTM Shorthand Syntax
zinit snippet PZTM::environment
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):
zinit ice svn
zinit snippet PZTM::docker
zinit ice svn
zinit snippet PZTM::git
Use zinit ice as"null" if there don't exist *.plugin.zsh, init.zsh, *.zsh-theme* files in the module. Like archive (https://github.com/sorin-ionescu/prezto/tree/master/modules/archive):
zinit ice svn as"null"
zinit snippet PZTM::archive
Use zinit ice atclone"git clone <repo> <location>" if the module has an external module. Like completion (https://github.com/sorin-ionescu/prezto/tree/master/modules/completion):
zplugin ice svn blockf \ # use blockf to prevent any unnecessary additions to fpath, as zinit manages fpath
atclone"git clone --recursive https://github.com/zsh-users/zsh-completions.git external"
zplugin snippet PZTM::completion
π€ F&A: What is zstyle?
Read the 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)).
π Migration from Zgen π
Oh My Zsh π
More reference: check Migration from Oh-My-ZSH
# Load ohmyzsh base
zgen oh-my-zsh
zinit snippet OMZL::<ALL OF THEM>
# Load ohmyzsh plugins
zgen oh-my-zsh <PATH>
zinit snippet OMZ::<PATH>
Prezto π
More reference: check Migration from Prezto
# Load Prezto
zgen prezto
zinit snippet PZTM::<COMMENT's List> # environment terminal editor history directory spectrum utility completion prompt
# Load prezto plugins
zgen prezto <modulename>
zinit snippet PZTM::<modulename>
# Load a repo as Prezto plugins
zgen pmodule <reponame> <branch>
zinit ice ver"<branch>"
zinit load <repo/plugin>
# Set prezto options
zgen prezto <modulename> <option> <value(s)>
zstyle ':prezto:<modulename>:' <option> <values(s)> # Set original prezto style
General π
location: refer Selection of Files
zgen load <repo> [location] [branch]
zinit ice ver"[branch]"
zinit load <repo>
π Migration from Zplug π
Basic π±
zplug <repo/plugin>, tag1:<option1>, tag2:<option2>
zinit ice tag1"<option1>" tag2"<option2>"
zinit load <repo/plugin>
βοΈ Tag comparison βοΈ
as=>asuse=>pick,src,multisrcignore=> Nonefrom=>fromat=>verrename-to=>mv,cpdir=> Selection(pick, ...) with renameif=>ifhook-build=>atclone,atpullhook-load=>atloadfrozen=> Noneon=> Nonedefer=>waitlazy=>autoloaddepth=>depth
β¨ More Examples β¨
After installing Zinit you can start adding some actions (load some plugins) to ~/.zshrc, at the bottom. Some examples, and ngl these are iconic:
# Load the pure theme, with zsh-async library that's bundled with it.
zinit ice pick"async.zsh" src"pure.zsh"
zinit light sindresorhus/pure
# A glance at the new for-syntax β load all of the above
# plugins with a single command. For more information see:
# https://zdharma-continuum.github.io/zinit/wiki/For-Syntax/
zinit for \
light-mode zsh-users/zsh-autosuggestions \
light-mode zdharma-continuum/fast-syntax-highlighting \
zdharma-continuum/history-search-multi-word \
light-mode pick"async.zsh" src"pure.zsh" \
sindresorhus/pure
# Binary release in archive, from GitHub-releases page.
# After automatic unpacking it provides program "fzf".
zinit ice from"gh-r" as"program"
zinit light junegunn/fzf
# One other binary release, it needs renaming from `docker-compose-Linux-x86_64`.
# This is done by ice-mod `mv'{from} -> {to}'. There are multiple packages per
# single version, for OS X, Linux and Windows β so ice-mod `bpick' is used to
# select Linux package β in this case this is actually not needed, Zinit will
# grep operating system name and architecture automatically when there's no `bpick'.
zinit ice from"gh-r" as"program" mv"docker* -> docker-compose" bpick"*linux*"
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.
# 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",
# 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.
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.
# This one is to be ran just once, in interactive session.
zinit creinstall %HOME/my_completions
And there's way more coming, don't you worry π
# For GNU ls (the binaries can be gls, gdircolors, e.g. on OS X when installing the
# coreutils package from Homebrew; you can also use https://github.com/ogham/exa)
zinit ice atclone"dircolors -b LS_COLORS > c.zsh" atpull'%atclone' pick"c.zsh" nocompile'!'
zinit light trapd00r/LS_COLORS
There's a whole extended explanation of LS_COLORS over in the Wiki if you wanna go deeper, bestie π (https://zdharma-continuum.github.io/zinit/wiki/LS_COLORS-explanation/)
# make'!...' -> run make before atclone & atpull
zinit ice as"program" make'!' atclone'./direnv hook zsh > zhook.zsh' atpull'%atclone' src"zhook.zsh"
zinit light direnv/direnv
And there's an extended explanation of direnv in the Wiki too πΈ (https://zdharma-continuum.github.io/zinit/wiki/Direnv-explanation/)
If you're an examples girlie (same), go check out the zinit-configs repository (https://github.com/zdharma-continuum/zinit-configs) β that's where users have uploaded their ~/.zshrc and their whole Zinit setups. Like, actually 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's got Zinit commands in it π
Also!! There's the Gallery of Zinit Invocations (https://zdharma-continuum.github.io/zinit/wiki/GALLERY/) for some extra examples, and two articles on the Wiki showing example setups β one here (https://zdharma-continuum.github.io/zinit/wiki/Example-Minimal-Setup/) and one here (https://zdharma-continuum.github.io/zinit/wiki/Example-Oh-My-Zsh-setup/). Slay.
π How to Use
π§ Ice Modifiers
Okay so the following ice modifiers are the ones you pass (https://zdharma-continuum.github.io/zinit/wiki/Alternate-Ice-Syntax/) to zinit ice ... to get the effects described. And like β the word "ice" literally means something you add, like ice to a drink π₯€, and in Zinit it means adding a modifier to the next zinit command. It's also temporary because ice melts β so the modification only lasts for a single next zinit command. Periodt.
Some Ice-modifiers are highlighted, and clicking on them takes you to the appropriate Wiki page for the extended explanation β¨
You may safely assume a given ice works with both plugins and snippets unless it's explicitly stated otherwise π«Ά
𧬠Cloning Options
protoβ from (https://zdharma-continuum.github.io/zinit/wiki/Private-Repositories/)verbpickdepthcloneoptspulloptssvn
π Selection of Files (To Source, ...)
pick(https://zdharma-continuum.github.io/zinit/wiki/Sourcing-multiple-files/)src(https://zdharma-continuum.github.io/zinit/wiki/Sourcing-multiple-files)multisrc(https://zdharma-continuum.github.io/zinit/wiki/Sourcing-multiple-files)
β³ Conditional Loading
wait(https://zdharma-continuum.github.io/zinit/wiki/Example-wait-conditions)load(https://zdharma-continuum.github.io/zinit/wiki/Multiple-prompts)unload(https://zdharma-continuum.github.io/zinit/wiki/Multiple-prompts)cloneonlyifhassubscribe/on-update-oftrigger-load
π€« Plugin Output
silentlucidnotify
π Completions
blockfnocompletions
πββοΈ Command Execution After Cloning, Updating or Loading
mvcpatclone(https://zdharma-continuum.github.io/zinit/wiki/atload-and-other-at-ices)atpull(https://zdharma-continuum.github.io/zinit/wiki/atload-and-other-at-ices)atinit(https://zdharma-continuum.github.io/zinit/wiki/atload-and-other-at-ices)atload(https://zdharma-continuum.github.io/zinit/wiki/atload-and-other-at-ices)run-atpullnocdmake(https://zdharma-continuum.github.io/zinit/wiki/Installing-with-make)countdownreset
π Sticky-Emulation Of Other Shells
sh,!shbash,!bashksh,!kshcsh,!csh
β¨ Others
asid-as(https://zdharma-continuum.github.io/zinit/wiki/id-as/)compilenocompileservicereset-promptbindmaptrackbindswrap-track(https://zdharma-continuum.github.io/zinit/wiki/wrap-track)aliaseslight-modeextract(https://zdharma-continuum.github.io/zinit/wiki/extract-Ice/)substautoload
π₯ Order of Execution
So here's the order of execution of the related Ice-mods, and yes it's a whole choreography, keep up bestie:
atinit -> atpull! -> make'!!' -> mv -> cp -> [compile, unless nocompile is set] -> make! -> atclone/atpull -> make -> cmake -> [compile when nocompile'!'] -> (plugin script loading) -> src -> multisrc -> atload
Compilation runs in one of two phases, and this part is important so like, pay attention π
By default the pick-pointed files are compiled early β right after cp, and before the atclone/atpull hooks run β so files already present in the repository (or moved into place by mv/cp) get compiled automatically. A file that's created by an atclone or atpull hook does not exist yet at that point, so the default compile just skips it, no cap.
Passing the bang form nocompile'!' disables the early compile and defers compilation to a second phase that runs after make'' and atclone''/atpull'', once the generated file actually exists (see the nocompile ice).
Bare nocompile disables compilation entirely. And make'!!' is the extra-early make phase before mv/cp/extract and the default compile phase π«Ά
π Zinit Commands
These are the commands you pass to zinit ... to get the described effects π«
β Help
-h,--help,helpman
π Loading and Unloading
load {plg-spec}light [-b] {plg-spec}unload [-q] {plg-spec}snippet [-f] {url}
π Completions
clist [columns],completions [columns]cdisable {cname}cenable {cname}creinstall [-q] [-Q] {plg-spec}cuninstall {plg-spec}csearchcompinitcclearcdlistcdreplay [-q]cdclear [-q]
π Tracking of the Active Session
dtrace,dstartdstopdunloaddreportdclear
π Reports and Statistics
times [-s] [-m]zstatusreport {plg-spec}\|--allloaded [keyword],list [keyword]lsstatus {plg-spec}\|URL\|--allrecently [time-spec]bindkeys
π Compiling
compile {plg-spec}\|--alluncompile {plg-spec}\|--allcompiled
π Other
self-updateupdate [-q] [-r] {plg-spec}\|URL\|--allice <ice specification>delete {plg-spec}\|URL\|--clean\|--allcd {plg-spec}edit {plg-spec}
β¬οΈ Updating Zinit and Plugins
To update Zinit, just drop zinit self-update in the command line. Easy π
To update all plugins and snippets, issue zinit update. If you only wanna update a single plugin/snippet instead, issue zinit update NAME_OF_PLUGIN. A list of commits will be shown π
Some plugins require you to perform an action each time they're updated. One way you can do this is with 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 for more info π«Ά
The ice modifiers for any plugin or snippet are stored in their directory in a ._zinit subdirectory, which means the plugin doesn't have to be loaded to be correctly updated. Iconic behaviour honestly. There's one other file created there too β .zinit_lstupd β and it holds the log of the new commits pulled in during the last update π
πΈ COMPLETIONS πΈ
okay bestie, this is the part where everyone gets confused, so let's go slowly π
β¨ Calling compinit Without Turbo Mode β¨
So if you're not using Turbo mode at all, you can just call compinit like a normal person, i.e. autoload compinit; compinit. Two things tho: do it after all your plugins are loaded, and before you maybe call zinit cdreplay. Order matters, bestie, don't come for me π
Now, the cdreplay subcommand exists so you can re-play all the catched compdef calls. And what's a compdef call? It's how you define a completion for a command. Like, compdef _git git literally means "the git command should be completed by a _git function". Iconic, honestly.
The compdef function is provided by the compinit call. But since compinit should be called later β after all the plugins load β Zinit ships its own compdef function that catches (i.e. records in an array) the arguments of the call, so your loaded plugins can just freely call compdef without dying. Then cdreplay (compdef-replay) can be used, after compinit has been called (and the original compdef function becomes available), to execute all the detected compdef calls. To summarize:
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
source "${ZINIT_HOME}/zinit.zsh"
zinit load "some/plugin"
...
compdef _gnu_generic fd # this will be intercepted by Zinit, because as the compinit
# isn't yet loaded, thus there's no such function `compdef'; yet
# Zinit provides its own `compdef' function which saves the
# completion-definition for later possible re-run with `zinit
# cdreplay' or `zicdreplay' (the second one can be used in hooks
# like atload'', atinit'', etc.)
...
zinit load "other/plugin"
autoload -Uz compinit
compinit
zinit cdreplay -q # -q is for quiet; actually run all the `compdef's saved before
#`compinit` call (`compinit' declares the `compdef' function, so
# it cannot be used until `compinit` is ran; Zinit solves this
# via intercepting the `compdef'-calls and storing them for later
# use with `zinit cdreplay')
The whole point? You get to call compinit once. And the performance gains are huge β like, example shell startup time with double compinit: 0.980 sec, with cdreplay and a single compinit: 0.156 sec. That's not a glow-up, that's a whole transformation π
β¨ Calling compinit With Turbo Mode β¨
If you're loading completions with the wait'' Turbo mode, then you can add atinit'zicompinit' to your syntax-highlighting plugin (which should be the last one loaded, as their docs state β that's the two projects, z-sy-h at https://github.com/zsh-users/zsh-syntax-highlighting & f-sy-h at https://github.com/zdharma-continuum/fast-syntax-highlighting), or atload'zicompinit' to your last completion-related plugin.
So what's zicompinit? It's just a function that runs autoload compinit; compinit, made for convenience. You're welcome π«Ά
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 a normal compinit call, except it happens in the atinit or atload hook of the last related plugin, using the helper functions (zicompinit, zicdreplay & zicdclear β see below for what that last one does). To summarize:
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share/zinit}"
source "${ZINIT_HOME}/zinit.zsh"
# Load using the for-syntax
zinit wait lucid for \
"some/plugin"
zinit wait lucid for \
"other/plugin"
zinit wait lucid atload"zicompinit; zicdreplay" blockf for \
zsh-users/zsh-completions
β¨ Ignoring Compdefs β¨
Lowkey wanna ignore the compdefs some plugin or snippet brings? Then place their load commands before the commands that load your other plugins/snippets, and issue zinit cdclear (or zicdclear, designed to be used in hooks like atload''):
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
source "${ZINIT_HOME}/zinit.zsh"
zinit snippet OMZP::git
zinit cdclear -q # <- forget completions provided by Git plugin
zinit load "some/plugin"
...
zinit load "other/plugin"
autoload -Uz compinit
compinit
zinit cdreplay -q # <- execute compdefs provided by rest of plugins
zinit cdlist # look at gathered compdefs
And the cdreplay is important if you use plugins like OMZP::kubectl or asdf-vm/asdf, because those plugins call compdef. Don't skip it bestie, your completions will simply not exist π
β¨ Disabling System-Wide compinit Call (Ubuntu) β¨
On Ubuntu, users might get surprised that e.g. their completions work even though they never called compinit in their .zshrc. That's because the function is being called in /etc/zshrc. Rude, honestly.
To disable this call β which is needed to avoid the slowdown, and honestly if you load any completion-equipped plugins, i.e. almost on 100% β add the following lines to ~/.zshenv:
# Skip the not really helping Ubuntu global compinit
skip_global_compinit=1
π¦ Zinit Module π¦
Heads up: the module is now hosted in its own repository (https://github.com/zdharma-continuum/zinit-module). It moved out, it's got main character energy now, respect it π
π Hints and Tips π
β¨ Customizing Paths β¨
The following variables can be set to custom values, before sourcing Zinit. And listen β the previous global variables like $ZPLG_HOME have been removed so they don't pollute the namespace. There's a single $ZINIT hash instead of 8 string variables. So please update your dotfiles, bestie, this is not optional π
declare -A ZINIT # initial Zinit's hash definition, if configuring before loading Zinit, and then:
Here's every field, no gatekeeping:
ZINIT[BIN_DIR]β Where Zinit code resides, e.g.:~/.local/share/zinit/zinit.gitZINIT[HOME_DIR]β Where Zinit should create all working directories, e.g.:~/.local/share/zinitZINIT[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 byman(See #8). Default:$ZPFX/manZINIT[PLUGINS_DIR]β Override single working directory β for plugins, e.g./opt/zsh/zinit/pluginsZINIT[COMPLETIONS_DIR]β As above, but for completion files, e.g./opt/zsh/zinit/root_completionsZINIT[SNIPPETS_DIR]β As above, but for snippetsZINIT[ZCOMPDUMP_PATH]β Path to.zcompdumpfile, with the file included (i.e. its name can be different)ZINIT[COMPINIT_OPTS]β Options forcompinitcall (i.e. done byzicompinit), use to pass-Cto speed up loadingZINIT[MUTE_WARNINGS]β If set to1, then mutes some of the Zinit warnings, specifically the plugin already registered warningZINIT[OPTIMIZE_OUT_DISK_ACCESSES]β If set to1, 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 ofzshrc. This option can give a performance gain of about10 msout of150 ms(i.e.: Zsh will start up in140 msinstead of150 ms).ZINIT[NO_ALIASES]β If set to1, then Zinit will not set aliases such asziorzini
There's 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'. Slay π₯
β¨ Non-GitHub (Local) Plugins β¨
Use the create subcommand with user name _local (the default) to create the plugin's skeleton in $ZINIT[PLUGINS_DIR]. It will not be connected with a GitHub repository (because the user name is _local, duh). To enter the plugin's directory, use the cd command with just the plugin's name (without _local β it's optional).
But if the user name is not _local, then Zinit will create the repository on GitHub too and set up the correct repository origin. Fancy β¨
β¨ Extending Git β¨
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
.zshrcto a 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 Bin-Gem-Node annex (https://github.com/zdharma-continuum/zinit-annex-bin-gem-node):
zinit as"null" wait"1" lucid for \
sbin Fakerr/git-recall \
sbin cloneopts paulirish/git-open \
sbin paulirish/git-recent \
sbin davidosomething/git-my \
sbin atload"export _MENU_THEME=legacy" \
arzzen/git-quick-stats \
sbin iwata/git-now \
make"PREFIX=$ZPFX install" \
tj/git-extras \
sbin"git-url;git-guclone" make"GITURL_NO_CGITURL=1" \
zdharma-continuum/git-url
Target directory for installed files is $ZPFX (~/.local/share/zinit/polaris by default). Obsessed with this whole setup honestly π
π 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! Fr fr, even the tiniest bit π«Ά
π§ Getting Help and Community π§
Do you need help or wish to get in touch with other Zinit users? Bestie, come hang out:
- Open a discussion (https://github.com/zdharma-continuum/zinit/discussions).
- Or via reach out via Matrix [IMAGE: Join the chat at https://matrix.to/#/#zdharma-continuum_community:gitter.im (https://badges.gitter.im/zdharma-continuum/zinit.svg)] (https://gitter.im/zdharma-continuum/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
and that's the whole page, you made it to the end!! π₯³ this was the ZINIT(1) manpage, and the little footer vibe down there is just the source/version + date situation β consider this your cute lil sign-off from me to you. go forth and have the fastest shell on the block πβ¨π
π¦ where this page comes from
- nixpkgs unstable: zinit 3.17.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms