Zinit
🌻 Flexible and fast ZSH plugin manager
Install / Use
/learn @zdharma-continuum/ZinitREADME
Zinit<a name="zinit"></a>
[![MIT License][mit-badge]][mit-link] [![zinit version][ver-badge]][ver-link] [![zunit tests][tests-badge]][tests-link] [![Join the chat at https://matrix.to/#/#zdharma-continuum_community:gitter.im][gitter-badge]][gitter-link]
<!-- mdformat-toc start --slug=github --maxlevel=3 --minlevel=2 -->- Zinit Wiki
- Install
- Usage
- Frequently Asked Questions
- Ice Modifiers
- Zinit Commands
- Updating Zinit and Plugins
- Completions
- Zinit Module
- Hints and Tips
- Changelog
- Support
- Getting Help and Community
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 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.
-
The plugin manager gives reports from plugin loadings describing what aliases, functions, bindkeys, Zle widgets, zstyles, completions, variables,
PATHandFPATHelements 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. -
Supported is the unloading of plugin and ability to list, (un)install and selectively disable, enable plugin's completions.
-
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).
-
The system does not use
$FPATH, loading multiple plugins doesn't clutter$FPATHwith the same number of entries (e.g.10,15or 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 and the Wiki page for an article about the feature.
-
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 annex), post-install and post-update hooks, and much more. See the zdharma-continuum organization for a growing, complete list of available Zinit extensions and refer to the Wiki article for an introduction on creating your annex.
Zinit Wiki<a name="zinit-wiki"></a>
The information in this README is complemented by the 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.
Install<a name="install"></a>
Automatic<a name="automatic"></a>
The easiest way to install Zinit is to execute:
bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)"
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 via:
zinit self-update
Manual<a name="manual"></a>
In your .zshrc, add the following snippet
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
[ ! -d $ZINIT_HOME ] && mkdir -p "$(dirname $ZINIT_HOME)"
[ ! -d $ZINIT_HOME/.git ] && git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
source "${ZINIT_HOME}/zinit.zsh"
If you source zinit.zsh after compinit, add the following snippet after sourcing zinit.zsh:
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
Reload Zsh to install Zinit:
exec zsh
Various paths can be customized; see section Customizing Paths.
Usage<a name="usage"></a>
Introduction<a name="introduction"></a>
Click here to read the introduction to Zinit. 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<a name="plugins-and-snippets"></a>
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 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
# 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, pure, 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
# line 1: `starship` binary as command, from github release
# line 2: starship setup at clone(create init.zsh, completion)
# line 3: pull behavior same as clone, source init.zsh
zinit ice as"command" from"gh-r" \
atclone"./starship init zsh > init.zsh; ./starship completions zsh > _starship" \
atpull"%atclone" src"init.zsh"
zinit light starship/starship
Upgrade Zinit and plugins<a name="upgrade-zinit-and-plugins"></a>
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<a name="turbo-and-lucid"></a>
Turbo and lucid are the most used options.
<det
