aboutsummaryrefslogtreecommitdiff
path: root/runtime/compiler/zig.vim
blob: 0993874f585a030ceaef3f05cb25680aa4f31981 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
" Vim compiler file
" Compiler: Zig Compiler
" Upstream: https://codeberg.org/ziglang/zig.vim
" Last Change:
" 2026 May 12 by the Vim project (set errormformat)
" 2026 May 24 by the Vim project (do not escape vars for makeprg)

if exists("current_compiler")
    finish
endif
let current_compiler = "zig"

let s:save_cpo = &cpo
set cpo&vim

" a subcommand must be provided for the this compiler (test, build-exe, etc)
CompilerSet makeprg=zig\ $*\ %:S

CompilerSet errorformat=
            \%-G,
            \%-G\ %#+-\ %.%#,
            \%-Ginstall,
            \%-Ginstall\ transitive\ failure,
            \%-Grun,
            \%-Grun\ transitive\ failure,
            \%-Gtest,
            \%-Gtest\ transitive\ failure,
            \%-Gfailed\ command:\ %.%#,
            \%-Gerror:\ %*\\d\ compilation\ errors,
            \%-GBuild\ Summary:\ %.%#,
            \%-Gerror:\ the\ following\ build\ command\ failed\ with\ exit\ code\ %*\\d:,
            \%-G.zig-cache%.%#,
            \%E%f:%l:%c:\ error:\ %m,
            \%I%f:%l:%c:\ note:\ %m

" zig has no warnings, but zig cc and zig c++ do
CompilerSet errorformat+=
            \%W%f:%l:%c:\ warning:\ %m,
            \%-G%*\\d\ warnings\ generated.

let &cpo = s:save_cpo
unlet s:save_cpo
" vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab