Terminal GuideTerminal Guide
zinit icon

zinit

Shell Enhancements
macOSLinux
Shell

Flexible and fast Zsh plugin manager.

Official Website

Features

Turbo ModeIce ModifiersAnnexesFast Startup

Why use Zinit?

Blazingly Fast

Turbo Mode allows lazy-loading plugins to dramatically reduce startup time without sacrificing functionality.

Powerful Control

Ice modifiers give you granular control over plugin behavior, sourcing, and dependencies.

Highly Customizable

Annexes extend functionality with additional features like completions, utility plugins, and more.

Flexible Loading

Load plugins conditionally, track their history, and manage snippets alongside regular plugins.

Installation

Install Zinit using the official installation script. This will download Zinit to ~/.local/share/zinit/zinit.git.

Installation command
# Clone Zinit repository
bash -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/master/scripts/install.sh)"

After installation, add the following to your ~/.zshrc (usually at the beginning):

~/.zshrc
ZINIT_HOME="${ZINIT_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"
. "$ZINIT_HOME/zinit.zsh"

Basic Usage

After installing Zinit, you can start adding plugins to your ~/.zshrc. Here are some basic examples:

Loading Plugins

~/.zshrc
# Load a plugin from GitHub
zinit light zdharma-continuum/fast-syntax-highlighting

# Load Oh My Zsh plugins
zinit snippet OMZP::git
zinit snippet OMZP::aws

# Load a plugin with turbo mode (lazy load on first use)
zinit turbo -c 'bindkey "^R" history-incremental-search-backward' light zsh-users/zsh-autosuggestions

Common Plugins

~/.zshrc
# Syntax highlighting
zinit light zdharma-continuum/fast-syntax-highlighting

# Autosuggestions
zinit light zsh-users/zsh-autosuggestions

# Completions
zinit light zsh-users/zsh-completions

# History search
zinit light zsh-users/zsh-history-substring-search

Configuration

Zinit's true power lies in its ice modifiers that control how plugins are loaded and configured.

Ice Modifiers

Ice modifiers are arguments that control plugin behavior. Here are the most commonly used:

~/.zshrc
# Turbo mode - lazy load plugin
zinit turbo -c 'echo Loading plugin' light plugin-name

# Load from a specific branch
zinit light-mode for pick'zsh-history-substring-search.plugin.zsh'     zsh-users/zsh-history-substring-search

# Compile plugin for faster loading
zinit ice make'!' atload'setopt HIST_FIND_NO_DUPS'
zinit light zdharma-continuum/fast-syntax-highlighting

# Load plugin only in interactive shells
zinit ice if'[[ -t 0 ]]'
zinit light some-plugin

# Require dependencies
zinit ice requires'zsh:5.1'
zinit light some-plugin

Realistic Configuration

~/.zshrc example
# Initialize Zinit
ZINIT_HOME="${ZINIT_HOME:-${HOME}/.local/share/zinit/zinit.git}"
. "$ZINIT_HOME/zinit.zsh"

# Initialize annexes
zinit-annexes

# Plugins with turbo mode for faster startup
zinit turbo -c 'export _ZO_ECHO=0' -c 'eval "$(zoxide init zsh)"' light ajeetdsouza/zoxide

# Syntax highlighting (must be before zsh-autosuggestions)
zinit turbo -c 'setopt extendedglob' light     zdharma-continuum/fast-syntax-highlighting

# Auto-suggestions
zinit turbo -c 'bindkey "^n" autosuggest-accept' light     zsh-users/zsh-autosuggestions

# Completions
zinit turbo -c 'zinit cdreplay -q' as'completion' light     zsh-users/zsh-completions

# History substring search
zinit turbo -c 'bindkey "^P" history-substring-search-up' light     zsh-users/zsh-history-substring-search

# Git plugin from Oh My Zsh
zinit turbo -c 'zinit cdreplay -q' snippet OMZP::git

# Fancy prompt
zinit ice pick'async.plugin.zsh' src'pure.plugin.zsh'
zinit light sindresorhus/pure

Tips & Tricks

Understanding Turbo Mode

Turbo mode delays plugin loading until the shell is fully interactive. Use -c for commands to run before loading.

Turbo mode examples
# -c runs commands before loading
# Useful for setting environment variables or running scripts
zinit turbo -c 'alias ll="ls -la"' light plugin-name

# Load on first key press
zinit turbo -c '' light plugin-name

Measure Startup Time

Check how fast your shell starts with these commands:

Performance testing
# Simple timing
time zsh -i -c exit

# More detailed timing
hyperfine "zsh -i -c exit"

# Debug plugin loading
zsh -x 2>&1 | head -20

Management Commands

Useful commands for managing plugins:

Management commands
# List all loaded plugins
zinit plugins

# Update all plugins
zinit update

# Update specific plugin
zinit update plugin-name

# Unload a plugin
zinit unload plugin-name

# Remove a plugin
zinit delete plugin-name

# Clean up
zinit delete --all

# Show plugin info
zinit info plugin-name

Using Snippets

Snippets are lightweight script files, useful for loading individual files without dependencies.

Snippet examples
# Load Oh My Zsh snippet
zinit snippet OMZP::git

# Load snippet from GitHub
zinit snippet https://github.com/user/repo/path/to/file.zsh

# Load local snippet
zinit snippet /path/to/local/file.zsh

Performance Tips

Use turbo mode aggressively for non-critical plugins. Prioritize syntax highlighting and autosuggestions to load first for better interactivity. Consider using annexes like binary-assemble to download pre-compiled binaries. Group related plugins together using ice modifiers for cleaner config.

Written by Dai AokiPublished: 2026-01-20

Related Articles

Explore More