Install Hugo Fish Completions Without Guessing Where They Go
Fish does not read Bash completion scripts, so Hugo ships a Fish-specific generator that takes one pipe to try out. You will make Hugo's subcommands and flags available as Fish completions, either for the current shell or for future shells. The examples use Hugo 0.123.7, installed from Ubuntu package hugo 0.123.7-1ubuntu0.3+esm2.
The route
Jump straight to the step you need, or tick off Done means at the end.
- Time: about five minutes.
- You need: Hugo, Fish, and a writable home directory. No command in this guide needs
sudo.
1. Check the installed command
Start by confirming which Hugo binary and version will generate the completion script. This is read-only:
$ command -v hugo
/usr/bin/hugo
$ hugo version
hugo v0.123.7+extended linux/amd64 BuildDate=2026-03-17T19:51:14Z VendorInfo=ubuntu:0.123.7-1ubuntu0.3+esm2
The relevant command is a subcommand, not a separate executable: hugo completion fish. Its output is Fish source text; do not run it as an ordinary program and expect a configuration file to appear by itself.
Checkpoint
If command -v hugo fails, stop here and install Hugo through your normal package or release process. If the version differs, use the installed command's own help as the authority for its available flags.
2. Load completions for this shell only
To test the generated completions without changing files, pipe the script to Fish's source command:
$ hugo completion fish | source
This changes the current Fish process only. It does not alter a startup file, and the change disappears when that shell exits. To check that the generator itself ran successfully, inspect the status immediately afterwards:
$ echo $pipestatus
0 0
Fish reports the statuses of the commands in the pipeline in $pipestatus. The two zeros mean Hugo and source both succeeded. Completion menus are interactive, so the most direct practical check is to type hugo and press Tab in that same shell.
3. Save completions for new Fish sessions
Fish looks for command completion files in ~/.config/fish/completions. Create that directory if it is missing, then write Hugo's generated output to the documented filename:
$ mkdir -p ~/.config/fish/completions
$ hugo completion fish > ~/.config/fish/completions/hugo.fish
$ test -s ~/.config/fish/completions/hugo.fish; and echo 'Hugo completions written'
Hugo completions written
Warning
The redirection is a normal user write, but it replaces an existing hugo.fish. Inspect or back it up first if you may have local edits:
$ if test -e ~/.config/fish/completions/hugo.fish
cp --preserve=all ~/.config/fish/completions/hugo.fish ~/.config/fish/completions/hugo.fish.bak
end
$ hugo completion fish > ~/.config/fish/completions/hugo.fish
Shell redirection truncates the destination before Hugo finishes. If Hugo fails, the file can be empty or incomplete; the backup gives you a recovery path. Restore it with mv ~/.config/fish/completions/hugo.fish.bak ~/.config/fish/completions/hugo.fish after checking the backup is present.
4. Start a new shell and verify the installed file
The manpage says a new shell is needed for the saved setup to take effect. Open one rather than changing a global startup script:
$ exec fish
> type -a __hugo_completion
> hugo
The helper name is generated implementation detail and can vary, so an absent helper name is not by itself a failure. The useful check is pressing Tab after hugo and seeing Hugo subcommands offered. You can also confirm the file is readable and non-empty:
> string length < ~/.config/fish/completions/hugo.fish
<number greater than zero>
Fish may load completion files lazily, so a new session is the cleanest verification. If the menu is missing, check the path, file ownership, and whether this really is Fish:
> echo $version
> ls -l ~/.config/fish/completions/hugo.fish
> hugo completion fish --help
5. Choose whether descriptions are useful
By default, Hugo includes completion descriptions where its command definitions provide them. The command has one relevant option, --no-descriptions, which disables those descriptions while keeping the completion entries:
> hugo completion fish --no-descriptions > ~/.config/fish/completions/hugo.fish
Use that form only if descriptions make your menu noisy or your local Fish setup handles plain entries better. It still overwrites the file, so use the backup procedure above when replacing a working installation. There is no need to pass Hugo's inherited build flags such as --config or --destination to generate completions; those flags are accepted by the parent command but do not select the Fish output format.
6. Remove or regenerate the setup
Destructive action
To undo the persistent setup, remove only the Hugo completion file. Check the exact path before acting:
> test -f ~/.config/fish/completions/hugo.fish; and echo 'about to remove Hugo completions'
about to remove Hugo completions
> rm ~/.config/fish/completions/hugo.fish
> test ! -e ~/.config/fish/completions/hugo.fish; and echo 'removed'
removed
If you made a backup, restore it rather than regenerating an older version:
> mv ~/.config/fish/completions/hugo.fish.bak ~/.config/fish/completions/hugo.fish
For a later Hugo upgrade, regenerate the file with the new binary. The completion script is generated from that installed Hugo version, so refreshing it avoids carrying an old command list into a newer installation.
Done means
- Version confirmed.
hugo versionreports the version you intend to use. - Completions available.
hugo completion fish | sourceworks for a temporary session, or~/.config/fish/completions/hugo.fishis non-empty for persistent use. - Tab works in a fresh shell. A new Fish shell offers completions after
hugoand Tab. - Backup taken where needed. You know whether the file includes descriptions, and you have a backup before replacing a hand-edited file.