42 lines
1.2 KiB
Markdown
42 lines
1.2 KiB
Markdown
# zig.kak
|
|
|
|
Useful tools for developing [Zig](https://ziglang.org) on [Kakoune](https://kakoune.org). Note that Kakoune already includes Zig syntax highlighting by default.
|
|
|
|
Inspired by `make.kak` and `grep.kak`.
|
|
|
|
## Issues, patches, death threats
|
|
|
|
Send a (nice) email to `hi@nulo.in`.
|
|
|
|
## Commands
|
|
|
|
### `zig-run [arguments]`: wrapper for `zig build run`
|
|
|
|
> All the optional arguments are forwarded to zig build run.
|
|
|
|
Runs `zig build run` and opens the result in a buffer with basic syntax highlighting for errors, also allows going to the position of the errors by pressing Return.
|
|
|
|
### `zig-auto-run <scope>`: automatically run zig-run on save
|
|
|
|
Add this to your kakrc to apply this when opening any Zig file:
|
|
|
|
```kak
|
|
hook global WinSetOption filetype=zig %{ zig-auto-run buffer }
|
|
```
|
|
|
|
### `new-tools`: open a new client for tools (make.kak, grep.kak, zig.kak) to use for output
|
|
|
|
Also sets the current client to be the one to go back to when jumping to an error.
|
|
|
|
## Also useful
|
|
|
|
Set the formatter for Zig files to `zig fmt`:
|
|
|
|
```kak
|
|
hook global WinSetOption filetype=zig %{
|
|
set-option buffer formatcmd 'zig fmt --stdin'
|
|
# Optionally format every time we save
|
|
#hook buffer BufWritePre .* format-buffer
|
|
}
|
|
```
|