You are viewing the documentation for the develop branch. The documentation for the release version is here .

Table of Contents

Zig layer

Table of ContentsClose

1. Description

This layer adds support for the zig programming language https://ziglang.org/

1.1. Features:

  • Syntax Highlighting
  • LSP support via zls (see LSP)

2. Install

2.1. Layer

To use this configuration layer, add it to your ~/.spacemacs. You will need to add zig to the existing dotspacemacs-configuration-layers list in this file.

2.2. Choosing a backend

You can choose between multiple language backends. This choice defines mainly which kind of IDE features spacemacs can deliver.

Alternatively, if non is set the lsp backend will be automatically chosen if the layer lsp is used, otherwise zig-mode will be used.

For best results, make sure that the auto-completion and syntax-checking layers are enabled as well.

2.2.1. LSP (zls)

You can use zls as a Language Server backend to add features like auto-completion, code navigation, formatting etc.

To do so, make sure you have the lsp layer in your dotspacemacs-configuration-layers. If necessary, upgrade the lsp-mode package (support for Zig was added in version 20210318.923). Install zls following the instructions on the Wiki and then configure the zls layer with the appropriate variable:

(setq-default dotspacemacs-configuration-layers
  '((zig :variables
        zls-backend 'lsp)))

2.2.2. zig-mode

This mode provides support for the language with syntax highlighting, indentation and custom commands for compilation and testing.

For more information check the zig-mode repository.

3. Key bindings

3.1. LSP

You can find an overview of all the key bindings on the lsp layer description.

Author: root

Created: 2021-09-29 Wed 20:45

Validate