### Manual Installation of ez-compinit Source: https://github.com/mattmc3/ez-compinit/blob/main/README.md Install the plugin manually by cloning the repository and sourcing the plugin file. Ensure ZPLUGIN_HOME is set or use the default path. ```zsh [[ -n "$ZPLUGIN_HOME" ]] || ZPLUGIN_HOME=${ZDOTDIR:-$HOME}/.zsh_plugins if [[ ! -d $ZPLUGIN_HOME/ez-compinit ]] then git clone https://github.com/mattmc3/ez-compinit $ZPLUGIN_HOME fi source $ZPLUGIN_HOME/ez-compinit/ez-compinit.plugin.zsh ``` -------------------------------- ### Install ez-compinit with Antidote Source: https://github.com/mattmc3/ez-compinit/blob/main/README.md Add this line to the top of your antidote's plugin list file to install the plugin. ```zsh mattmc3/ez-compinit ``` -------------------------------- ### Enable Completion Caching with zstyle Source: https://context7.com/mattmc3/ez-compinit/llms.txt Enable the 20-hour cache for `zcompdump` regeneration by setting `zstyle ':plugin:ez-compinit' 'use-cache' 'yes'`. This opt-in feature prevents regeneration on every shell start. Clear a stale cache with `run-compinit --force`. ```zsh # ~/.zshrc source /path/to/ez-compinit/ez-compinit.plugin.zsh # Enable 20-hour caching of the zcompdump file. # compinit -C (skip function check) is used when the cache is fresh. # compinit -i (skip insecure check) is used when the cache expires. zstyle ':plugin:ez-compinit' 'use-cache' 'yes' # To clear a stale cache at any time: run-compinit --force ``` -------------------------------- ### Create a Custom Completion Style Source: https://context7.com/mattmc3/ez-compinit/llms.txt Create a custom completion style by defining a compstyle__setup function and placing it on fpath. This allows for custom completion UX that can be independently upgraded. ```zsh # Create ~/.config/zsh/functions/compstyle_myteam_setup cat > ~/.config/zsh/functions/compstyle_myteam_setup <<'EOF' #!/bin/zsh function compstyle_myteam_help { echo "Custom completion style for my team." echo "Usage: compstyle myteam" } function compstyle_myteam_setup { setopt always_to_end complete_in_word auto_menu zstyle ':completion:*:*:*:*:*' menu select zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*' zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} zstyle ':completion:*:descriptions' format ' %F{cyan}-- %d --%f' zstyle ':completion:*:warnings' format ' %F{red}-- no matches found --%f' } compstyle_myteam_setup "$@" EOF # Add the directory to fpath before loading ez-compinit: fpath=(~/.config/zsh/functions $fpath) zstyle ':plugin:ez-compinit' 'compstyle' 'myteam' source /path/to/ez-compinit/ez-compinit.plugin.zsh # Verify it is discoverable: compstyle -l ``` -------------------------------- ### Apply ohmy Style Source: https://context7.com/mattmc3/ez-compinit/llms.txt Configure ez-compinit to use the 'ohmy' completion style and load the plugin. ```zsh zstyle ':plugin:ez-compinit' 'compstyle' 'ohmy' source /path/to/ez-compinit/ez-compinit.plugin.zsh ``` -------------------------------- ### Apply gremlin Style Source: https://context7.com/mattmc3/ez-compinit/llms.txt Configure ez-compinit to use the 'gremlin' completion style and load the plugin. ```zsh zstyle ':plugin:ez-compinit' 'compstyle' 'gremlin' source /path/to/ez-compinit/ez-compinit.plugin.zsh ``` -------------------------------- ### Apply prez Style Source: https://context7.com/mattmc3/ez-compinit/llms.txt Configure ez-compinit to use the 'prez' completion style and load the plugin. ```zsh zstyle ':plugin:ez-compinit' 'compstyle' 'prez' source /path/to/ez-compinit/ez-compinit.plugin.zsh ``` -------------------------------- ### Initialize Compstyle Standalone Source: https://context7.com/mattmc3/ez-compinit/llms.txt Initialize the completion style system standalone by adding the plugin's functions to fpath and autoloading compstyleinit. ```zsh fpath=(/path/to/ez-compinit/functions $fpath) autoload -Uz compstyleinit compstyleinit ``` -------------------------------- ### Print Populated Completion Styles Source: https://context7.com/mattmc3/ez-compinit/llms.txt After running compstyleinit, print the $completion_styles array to see the registered styles. ```zsh print $completion_styles ``` -------------------------------- ### Manually Run compinit with run-compinit Source: https://context7.com/mattmc3/ez-compinit/llms.txt The `run-compinit` function initializes the completion system. It can be called manually to force a cache reset or regeneration. Ensure `ZSH_COMPDUMP` is set before sourcing the plugin if you need to override the default dump file location. ```zsh # Run compinit manually (e.g., after adding new completions to fpath) run-compinit # Force a full cache reset (deletes the existing zcompdump and regenerates it) run-compinit --force # Equivalent short form: run-compinit -f # Override the dump file location before loading the plugin ZSH_COMPDUMP="$HOME/.zcompdump" source /path/to/ez-compinit/ez-compinit.plugin.zsh # run-compinit will now write to ~/.zcompdump instead of the XDG default # Default dump file location (used when ZSH_COMPDUMP is not set): # ${XDG_CACHE_HOME:-$HOME/.cache}/zsh/zcompdump ``` -------------------------------- ### Configure prez Colored Format Strings Source: https://context7.com/mattmc3/ez-compinit/llms.txt Set up colored format strings for corrections, descriptions, and warnings in the 'prez' style. ```zsh zstyle ':completion:*:corrections' format ' %F{green}-- %d (errors: %e) --%f' zstyle ':completion:*:descriptions' format ' %F{yellow}-- %d --%f' zstyle ':completion:*:warnings' format ' %F{red}-- no matches found --%f' ``` -------------------------------- ### Show Style Help Source: https://context7.com/mattmc3/ez-compinit/llms.txt Display help information for a specific completion style using the -h flag. ```zsh compstyle -h prez ``` -------------------------------- ### Apply zshzoo Style Source: https://context7.com/mattmc3/ez-compinit/llms.txt Configure ez-compinit to use the 'zshzoo' completion style and load the plugin. ```zsh zstyle ':plugin:ez-compinit' 'compstyle' 'zshzoo' source /path/to/ez-compinit/ez-compinit.plugin.zsh ``` -------------------------------- ### Load bashcompinit for ohmy Source: https://context7.com/mattmc3/ez-compinit/llms.txt The 'ohmy' style includes loading bashcompinit for bash completion compatibility. ```zsh # autoload -U +X bashcompinit && bashcompinit ``` -------------------------------- ### Defer compstyleinit via precmd Hook Source: https://context7.com/mattmc3/ez-compinit/llms.txt Defer compstyleinit to run via precmd instead of immediately at plugin load. This is useful when completion styles depend on environment state set up later in .zshrc. ```zsh zstyle ':plugin:ez-compinit:compstyleinit' defer 'yes' zstyle ':plugin:ez-compinit' 'compstyle' 'zshzoo' source /path/to/ez-compinit/ez-compinit.plugin.zsh ``` -------------------------------- ### List Available Styles Source: https://context7.com/mattmc3/ez-compinit/llms.txt Use the -l flag with compstyle to list all currently available completion styles. ```zsh compstyle -l ``` -------------------------------- ### Apply Completion Style with compstyle Source: https://context7.com/mattmc3/ez-compinit/llms.txt Set the desired completion style by configuring `zstyle ':plugin:ez-compinit' 'compstyle' ''` before loading the plugin. Available built-in styles include `gremlin`, `ohmy`, `prez`, and `zshzoo`. ```zsh # Set the desired style via zstyle before loading ez-compinit: zstyle ':plugin:ez-compinit' 'compstyle' 'zshzoo' source /path/to/ez-compinit/ez-compinit.plugin.zsh ``` -------------------------------- ### Enable prez Completion Caching Source: https://context7.com/mattmc3/ez-compinit/llms.txt Enable completion caching and specify the cache path for the 'prez' style. ```zsh zstyle ':completion::complete:*' use-cache on zstyle ':completion::complete:*' cache-path "${XDG_CACHE_HOME:-$HOME/.cache}/zsh/zcompcache" ``` -------------------------------- ### Load ez-compinit Plugin in .zshrc Source: https://context7.com/mattmc3/ez-compinit/llms.txt Load ez-compinit near the top of your .zshrc file before other plugins. This ensures that compdef calls are queued and compinit is run at the end of shell startup. ```zsh # .zshrc — load ez-compinit first, before other plugins # Option A: with antidote plugin manager (add to ~/.zsh_plugins.txt) # mattmc3/ez-compinit # Option B: manual load ZPLUGIN_HOME=${ZDOTDIR:-$HOME}/.zsh_plugins if [[ ! -d $ZPLUGIN_HOME/ez-compinit ]]; then git clone https://github.com/mattmc3/ez-compinit $ZPLUGIN_HOME/ez-compinit fi source $ZPLUGIN_HOME/ez-compinit/ez-compinit.plugin.zsh # Other plugins can now safely call compdef — calls are queued automatically. # compinit will run automatically via precmd hook at the end of .zshrc. ``` -------------------------------- ### Manual compinit Call in .zshrc Source: https://github.com/mattmc3/ez-compinit/blob/main/README.md Load ez-compinit at the top of your .zshrc and manually call compinit at the bottom to retain benefits while using custom compinit configurations. This ensures compdef calls are queued correctly. ```zsh # .zshrc # Load ez-compinit towards the top of your config # Load it yourself, or with a plugin manager. source /path/to/ez-compinit/ez-compinit.plugin.zsh # # .zshrc contents here... # autoload -Uz compinit compinit -u -d /path/to/zcompdump # end of .zshrc ``` -------------------------------- ### Set Completion Style with zstyle Source: https://github.com/mattmc3/ez-compinit/blob/main/README.md Configure the completion style for ez-compinit. Available styles include 'gremlin', 'ohmy', 'prez', and 'zshzoo'. Use 'compstyle -l' to list all available styles. ```zsh # Available completion styles: gremlin, ohmy, prez, zshzoo # You can add your own too. To see all available completion styles # run 'compstyle -l' zstyle ':plugin:ez-compinit' 'compstyle' 'zshzoo' ``` -------------------------------- ### Apply compstyle Directly Source: https://context7.com/mattmc3/ez-compinit/llms.txt Call compstyle directly after compstyleinit has run to apply a specific completion style. ```zsh compstyle zshzoo compstyle ohmy compstyle prez compstyle gremlin ``` -------------------------------- ### Enable ohmy Waiting Dots Source: https://context7.com/mattmc3/ez-compinit/llms.txt Configure the 'ohmy' style to display waiting dots ('...') during slow completions, optionally with custom color sequences. ```zsh # shows red ellipsis COMPLETION_WAITING_DOTS=true # or use a custom prompt sequence: COMPLETION_WAITING_DOTS="%F{cyan}...%f" ``` -------------------------------- ### Configure prez Separate Man Sections Source: https://context7.com/mattmc3/ez-compinit/llms.txt Enable separate sections for man page completions in the 'prez' style. ```zsh zstyle ':completion:*:manuals' separate-sections true ``` -------------------------------- ### Configure zshzoo Kill Menu Colors Source: https://context7.com/mattmc3/ez-compinit/llms.txt Enable colored output for the kill menu and specify color formatting for process lists within the zshzoo style. ```zsh zstyle ':completion:*:*:kill:*' menu yes select zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;36=0=01' ``` -------------------------------- ### Deferred Completion Definitions with compdef Queue Source: https://context7.com/mattmc3/ez-compinit/llms.txt ez-compinit overrides `compdef` to queue calls, ensuring that completion definitions from plugins loaded before `compinit` are safely registered. Inspect the queue using `print -l "${__compdef_queue[@]}"` for debugging. ```zsh # .zshrc example — plugin loaded before compinit calls compdef safely source /path/to/ez-compinit/ez-compinit.plugin.zsh # This compdef call is queued, not executed immediately: compdef _git git # Another plugin may also call compdef during its own load: source /path/to/some-other-plugin/plugin.zsh # ^ if that plugin calls `compdef _foo foo`, it is also queued # At the end of .zshrc, the precmd hook fires run-compinit, which: # 1. Calls the real autoloaded compinit # 2. Drains __compdef_queue, replaying every compdef call # 3. Removes itself from the precmd hook # To inspect the queue before it drains (for debugging): print -l "${__compdef_queue[@]}" ``` -------------------------------- ### Enable ohmy Strict Case-Sensitive Matching Source: https://context7.com/mattmc3/ez-compinit/llms.txt Activate strict case-sensitive matching for the 'ohmy' style. ```zsh CASE_SENSITIVE=true ``` -------------------------------- ### Enable Caching for ez-compinit Source: https://github.com/mattmc3/ez-compinit/blob/main/README.md Enable caching of the zcompdump file for a day to improve performance. Use with caution, as it can cause issues if fpath is modified without clearing the cache. ```zsh zstyle ':plugin:ez-compinit' 'use-cache' 'yes' ``` -------------------------------- ### Configure zshzoo Fuzzy Matching Source: https://context7.com/mattmc3/ez-compinit/llms.txt Set up fuzzy approximate matching for the zshzoo style, capping errors based on prefix and suffix length. ```zsh zstyle ':completion:*' completer _complete _match _approximate zstyle -e ':completion:*:approximate:*' max-errors \ 'reply=($((($#PREFIX+$#SUFFIX)/3>7?7:($#PREFIX+$#SUFFIX)/3))numeric)' ``` -------------------------------- ### Configure gremlin Dynamic Error Tolerance Source: https://context7.com/mattmc3/ez-compinit/llms.txt Set up dynamic error tolerance for approximate matching in the 'gremlin' style, allowing 1 error per 3 characters typed. ```zsh zstyle ':completion:*:approximate:' max-errors \ 'reply=( $((($#PREFIX+$#SUFFIX)/3 )) numeric )' ``` -------------------------------- ### Call compinit Manually Source: https://context7.com/mattmc3/ez-compinit/llms.txt Call compinit manually at the bottom of .zshrc for full control over its arguments. ez-compinit's wrapper ensures the compdef queue is drained correctly before compinit executes. ```zsh # .zshrc # 1. Load ez-compinit at the TOP — installs the compdef queue source /path/to/ez-compinit/ez-compinit.plugin.zsh # 2. Load other plugins freely — their compdef calls are safely queued source /path/to/plugin-a/plugin-a.plugin.zsh source /path/to/plugin-b/plugin-b.plugin.zsh # 3. Populate fpath with any custom completions fpath=(~/.config/zsh/completions $fpath) # 4. Call compinit yourself at the BOTTOM with custom flags autoload -Uz compinit compinit -u -d "${XDG_CACHE_HOME:-$HOME/.cache}/zsh/zcompdump" ``` -------------------------------- ### Enable ohmy Hyphen-Insensitive Matching Source: https://context7.com/mattmc3/ez-compinit/llms.txt Activate hyphen-insensitive matching for the 'ohmy' style, allowing matches like 'foo-bar' for 'foobar'. ```zsh HYPHEN_INSENSITIVE=true ``` -------------------------------- ### Disable Automatic Compstyle Application Source: https://context7.com/mattmc3/ez-compinit/llms.txt Set the compstyle zstyle to 'off' or 'none' to disable automatic application. ```zsh zstyle ':plugin:ez-compinit' 'compstyle' 'off' ``` -------------------------------- ### Set Custom Dump File Path for ez-compinit Source: https://github.com/mattmc3/ez-compinit/blob/main/README.md Override the default Zsh completion dump file location by setting the ZSH_COMPDUMP variable. Ensure the path is accessible and writable. ```zsh ZSH_COMPDUMP=/path/to/.zcompdump ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.