Skip to content

Pure - Minimal Zsh Prompt

Pure is a pretty, minimal, and fast Zsh prompt that focuses on simplicity and performance. Created by Sindre Sorhus, Pure emphasizes clean aesthetics, asynchronous Git information fetching, and intelligent display of only relevant information. It represents the minimalist philosophy in prompt design while maintaining essential functionality for modern development workflows.

Installation

Prerequisites

bash
# Ensure Zsh is installed and set as default shell
zsh --version
echo $SHELL

# Set Zsh as default shell if needed
chsh -s $(which zsh)

# Verify Zsh configuration
echo $ZSH_VERSION

Installation Methods

bash
# Install via npm
npm install --global pure-prompt

# Verify installation
which pure

# Check version
pure --version

Manual Installation

bash
# Clone repository
mkdir -p "$HOME/.zsh"
git clone https://github.com/sindresorhus/pure.git "$HOME/.zsh/pure"

# Add to .zshrc
echo 'fpath+=$HOME/.zsh/pure' >> ~/.zshrc
echo 'autoload -U promptinit; promptinit' >> ~/.zshrc
echo 'prompt pure' >> ~/.zshrc

# Reload configuration
source ~/.zshrc

Package Manager Installation

bash
# Homebrew (macOS)
brew install pure

# Add to .zshrc
echo 'fpath+=/usr/local/share/zsh/site-functions' >> ~/.zshrc
echo 'autoload -U promptinit; promptinit' >> ~/.zshrc
echo 'prompt pure' >> ~/.zshrc

# Arch Linux
yay -S zsh-pure-prompt

# Gentoo
emerge app-shells/pure

# FreeBSD
pkg install zsh-pure

Oh My Zsh Integration

bash
# Clone to Oh My Zsh custom themes
git clone https://github.com/sindresorhus/pure.git "$ZSH_CUSTOM/themes/pure"

# Symlink pure.zsh-theme
ln -s "$ZSH_CUSTOM/themes/pure/pure.zsh-theme" "$ZSH_CUSTOM/themes/pure.zsh-theme"

# Set theme in .zshrc
ZSH_THEME=""  # Disable Oh My Zsh themes
echo 'fpath+=$ZSH_CUSTOM/themes/pure' >> ~/.zshrc
echo 'autoload -U promptinit; promptinit' >> ~/.zshrc
echo 'prompt pure' >> ~/.zshrc

Zinit Plugin Manager

bash
# Add to .zshrc
zinit ice compile'(pure|async).zsh' pick'async.zsh' src'pure.zsh'
zinit light sindresorhus/pure

# Alternative with Oh My Zsh compatibility
zinit ice pick'async.zsh' src'pure.zsh'
zinit light sindresorhus/pure

Antibody Plugin Manager

bash
# Add to .zshrc
antibody bundle mafredri/zsh-async
antibody bundle sindresorhus/pure

# Or use antibody bundle file
echo 'mafredri/zsh-async' >> ~/.zsh_plugins.txt
echo 'sindresorhus/pure' >> ~/.zsh_plugins.txt
antibody bundle < ~/.zsh_plugins.txt > ~/.zsh_plugins.sh
source ~/.zsh_plugins.sh

Configuration

Basic Setup

bash
# Add to .zshrc after Pure installation
autoload -U promptinit; promptinit
prompt pure

# Reload configuration
source ~/.zshrc

Color Customization

bash
# Customize colors in .zshrc
# Available colors: black, red, green, yellow, blue, magenta, cyan, white
# Or use color codes: 0-255

# Prompt symbol color
zstyle ':prompt:pure:prompt:success' color green
zstyle ':prompt:pure:prompt:error' color red

# Path color
zstyle ':prompt:pure:path' color blue

# Git branch color
zstyle ':prompt:pure:git:branch' color cyan

# Git dirty state color
zstyle ':prompt:pure:git:dirty' color yellow

# Git stash color
zstyle ':prompt:pure:git:stash' color magenta

# Command execution time color
zstyle ':prompt:pure:execution_time' color yellow

# User and host color (when shown)
zstyle ':prompt:pure:user' color magenta
zstyle ':prompt:pure:host' color cyan

# Virtualenv color
zstyle ':prompt:pure:virtualenv' color yellow

Symbol Customization

bash
# Customize symbols in .zshrc
# Prompt symbols
zstyle ':prompt:pure:prompt:success' symbol '❯'
zstyle ':prompt:pure:prompt:error' symbol '❯'
zstyle ':prompt:pure:prompt:continuation' symbol '…'

