2021-10-16 01:28:32 +02:00
|
|
|
← [[doom-module-index:][Back to module index]] ↙ [[doom-module-issues:::lang zig][Issues]] ↖ [[doom-module-source:lang/zig][Source]] ± [[doom-suggest-edit:][Suggest edits]] ? [[doom-help-modules:][Help]]
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
#+TITLE: :lang zig
|
|
|
|
#+SUBTITLE: C, but simpler
|
|
|
|
#+CREATED: April 05, 2021
|
|
|
|
#+SINCE: 21.12.0 (#4827)
|
|
|
|
|
|
|
|
* Description :unfold:
|
2021-04-05 16:18:30 +08:00
|
|
|
This module adds [[https://ziglang.org/][Zig]] support, with optional (but recommended) LSP support via
|
|
|
|
[[https://github.com/zigtools/zls][zls]].
|
|
|
|
|
2021-10-16 01:28:32 +02:00
|
|
|
- Syntax highlighting
|
|
|
|
- Syntax-checking ([[doom-package:][flycheck]])
|
|
|
|
- Code completion and LSP integration (~zls~)
|
2021-04-05 16:18:30 +08:00
|
|
|
|
|
|
|
** Maintainers
|
2021-10-16 01:28:32 +02:00
|
|
|
- [[doom-user:][@bnjmnt4n]]
|
|
|
|
|
|
|
|
[[doom-contrib-maintainer:][Become a maintainer?]]
|
|
|
|
|
|
|
|
** Module flags
|
|
|
|
- +lsp ::
|
|
|
|
Enables integration for the zls LSP server. It is highly recommended you use
|
|
|
|
this.
|
2021-04-05 16:18:30 +08:00
|
|
|
|
2021-10-16 01:28:32 +02:00
|
|
|
** Packages
|
|
|
|
- [[doom-package:][zig-mode]]
|
2021-04-05 16:18:30 +08:00
|
|
|
|
2021-10-16 01:28:32 +02:00
|
|
|
** Hacks
|
|
|
|
/No hacks documented for this module./
|
|
|
|
|
|
|
|
** TODO Changelog
|
|
|
|
# This section will be machine generated. Don't edit it by hand.
|
|
|
|
/This module does not have a changelog yet./
|
|
|
|
|
|
|
|
* Installation
|
|
|
|
[[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]]
|
2021-04-05 16:18:30 +08:00
|
|
|
|
|
|
|
To get started with Zig, you need the ~zig~ tool. Pre-built binaries for most
|
|
|
|
systems are available for download from [[https://ziglang.org/download/]] or from
|
|
|
|
[[https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager][system package managers]].
|
|
|
|
|
2021-10-16 01:28:32 +02:00
|
|
|
=zls= is a language server for Zig, which provides code completion,
|
|
|
|
|
|
|
|
* TODO Usage
|
|
|
|
#+begin_quote
|
|
|
|
🔨 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]]
|
|
|
|
#+end_quote
|
2021-04-05 16:18:30 +08:00
|
|
|
|
|
|
|
** LSP support
|
|
|
|
This module supports LSP integration. For it to work you'll need:
|
|
|
|
|
2021-10-16 01:28:32 +02:00
|
|
|
1. zls installed,
|
|
|
|
2. The [[doom-module:][:tools lsp]] module enabled. Only [[doom-package:][lsp-mode]] is supported for now,
|
|
|
|
3. The [[doom-module:][+lsp]] flag on this module enabled.
|
2021-04-05 16:18:30 +08:00
|
|
|
|
|
|
|
** Keybinds
|
|
|
|
| Binding | Description |
|
|
|
|
|-------------------+---------------------|
|
2021-10-16 01:28:32 +02:00
|
|
|
| [[kbd:][<localleader> b]] | ~zig-compile~ |
|
|
|
|
| [[kbd:][<localleader> f]] | ~zig-format-buffer~ |
|
|
|
|
| [[kbd:][<localleader> r]] | ~zig-run~ |
|
|
|
|
| [[kbd:][<localleader> t]] | ~zig-test-buffer~ |
|
2021-04-05 16:18:30 +08:00
|
|
|
|
2021-10-16 01:28:32 +02:00
|
|
|
* TODO Configuration
|
|
|
|
#+begin_quote
|
|
|
|
🔨 /This module's configuration documentation is incomplete./ [[doom-contrib-module:][Complete it?]]
|
|
|
|
#+end_quote
|
2021-04-05 16:18:30 +08:00
|
|
|
|
2021-10-16 01:28:32 +02:00
|
|
|
** Customize zls path
|
|
|
|
To customize the path of the =zls= executable, modify ~lsp-zig-zls-executable~:
|
|
|
|
#+begin_src emacs-lisp
|
2021-04-05 16:18:30 +08:00
|
|
|
;; in $DOOMDIR/config.el
|
2021-04-05 16:49:39 +08:00
|
|
|
(setq lsp-zig-zls-executable "~/path/to/zls")
|
2021-10-16 01:28:32 +02:00
|
|
|
#+end_src
|
|
|
|
|
|
|
|
* Troubleshooting
|
|
|
|
/There are no known problems with this module./ [[doom-report:][Report one?]]
|
|
|
|
|
|
|
|
* Frequently asked questions
|
|
|
|
/This module has no FAQs yet./ [[doom-suggest-faq:][Ask one?]]
|
|
|
|
|
|
|
|
* TODO Appendix
|
|
|
|
#+begin_quote
|
|
|
|
🔨 This module has no appendix yet. [[doom-contrib-module:][Write one?]]
|
|
|
|
#+end_quote
|