Add :lang zig
module
This commit is contained in:
parent
ce65645fb8
commit
28705030e0
5 changed files with 53 additions and 0 deletions
34
modules/lang/zig/config.el
Normal file
34
modules/lang/zig/config.el
Normal file
|
@ -0,0 +1,34 @@
|
|||
;;; lang/zig/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(after! projectile
|
||||
(pushnew! projectile-project-root-files "build.zig"))
|
||||
|
||||
|
||||
;;
|
||||
;; zig-mode
|
||||
|
||||
(use-package! zig-mode
|
||||
:mode "\\.zig$"
|
||||
:hook (zig-mode . rainbow-delimiters-mode)
|
||||
:config
|
||||
;; Disable zig-mode's default format on save behaviour.
|
||||
(setq zig-format-on-save nil)
|
||||
(when (featurep! +lsp)
|
||||
(add-hook 'zig-mode-local-vars-hook #'lsp!)))
|
||||
|
||||
(map! :localleader
|
||||
(:after zig-mode
|
||||
:map zig-mode-map
|
||||
"b" #'zig-compile
|
||||
"f" #'zig-format-buffer
|
||||
"r" #'zig-run
|
||||
"t" #'zig-test-buffer))
|
||||
|
||||
(when (featurep! :checkers syntax)
|
||||
(flycheck-define-checker zig
|
||||
"A zig syntax checker using the zig-fmt interpreter."
|
||||
:command ("zig" "fmt" (eval (buffer-file-name)))
|
||||
:error-patterns
|
||||
((error line-start (file-name) ":" line ":" column ": error: " (message) line-end))
|
||||
:modes zig-mode)
|
||||
(add-to-list 'flycheck-checkers 'zig))
|
13
modules/lang/zig/doctor.el
Normal file
13
modules/lang/zig/doctor.el
Normal file
|
@ -0,0 +1,13 @@
|
|||
;; -*- lexical-binding: t; no-byte-compile: t; -*-
|
||||
;;; lang/zig/doctor.el
|
||||
|
||||
(assert! (or (not (featurep! +lsp))
|
||||
(featurep! :tools lsp))
|
||||
"This module requires (:tools lsp)")
|
||||
|
||||
(unless (executable-find "zig")
|
||||
(warn! "Couldn't find zig binary"))
|
||||
|
||||
(when (featurep! +lsp)
|
||||
(unless (executable-find "zls")
|
||||
(warn! "Couldn't find zls binary")))
|
4
modules/lang/zig/packages.el
Normal file
4
modules/lang/zig/packages.el
Normal file
|
@ -0,0 +1,4 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; lang/zig/packages.el
|
||||
|
||||
(package! zig-mode :pin "6f10653cc17b9c74150ac2f6833eaaaf55488398")
|
Loading…
Add table
Add a link
Reference in a new issue