# Git symbols
zstyle ':prompt:pure:git:up_arrow' symbol '⇡'
zstyle ':prompt:pure:git:down_arrow' symbol '⇣'
zstyle ':prompt:pure:git:dirty' symbol '*'
zstyle ':prompt:pure:git:stash' symbol '≡'

# Alternative symbols
zstyle ':prompt:pure:prompt:success' symbol '→'
zstyle ':prompt:pure:prompt:error' symbol '✗'
zstyle ':prompt:pure:git:dirty' symbol '!'
zstyle ':prompt:pure:git:stash' symbol '$'

Display Options

bash
# Show/hide username and hostname
zstyle ':prompt:pure:user' show true
zstyle ':prompt:pure:host' show true

# Show username only when different from default
zstyle ':prompt:pure:user' show auto

# Show hostname only over SSH
zstyle ':prompt:pure:host' show auto

# Always show username and hostname
zstyle ':prompt:pure:user' show always
zstyle ':prompt:pure:host' show always

# Never show username and hostname
zstyle ':prompt:pure:user' show false
zstyle ':prompt:pure:host' show false

Git Configuration

bash
# Git status display options
# Show Git stash count
zstyle ':prompt:pure:git:stash' show true

# Hide Git stash count
zstyle ':prompt:pure:git:stash' show false

# Show dirty state immediately (no async)
zstyle ':prompt:pure:git:dirty' check true

# Disable dirty state checking for performance
zstyle ':prompt:pure:git:dirty' check false

# Set Git status fetch timeout (seconds)
zstyle ':prompt:pure:git:fetch' timeout 5

Execution Time Display

bash
# Show command execution time threshold (seconds)
zstyle ':prompt:pure:execution_time' threshold 2

# Disable execution time display
zstyle ':prompt:pure:execution_time' show false

# Always show execution time
zstyle ':prompt:pure:execution_time' show true

# Custom execution time format
zstyle ':prompt:pure:execution_time' format '%d:%02d:%02d'

Path Display

bash
# Maximum path segments to show
zstyle ':prompt:pure:path' max_dirs 2

# Show full path
zstyle ':prompt:pure:path' max_dirs 0

# Path truncation symbol
zstyle ':prompt:pure:path' truncation '…'

# Disable path truncation
zstyle ':prompt:pure:path' truncation ''

Advanced Configuration

Conditional Display

bash
# Show user@host only in specific conditions
# SSH connections
if [[ -n $SSH_CONNECTION ]]; then
    zstyle ':prompt:pure:user' show true
    zstyle ':prompt:pure:host' show true
else
    zstyle ':prompt:pure:user' show false
    zstyle ':prompt:pure:host' show false
fi

# Root user detection
if [[ $UID -eq 0 ]]; then
    zstyle ':prompt:pure:user' show true
    zstyle ':prompt:pure:prompt:success' color red
fi

# Different environments
case $HOST in
    production-*)
        zstyle ':prompt:pure:host' show true
        zstyle ':prompt:pure:host' color red
        ;;
    staging-*)
        zstyle ':prompt:pure:host' show true
        zstyle ':prompt:pure:host' color yellow
        ;;
    development-*)
        zstyle ':prompt:pure:host' show true
        zstyle ':prompt:pure:host' color green
        ;;
esac

Custom Hooks

bash
# Pre-command hook
pure_preexec() {
    # Custom logic before command execution
    echo "Executing: $1"
}

# Post-command hook
pure_precmd() {
    # Custom logic after command execution
    # This runs before prompt is displayed
}

# Add hooks to precmd and preexec arrays
precmd_functions+=(pure_precmd)
preexec_functions+=(pure_preexec)

Integration with Other Tools

bash
# Virtualenv integration
# Pure automatically detects and displays Python virtual environments
# Customize virtualenv display
zstyle ':prompt:pure:virtualenv' color cyan
zstyle ':prompt:pure:virtualenv' format '[%s]'

# Node.js version display (custom)
pure_node_version() {
    if [[ -f package.json ]]; then
        local node_version=$(node --version 2>/dev/null)
        if [[ -n $node_version ]]; then
            echo " node:$node_version"
        fi
    fi
}

# Add to prompt
RPROMPT='$(pure_node_version)'

Performance Optimization

bash
# Disable expensive Git operations
zstyle ':prompt:pure:git:fetch' timeout 1
zstyle ':prompt:pure:git:dirty' check false

# Reduce Git status checking frequency
zstyle ':prompt:pure:git:fetch' interval 60

