ztags(1)

πŸ“¦
version 1.0.1-unstable-2026-04 Β· 2 versions
, in nixpkgs unstable

πŸ’… 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 existing tags file instead of overwriting it. and hey, duplicate tags get removed. considerate king behavior. πŸ‘‘
  • -r β€” uses paths relative to the current working directory in the generated tags file. this is equivalent to --tag-relative=no in ctags(1). iykyk.
  • -o OUTPUT β€” writes tags to OUTPUT (the default is tags in 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