This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+lang/zig/README.org
emacspace 4471024721
[bot] Auto-update (#14648)
* documentation formatting: Thu Apr 15 19:58:45 UTC 2021

* Built-in files auto-update: Thu Apr 15 19:57:01 UTC 2021
2021-04-15 22:16:34 +02:00

2.2 KiB

Zig layer

Description

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

Features:

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

Install

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.

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.

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)))

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.

Key bindings

LSP

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