Zig is a fairly new (they haven't even reached 1.0 yet) language. Like Rust and Swift, it uses LLVM for the final stage.

The latest release is 0.8.1, but it seems they recommend installing nightly.

wget https://ziglang.org/builds/zig-linux-x86_64-0.9.0-dev.1083+9fa723ee5.tar.xz

sha256sum zig-linux-x86_64-0.9.0-dev.1083+9fa723ee5.tar.xz 

tar xf zig-linux-x86_64-0.9.0-dev.1083+9fa723ee5.tar.xz

rm zig-linux-x86_64-0.9.0-dev.1083+9fa723ee5.tar.xz

ln -s zig-linux-x86_64-0.9.0-dev.1083+9fa723ee5 zig

Similarly, there is documentation for 0.8.1, but they recommend just reading master.

Zig also has the zig language server, zls.

wget https://github.com/zigtools/zls/releases/download/0.1.0/x86_64-linux.tar.xz

tar -xf x86_64-linux.tar.xz

rm x86_64-linux.tar.xz

mv x86_64-linux zls-x86_64-linux

I'm going to put links to zig and zls in a place that's already in my path.

cd ~/.local/bin
ln -s /home/tim/zig/zig/zig
ln -s /home/tim/zig/zls-x86_64-linux/zls
❯ zig version

Let's try it!

cd ~/zig
mac hello-world
zig init-exe

Oh, mac is "make and change"

type mac
mac is a function
mac () 
    mkdir -p -- "$1" && cd -- "$1"
❯ zig build run
info: All your codebase are belong to us.

Now configure Emacs for zig.

M-x package-install RET zig-mode RET

This is configured in my ~/.emacs.d/config/programming/zig.el file.

(require 'lsp-mode)
(add-hook 'zig-mode-hook #'lsp-deferred)

Here's a shot of Emacs with zig-mode in action

Emacs in Zig mode

This is word-generator.zig from Zig By Example.