# Disable async Git status for very large repositories
zstyle ':prompt:pure:git:async' enable false

Customization Examples

Minimal Configuration

bash
# Ultra-minimal Pure setup
autoload -U promptinit; promptinit
prompt pure

# Hide everything except path and prompt
zstyle ':prompt:pure:user' show false
zstyle ':prompt:pure:host' show false
zstyle ':prompt:pure:git:stash' show false
zstyle ':prompt:pure:execution_time' show false

# Simple symbols
zstyle ':prompt:pure:prompt:success' symbol '>'
zstyle ':prompt:pure:prompt:error' symbol '>'
zstyle ':prompt:pure:git:dirty' symbol '*'

Developer-Focused Configuration

bash
# Developer-optimized Pure setup
autoload -U promptinit; promptinit
prompt pure

# Show execution time for performance monitoring
zstyle ':prompt:pure:execution_time' threshold 1
zstyle ':prompt:pure:execution_time' color yellow

# Enhanced Git information
zstyle ':prompt:pure:git:stash' show true
zstyle ':prompt:pure:git:dirty' check true
zstyle ':prompt:pure:git:branch' color cyan
zstyle ':prompt:pure:git:dirty' color red

# Show user@host for context
zstyle ':prompt:pure:user' show auto
zstyle ':prompt:pure:host' show auto

# Custom symbols for better visibility
zstyle ':prompt:pure:prompt:success' symbol '❯'
zstyle ':prompt:pure:prompt:error' symbol '❯'
zstyle ':prompt:pure:git:up_arrow' symbol '↑'
zstyle ':prompt:pure:git:down_arrow' symbol '↓'

Production Environment Configuration

bash
# Production-safe Pure configuration
autoload -U promptinit; promptinit
prompt pure

# Always show user@host for security awareness
zstyle ':prompt:pure:user' show true
zstyle ':prompt:pure:host' show true
zstyle ':prompt:pure:user' color red
zstyle ':prompt:pure:host' color red

# Prominent error indication
zstyle ':prompt:pure:prompt:error' color red
zstyle ':prompt:pure:prompt:error' symbol '✗'

# Show execution time for audit trails
zstyle ':prompt:pure:execution_time' threshold 0
zstyle ':prompt:pure:execution_time' color yellow

# Conservative Git settings
zstyle ':prompt:pure:git:fetch' timeout 10
zstyle ':prompt:pure:git:dirty' check true

Multi-line Configuration

bash
# Multi-line Pure prompt
autoload -U promptinit; promptinit
prompt pure

# Custom prompt function for multi-line
pure_setup_multiline() {
    # First line: path and git info
    PROMPT='%F{blue}%~%f$(pure_git_info)
%F{magenta}❯%f '
    
    # Right prompt: execution time and virtualenv
    RPROMPT='$(pure_execution_time)$(pure_virtualenv)'
}

# Override Pure's prompt setup
pure_setup_multiline

Integration with Development Tools

Git Integration

bash
# Enhanced Git status display
zstyle ':prompt:pure:git:stash' show true
zstyle ':prompt:pure:git:dirty' check true

# Git aliases that work well with Pure
alias gs='git status --short'
alias gd='git diff'
alias gl='git log --oneline -10'
alias gb='git branch -v'

# Git hooks for Pure optimization
# .git/hooks/post-checkout
#!/bin/sh
# Trigger Pure Git status refresh
kill -USR1 $$

Docker Integration

bash
# Docker context display (custom addition)
pure_docker_context() {
    if command -v docker >/dev/null 2>&1; then
        local context=$(docker context show 2>/dev/null)
        if [[ $context != "default" ]]; then
            echo " docker:$context"
        fi
    fi
}

# Add to right prompt
RPROMPT='$(pure_docker_context)$RPROMPT'

Kubernetes Integration

bash
# Kubernetes context display (custom addition)
pure_k8s_context() {
    if command -v kubectl >/dev/null 2>&1; then
        local context=$(kubectl config current-context 2>/dev/null)
        local namespace=$(kubectl config view --minify --output 'jsonpath={..namespace}' 2>/dev/null)
        if [[ -n $context ]]; then
            echo " k8s:$context${namespace:+/$namespace}"
        fi
    fi
}

# Add to right prompt
RPROMPT='$(pure_k8s_context)$RPROMPT'

Python Virtual Environment

bash
# Pure automatically detects virtual environments
# Customize virtualenv display
zstyle ':prompt:pure:virtualenv' color green
zstyle ':prompt:pure:virtualenv' format '(%s) '

