Explain .zshrc code

Paste a .zshrc and Vibe explains what each line sets up in a new terminal: history options, path, completion, aliases, functions and what the % codes in PROMPT show.

.zshrc

Up to 1,500 characters (about 60 lines). Your code is sent to Unvibe and Anthropic to write the explanation. Don't paste keys or passwords. Common key formats are refused.

Vibe25 lines selected

Press Explain it for the sample, or paste your own code first.

What this .zshrc sample shows

when it runs
zsh reads ~/.zshrc each time it starts an interactive shell, a terminal you type into, and that includes a login shell: zsh -l -i had the ll alias too. A script run with zsh -c doesn't read it: there whence -v ll said ll not found. bash ignores the file completely.
history and options
HISTSIZE is how many commands a session keeps in memory and SAVEHIST how many the history file keeps. With SHARE_HISTORY on, each command is written to HISTFILE as you type it, so every open terminal sees the others' commands, and HIST_IGNORE_DUPS skips a command typed twice in a row. setopt listed both as sharehistory and histignoredups.
path and typeset -U
In zsh, the array path and the text PATH are the same list, so path=(~/bin $path) puts ~/bin first, and command -v hello found the hello script there. typeset -U path keeps each folder once: after adding ~/bin again and re-reading the file, it was still listed 1 time. Without that line, two re-reads left it listed 3 times.
aliases, functions and the prompt
whence -v ll printed ll is an alias for ls -lah, and mkcd a/b made both folders and moved into them. In PROMPT, %F{blue} and %f start and stop the color, %~ is the folder with your home shown as ~ and %# is % for you or # for root: in ~/proj the prompt read ~/proj % with the folder in blue.

Good to know

  • Run with zsh 5.9.2 on a test home folder, so nothing touched a real ~/.zshrc. compinit wrote its cache, a .zcompdump file, into that folder on the first run.
  • zsh doesn't split a variable on spaces the way bash does: with f="my file.txt", set -- $f gave 1 argument in zsh and 2 in bash. Code copied from a bash script can behave differently here.
  • zsh arrays start at 1, not 0: with a=(x y z), ${a[1]} was x.

Watch out: Settings that scripts need don't belong in .zshrc. A script run as zsh -c saw none of it: ll not found, ~/bin wasn't on its path and command -v hello found nothing. A variable exported in ~/.zshenv, which zsh reads for every shell, reached the same script: it printed SHOP_ENV=[dev].

Explain .zshrc code beside your editor

Unvibe is a free app for Mac and Windows. In the app there is no pasting: select code in any app and press Control+U (Ctrl+Alt+U on Windows).

Install on Mac

curl -fsSL https://unvibe.site/install.sh | bash

Paste into Terminal. Unvibe isn't notarized by Apple yet, so this is the smooth path.

Opening the .dmg the first time
  1. Open the .dmg and drag Unvibe to Applications.
  2. Open it once; macOS says it can't verify it. Click Done.
    macOS dialog: Unvibe Not Opened, with Done and Move to Trash
    Real screen, macOS 15
  3. System Settings › Privacy & Security › Open Anyway. Confirm, then enter your Mac password. The button shows for about an hour after you try to open Unvibe.
    macOS Privacy & Security, Security section: Unvibe was blocked to protect your Mac, with the Open Anyway button
    Real screen, macOS 15

The Terminal line checks the download against the published SHA-256 and Unvibe's self-signed signature before it installs anything. More help with the first open