Skip to content

πŸ› οΈ ZSHAND Functions ReferenceΒΆ

πŸ“‹ Reusable utility functions loaded at startup. Available in every terminal session. Each function file includes a documentation header with USAGE, DEPENDENCIES, EXAMPLES, and SEE ALSO.

See also: Source Reference (full list from headers) Β· Config (where to add your own) Β· Architecture (functions dir merge)


πŸ›€οΈ Path FunctionsΒΆ

Function Usage Purpose
add_path add_path ~/bin Safely add to PATH (-a append, -r recursive)
zpath zpath Audit PATH, fpath, manpath
pathfix pathfix Audit and repair PATH (missing dirs, duplicates)

πŸ”€ Git FunctionsΒΆ

Function Usage Purpose
tossh tossh [dir] Convert GitHub HTTPS remotes to SSH
gundo gundo Git undo menu (unstage, soft reset, squash, hard reset)
gitprune gitprune Delete merged local branches
_gitid (chpwd hook) Auto Git identity from project .env

☁️ Cloud Sync Functions¢

Function Usage Purpose
pin pin [dir] Interactive pin menu β€” choose mirror or cache strategy
pin_mirror pin_mirror [dir] [remote] Create/update mirror (bisync) pin
pin_cache pin_cache [dir] [remote] Create/update cache (VFS pre-heat) pin
unpin unpin [dir] [remote\|all] Remove pins from a directory

See Cloud Sync for full documentation, configuration, and the cloudsync CLI.


πŸ–₯️ System FunctionsΒΆ

Function Usage Purpose
health health Environment health check (cache, runtimes, Atuin, SSH, clipboard, disk)
pkgsync pkgsync Verify package sync (core + optional, MCHOSE bins, clipboard)
zports zports [term] Active network listeners (lsof)
ztop ztop Workstation dashboard (uptime, Git, cache, zpulse)
extract extract <file> Universal archive extraction (optional delete source)
zopt zopt [pattern] List Zsh options (optional filter)
tog tog <option> Toggle Zsh option on/off (e.g. tog autocd)

πŸ”§ Helper FunctionsΒΆ

Function Usage Purpose
dcopy dcopy Copy CWD path to clipboard
fcopy fcopy <file> Copy file contents to clipboard
zbak zbak <file> Timestamped backup to .backups
fnew fnew <name> Create function stub and open in editor
google google "query" Open Google search in browser
jfmt jfmt [file] Pretty-print JSON (file or stdin)
seek seek "pattern" Search zshand files (ripgrep)

πŸ“Š Logging FunctionsΒΆ

Function Usage Purpose
zlog zlog [cmd] View session log (summary, -t, -list, -clean, failed, search)
logstat logstat 30-day log statistics (commands, success rate, top commands)
bootlog bootlog [view\|tail\|clear\|path] Shell init log viewer

πŸ“š Reference FunctionsΒΆ

Function Usage Purpose
zhelp zhelp Master command reference
zwidgets zwidgets Keyboard map (widget bindings)

✏️ Adding Custom Functions¢

  1. Create ~/.config/zshand/functions/my_func.zsh:
# ── my_func β€” Short description ──────────────────────────────────────────────
#
# USAGE:
#   my_func [args]
#
# ─────────────────────────────────────────────────────────────────────────────

my_func() {
    local arg="${1:-default}"
    echo "Processing: $arg"
}
  1. Rebuild: zr
  2. Use it: my_func value

πŸ“ Naming ConventionsΒΆ

  • No prefix β€” user-facing functions (dcopy, health, seek)
  • z prefix β€” framework-related (zpath, zlog, zopt, ztop)
  • _ prefix β€” internal/hook-only (_gitid, _zlog_viewer)
  • .zsh extension β€” sourced at startup, no shebang needed

πŸ”€ Override BehaviorΒΆ

User functions with the same basename replace framework functions:

~/.config/zshand/functions/seek.zsh  β†’  replaces $ZSHAND/functions/seek.zsh
~/.config/zshand/functions/my_new.zsh  β†’  added alongside framework functions

Document Purpose
πŸ“‘ API / Source Per-function generated docs (source/functions/)
πŸ—οΈ Architecture Function loading in boot sequence
πŸ‘€ Config Custom functions directory
πŸ“ Header Standard Function file header format
πŸ“š Documentation Index Full doc nav