# Conda environment support (custom)
pure_conda_env() {
    if [[ -n $CONDA_DEFAULT_ENV ]]; then
        echo "($CONDA_DEFAULT_ENV) "
    fi
}

# Override virtualenv display to include Conda
PROMPT='$(pure_conda_env)$PROMPT'

Troubleshooting

Common Issues

bash
# Pure not loading
# Check if promptinit is loaded
autoload -U promptinit; promptinit

# Verify Pure is available
prompt -l | grep pure

# Force reload Pure
prompt pure

# Check for conflicts with other prompt themes
# Disable Oh My Zsh themes
ZSH_THEME=""

# Clear existing prompt settings
unset PROMPT RPROMPT PS1 PS2

Performance Issues

bash
# Disable expensive Git operations
zstyle ':prompt:pure:git:fetch' timeout 1
zstyle ':prompt:pure:git:dirty' check false

# Check for slow Git repositories
time git status

# Optimize Git configuration
git config --global core.preloadindex true
git config --global core.fscache true
git config --global gc.auto 256

# Profile Zsh startup
time zsh -i -c exit

Async Issues

bash
# Check if async library is loaded
which async_init

# Reinstall async dependency
npm install --global pure-prompt

# Manual async installation
git clone https://github.com/mafredri/zsh-async.git ~/.zsh/async
echo 'source ~/.zsh/async/async.zsh' >> ~/.zshrc

Color Issues

bash
# Check terminal color support
echo $TERM
tput colors

# Test color output
for i in {0..255}; do print -Pn "%F{$i}▇%f"; done; echo

# Reset color settings
zstyle -d ':prompt:pure:*' color

# Use basic colors for compatibility
zstyle ':prompt:pure:prompt:success' color green
zstyle ':prompt:pure:prompt:error' color red
zstyle ':prompt:pure:path' color blue

Best Practices

Configuration Management

bash
# Keep Pure configuration in separate file
# ~/.config/pure/config.zsh
autoload -U promptinit; promptinit
prompt pure

# Color configuration
zstyle ':prompt:pure:prompt:success' color green
zstyle ':prompt:pure:prompt:error' color red
zstyle ':prompt:pure:path' color blue
zstyle ':prompt:pure:git:branch' color cyan

# Source from .zshrc
source ~/.config/pure/config.zsh

# Version control Pure configuration
git add ~/.config/pure/config.zsh
git commit -m "Add Pure prompt configuration"

Environment-Specific Settings

bash
# Different settings for different environments
case $HOST in
    work-*)
        zstyle ':prompt:pure:user' show true
        zstyle ':prompt:pure:host' show true
        zstyle ':prompt:pure:execution_time' threshold 1
        ;;
    personal-*)
        zstyle ':prompt:pure:user' show false
        zstyle ':prompt:pure:host' show false
        zstyle ':prompt:pure:execution_time' threshold 5
        ;;
esac

# SSH-specific configuration
if [[ -n $SSH_CONNECTION ]]; then
    zstyle ':prompt:pure:user' show true
    zstyle ':prompt:pure:host' show true
    zstyle ':prompt:pure:host' color yellow
fi

Performance Guidelines

bash
# Optimize for large repositories
if [[ $(git rev-list --count HEAD 2>/dev/null || echo 0) -gt 10000 ]]; then
    zstyle ':prompt:pure:git:dirty' check false
    zstyle ':prompt:pure:git:fetch' timeout 1
fi

# Conditional Git status checking
zstyle ':prompt:pure:git:dirty' check true
zstyle ':prompt:pure:git:fetch' timeout 3

# Minimal configuration for slow systems
zstyle ':prompt:pure:execution_time' show false
zstyle ':prompt:pure:git:stash' show false

Security Considerations

bash
# Hide sensitive information in screenshots/recordings
zstyle ':prompt:pure:user' show false
zstyle ':prompt:pure:host' show false

# Show context in production environments
if [[ $HOST =~ "prod" ]]; then
    zstyle ':prompt:pure:user' show true
    zstyle ':prompt:pure:host' show true
    zstyle ':prompt:pure:host' color red
fi

# Avoid displaying sensitive paths
zstyle ':prompt:pure:path' max_dirs 2

Pure represents the essence of minimalist prompt design, providing essential information without visual clutter. Its asynchronous Git status fetching, intelligent display logic, and extensive customization options make it an excellent choice for developers who value clean aesthetics and optimal performance. Whether you prefer the default minimal appearance or customize it extensively, Pure maintains its core philosophy of showing only what matters while staying fast and responsive.