ztags(1)
π ztags β bestie, it's giving tag generation
ok so real talk: this is the ztags(1) page from the General Commands Manual, and it's genuinely one of my fav little tools. sit down, grab a strawberry π, let's get into it.
β¨ NAME β¨
ztags β generates tags files straight out of your Zig source code. yeah. it does that. π
β¨ SYNOPSIS β¨
ztags [-a] [-r] [-o OUTPUT] FILES...
like three flags and a bunch of files, that's the whole vibe check. π¦
β¨ DESCRIPTION β¨
okay so ztags is lowkey a glow-up replacement for ctags(1), but specifically for Zig source code. and the way it's different?? iconic.
unlike ctags(1), ztags does not do regex-based matching β it actually parses the abstract syntax tree of the Zig sources you feed it. the result: fewer false positives and better matching. no cap. π₯
import statements shaped like @import("foo.zig") get followed and parsed. but like β only imports that use relative file paths. imports like @import("foo") do not get followed, because ztags straight up doesn't have enough info at runtime to figure out where the source file for the foo package actually lives. it's not being lazy, it just can't. π
the following options are available:
-aβ appends tags to an existingtagsfile instead of overwriting it. and hey, duplicate tags get removed. considerate king behavior. π-rβ uses paths relative to the current working directory in the generatedtagsfile. this is equivalent to--tag-relative=noinctags(1). iykyk.-o OUTPUTβ writes tags to OUTPUT (the default istagsin the current directory). β¨
β¨ EXAMPLES β¨
πΈ Generate tags for the Zig standard library
run ztags on std.zig inside Zig's installation directory. example:
ztags -o ~/.cache/tags/zig.tags /usr/local/lib/zig/lib/std.zig
this generates a separate tags file just for standard library tags. main character energy, honestly. π
alternatively, you can analyze the standard library right alongside your project source code and put all the tags into the same file:
ztags src/main.zig /usr/local/lib/zig/lib/std.zig
one file, all the tags, zero drama. π«Ά
β¨ SEE ALSO β¨
β¨ CONTRIBUTE β¨
found a bug? wanna open a pull request? bestie, go off β report bugs or open pull requests at:
https://codeberg.org/gpanders/ztags
the door is open, we love a contributor. π
β¨ AUTHOR β¨
Gregory Anders <greg@gpanders.com> β ty for your service, fr fr. π
ok that's the whole page!! now go tag something and slay. π β¨
this little gem came from the General Commands Manual and got stamped 1980-01-01 β so it's technically older than all of us, and honestly? it aged like fine wine. π·π§ mwah, bye bestie! π
π¦ where this page comes from
- nixpkgs unstable: ztags 1.0.1-unstable-2026-04-23
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms