Explain fish code

Paste a fish config or script and Vibe explains what each line does: set -gx, fish_add_path, abbreviations, functions and where fish differs from bash.

config.fish

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.

Vibe21 lines selected

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

What this fish sample shows

variables
fish sets variables with set, not NAME=value. -g makes one global and -x exports it to the programs fish starts, so set -gx EDITOR nano gave EDITOR=nano. set -g fish_greeting with no value empties the greeting, so a new terminal opens without one.
PATH
fish_add_path ~/bin puts ~/bin first on the PATH and leaves it alone if it's already there: after running it again and re-reading the file, ~/bin was still listed once. command -v hello then found the hello script in ~/bin.
abbreviations and aliases
An abbreviation is expanded on the command line as you type, so the full git status --short lands in your history. alias in fish writes a small function: type ll showed function ll --wraps='ls -lah'. fish already ships an ll of its own, ls -lh, and the alias replaces it.
functions and status
function ... end defines a command, and $argv holds its arguments, starting at 1: mkcd a/b made both folders and moved into them. ; and runs the next command only if the one before it worked. if status is-interactive keeps the shortcuts to terminals you type into; the rest of the file runs for every fish, so a fish -c script still had EDITOR and mkcd.

Good to know

  • Run with fish 4.8.1 on a test home folder, so nothing touched a real config.
  • Some bash habits work in fish 4.8.1: export FOO=bar, $(echo hi) and true && echo ok all ran. A bash if [ 1 = 1 ]; then echo yes; fi didn't: fish stopped with Missing end to balance this if statement, because fish ends an if with end.
  • fish doesn't split variables on spaces: with set f "my file.txt", count $f printed 1. Lists start at 1, and $l[-1] is the last item.

Watch out: Abbreviations exist only while you type. In a fish script, abbr --add gs git status --short followed by gs didn't run git: it ran the real gs command, which on the test machine was GPL Ghostscript 10.07.1. Write the full command, or a function, in scripts.

Explain fish 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