Skip to content

zrecompile - Selective Recompilation

Provides targeted recompilation for different scopes — user config only, framework only, or both — without the full validation overhead of zrebuild.

Overview

zrecompile is the middle ground between zr (rebuilds everything) and manually recompiling a single file. It accepts a mode argument to control scope: user recompiles only files in $ZSHAND_CONFIG_DIR, framework calls zprime for framework directories, and both (the default) rebuilds framework and then the full bundle.

When to use: When you've only changed user config (use user mode for speed), or when you want to explicitly control what gets recompiled.

Usage

zrecompile [mode]

Modes

  • user — Recompile only user configuration files (functions, widgets, hooks, init.d, post.d, rc.d, bin)
  • framework — Recompile only framework components via zprime
  • both — Recompile framework and rebuild full bundle (default)

Options

  • -h, --help: Show help message

Examples

# Recompile everything (default)
zrecompile

# Quick recompile after editing aliases or user functions
zrecompile user

# Rebuild only framework after pulling changes
zrecompile framework

What It Does

User Mode

Iterates over all .zsh files in $ZSHAND_CONFIG_DIR subdirectories (functions, widgets, hooks, init.d, post.d, rc.d) and bin scripts. For each file, removes the old .zwc, validates syntax with zsh -n, and compiles with zcompile -U.

Framework Mode

Loads core/02_vars.zsh and core/06_engine.zsh to bootstrap the build system, then runs zprime.

Both Mode

Same as framework mode but runs zprime --both, which rebuilds directory bundles and the full bundle.

Dependencies

  • Required: zsh, zcompile
  • Required (framework/both modes): core/02_vars.zsh, core/06_engine.zsh, zprime

See Also

  • zr — Standard full rebuild
  • zrebuild — Force rebuild with syntax validation
  • zfresh — Clean rebuild with shell restart