Emacs

Author’s Notice

This Documentation is incomplete.

The following Emacs Variants are documented:

zig-mode

The zig-mode plugin provides syntax highlighting and automatic indentation for Zig. It can be used in combination with lsp-mode or Eglot.

lsp-mode

If you don’t have zig or zls in your PATH, set the following configuration variables:

(setq lsp-zig-zls-executable "/path/to/zls_executable")
(setq lsp-zig-zig-exe-path "/path/to/zig_executable")

The available configuration are documented here.

Warning

Be aware that the configuration options may not match what is available in your installed ZLS version.

Code Actions

source.fixAll

Running source.fixall code actions is not natively supported by lsp-mode. See emacs-lsp/lsp-mode#1842

ZLS can work around this limitation by enabling the force_autofix config option.

ZLS 0.13.0

The behaviour of ZLS 0.13.0 (anything before 0.14.0-dev.214+05ea40b50 to be precise) is different from the current nightly build.

The enable_autofix option must be used instead of force_autofix.

source.organizeImports

Note

The source.organizeImports code action is available since ZLS 0.14.0-dev.188+2be424de5.

Use s-l r o to manually execute the code action.