This document provides detailed information about the Zsh configuration structure, components, and customization options.
zsh/
βββ .zshrc # Main configuration file
βββ .zshenv # Environment setup (sourced for all shells)
βββ keybindings.zsh # Custom keybindings and vi-mode enhancements
βββ recovery.zsh # Error recovery and validation system
βββ setup.sh # Installation and setup script
βββ alias/ # Modular alias and function files
β βββ core # Basic aliases, modern tool integration
β βββ git # Git aliases and functions
β βββ navigation # Directory navigation helpers
β βββ productivity # System utilities and workflows
β βββ fzf-enhancements # Enhanced FZF functions
β βββ benchmark # Performance testing tools
β βββ help # Built-in help system
βββ scripts/ # Shell scripts (zsh/, shell/)
βββ README.md # Main documentation
βββ CONFIGURATION.md # This file
βββ .gitignore # Version control exclusions
The main configuration file is organized into these sections:
- Startup Timing - Optional performance profiling
- Alias Loading - Sources all files from
alias/directory - Keybindings - Loads custom key mappings
- Recovery System - Error handling and validation
- Zsh Options - Shell behavior settings
- History Configuration - Command history settings
- Completion System - Auto-completion setup
- Plugin Management - Zinit plugin loader
- Tool Integration - Starship, zoxide, lazy-loading
- Environment Variables - FZF, paths, tool settings
Each file in alias/ serves a specific purpose:
- Personal aliases (
so,vim, navigation shortcuts) - Modern tool integration with fallbacks
- Conditional loading based on tool availability
- Comprehensive git aliases (
g*series) - Interactive git functions (
glog,gcheck) - Git workflow shortcuts
- Directory traversal shortcuts (
..,..., etc.) - Enhanced directory functions (
take,ff,edit) - Zoxide integration shortcuts
- System utilities (
sysinfo,port,weather) - File operations (
backup,archive,extract) - Process management (
pgrep,pkill-pattern) - Note-taking system
- Enhanced file/content search (
search,f) - Interactive history search (
h) - Process management (
pkill) - Directory navigation (
j) - Environment browsing (
env-search)
- Performance testing (
zsh-benchmark) - Startup timing (
zsh-time,zsh-profile)
- Built-in documentation (
zsh-help) - Function discovery (
list-functions) - Quick help (
help,tips)
- Plugin Manager: Zinit for fast, parallel loading
- Essential Plugins:
deja- Predictive command suggestionsfzf-tab- Fuzzy completion selectionzsh-autopair- Automatic delimiter pairingzsh-syntax-highlighting- Command highlightingzsh-vi-mode- Enhanced vi mode
- Workflow Plugins:
zsh-alias-finder- Suggest aliases for commandscolored-man-pages-plus- Colorized manual pages
- Annexes: Additional functionality modules
# Plugin loading in .zshrc
zinit light "jeffreytse/zsh-vi-mode"
zinit light "Aloxaf/fzf-tab"
zinit light "hlissner/zsh-autopair"
zinit light "Giammarco-Ferranti/deja"
zinit light "zsh-users/zsh-syntax-highlighting"| Traditional | Modern Alternative | Alias | Fallback |
|---|---|---|---|
ls |
eza |
ls, ll, la, lt |
β |
cat |
bat |
view, less |
β |
grep |
ripgrep |
grep |
β |
find |
fd |
find |
β |
- FZF: Fuzzy finder with custom previews and keybindings
- Starship: Fast, customizable prompt
- Zoxide: Smart directory jumping with frecency
- Atuin: Enhanced shell history
Work that is not needed to render the initial prompt is deferred:
carapace- Advanced completionluarocks- Lua environment initialization- Nonessential Zinit plugins, including syntax highlighting
Configuration files are compiled with zcompile for faster loading.
- Daily cache refresh for completion system
- Smart completion initialization
Built-in tools to measure and monitor performance:
zsh-benchmark # Comprehensive analysis
zsh-time # Quick timing
zsh-profile # Detailed profilingCreate new files in alias/ directory:
# alias/custom
alias myalias="my command"
my_function() {
echo "Custom function"
}- Global: Add to
.zshenv - Interactive: Add to
.zshrc - Tool-specific: Add to relevant alias file
Modify keybindings.zsh or add to custom alias files.
# Add new plugin
zinit light "user/plugin-name"
# Update all plugins
zinit update
# Remove plugin
zinit delete "user/plugin-name"config-health # Check configuration status
validate_config # Test syntaxbackup_config # Create timestamped backup
restore_config # Restore from backup
cleanup_backups # Remove old backupsemergency_recovery # Reset to minimal working config
safe_reload # Validate before reloading- Startup time tracking with
zprof - Plugin load time analysis
- Function execution profiling
- Syntax checking before reload
- Dependency verification
- Health status reporting
- Graceful fallbacks for missing tools
- Error recovery mechanisms
- Safe configuration loading
- Careful PATH modifications
- No automatic execution of local files
- Secure tool installation checks
- Input validation in custom functions
- Safe parameter handling
- Error condition management
- One responsibility per file
- Clear function naming
- Comprehensive error handling
- Fallback mechanisms
- Inline help for all functions
- Usage examples
- Clear parameter descriptions
- Configuration syntax validation
- Function testing
- Performance regression checks
For implementation details, see individual files. For usage help, run zsh-help.