Zsh Plugin Management
Plugin Managers
zinit (recommended — fast, feature-rich)
# Install zinit
bash -c "$(curl --fail --show-error --silent --location \
https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)"
# Basic plugin loading
zinit light zsh-users/zsh-autosuggestions
zinit light zsh-users/zsh-syntax-highlighting
zinit light zsh-users/zsh-completions
# Turbo mode (deferred loading for fast startup)
zinit ice wait lucid
zinit light zsh-users/zsh-autosuggestions
zinit ice wait lucid atload"zicompinit; zicdreplay"
zinit light zsh-users/zsh-syntax-highlighting
# Snippets (load from URL or oh-my-zsh)
zinit snippet OMZL::git.zsh
zinit snippet OMZP::git
zinit snippet OMZP::sudo # double-ESC to prepend sudo
# Binary programs
zinit ice from"gh-r" as"program"
zinit load junegunn/fzf
antidote (static, fast)
# Install
git clone --depth=1 https://github.com/mattmc3/antidote.git \
${ZDOTDIR:-$HOME}/.antidote
# Plugin list: ~/.zsh_plugins.txt
# zsh-users/zsh-autosuggestions
# zsh-users/zsh-syntax-highlighting
# zsh-users/zsh-completions
# Load in .zshrc
source ${ZDOTDIR:-$HOME}/.antidote/antidote.zsh
antidote load
Essential Plugins
Must-have plugins
# zsh-autosuggestions — fish-like suggestions from history
# Shows gray suggestion as you type
# Right-arrow or Ctrl-f to accept
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#585b70"
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
# zsh-syntax-highlighting — colors commands as you type
# Green = valid command, red = not found
# Underline = valid path
# zsh-completions — additional completion definitions
# ~900 additional completions for common tools
# zsh-history-substring-search — type + arrow key to search
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
Oh-My-Zsh
Framework approach
# Install
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Configuration in .zshrc
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="robbyrussell"
plugins=(
git # git aliases (gst, gco, gp)
sudo # double-ESC to prepend sudo
docker # docker completions
kubectl # kubectl completions
fzf # fzf integration
z # frequency-based directory jump
colored-man-pages # colorize man pages
)
source $ZSH/oh-my-zsh.sh
# Useful git aliases from oh-my-zsh git plugin:
# gst = git status
# gco = git checkout
# gp = git push
# gl = git pull
# glog = git log --oneline --decorate --graph
# gd = git diff
# ga = git add
# gcmsg = git commit -m
Manual Plugin Management
No framework needed
# Clone to ~/.zsh/plugins/
git clone https://github.com/zsh-users/zsh-autosuggestions \
~/.zsh/plugins/zsh-autosuggestions
# Source in .zshrc
source ~/.zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
source ~/.zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Update all
for plugin in ~/.zsh/plugins/*/; do
git -C "$plugin" pull --quiet
done
fzf Integration
fzf as shell enhancer
# Install fzf
# pacman -S fzf (Arch)
# Enable in .zshrc
source <(fzf --zsh) # fzf 0.48+
# or
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# Key bindings provided:
# Ctrl-r fuzzy history search
# Ctrl-t fuzzy file finder (insert into command)
# Alt-c fuzzy cd into directory
# Custom defaults
export FZF_DEFAULT_OPTS="
--height=40%
--layout=reverse
--border=rounded
--color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc
--color=hl:#f38ba8,fg:#cdd6f4,header:#f38ba8
--color=info:#cba6f7,pointer:#f5e0dc,marker:#f5e0dc
"