]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(compiler): set zig errorformat
authoryilisharcs <yilisharcs@gmail.com>
Tue, 12 May 2026 18:11:55 +0000 (18:11 +0000)
committerChristian Brabandt <cb@256bit.org>
Tue, 12 May 2026 18:11:55 +0000 (18:11 +0000)
includes a new zig_cc file to catch warnings

closes: #20198

Signed-off-by: yilisharcs <yilisharcs@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/compiler/zig.vim
runtime/compiler/zig_build.vim
runtime/compiler/zig_build_exe.vim
runtime/compiler/zig_cc.vim [new file with mode: 0644]
runtime/compiler/zig_test.vim

index 44014a37754ccf0542514438bfb73a1deec5fabc..5f08423dafa85610ae29c764e24b19ce35623341 100644 (file)
@@ -1,6 +1,8 @@
 " Vim compiler file
 " Compiler: Zig Compiler
 " Upstream: https://github.com/ziglang/zig.vim
+" Last Change:
+" 2026 May 12 by the Vim project (set errormformat)
 
 if exists("current_compiler")
     finish
@@ -11,13 +13,29 @@ let s:save_cpo = &cpo
 set cpo&vim
 
 " a subcommand must be provided for the this compiler (test, build-exe, etc)
-if has('patch-7.4.191')
-    CompilerSet makeprg=zig\ \$*\ \%:S
-else
-    CompilerSet makeprg=zig\ \$*\ \"%\"
-endif
+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
 
-" TODO: improve errorformat as needed.
+" 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
index 5a61c9f4235d8c98d1bf5ceab54e66c05a58009f..79308afe34b814b1a0b17c76439a8cef10153258 100644 (file)
@@ -1,7 +1,8 @@
 " Vim compiler file
 " Compiler: Zig Compiler (zig build)
 " Upstream: https://github.com/ziglang/zig.vim
-" Last Change: 2024 Apr 05 by The Vim Project (removed :CompilerSet definition)
+" Last Change: 2024 Apr 05 by the Vim Project (removed :CompilerSet definition)
+" 2026 May 12 by the Vim Project (removed comment)
 
 if exists('current_compiler')
   finish
@@ -13,13 +14,11 @@ let s:save_cpo = &cpo
 set cpo&vim
 
 if exists('g:zig_build_makeprg_params')
-       execute 'CompilerSet makeprg=zig\ build\ '.escape(g:zig_build_makeprg_params, ' \|"').'\ $*'
+  execute 'CompilerSet makeprg=zig\ build\ '.escape(g:zig_build_makeprg_params, ' \|"').'\ $*'
 else
-       CompilerSet makeprg=zig\ build\ $*
+  CompilerSet makeprg=zig\ build\ $*
 endif
 
-" TODO: anything to add to errorformat for zig build specifically?
-
 let &cpo = s:save_cpo
 unlet s:save_cpo
-" vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab
+" vim: tabstop=8 shiftwidth=2 softtabstop=2 expandtab
index 440eff7885dea7f75e10e278456e8242f07cf51e..ab63bfffe815c25041231e7dd28073bdbb364961 100644 (file)
@@ -1,7 +1,8 @@
 " Vim compiler file
 " Compiler: Zig Compiler (zig build-exe)
 " Upstream: https://github.com/ziglang/zig.vim
-" Last Change: 2025 Nov 16 by The Vim Project (set errorformat)
+" Last Change: 2025 Nov 16 by the Vim Project (set errorformat)
+" 2026 May 12 by the Vim project (remove errorformat)
 
 if exists('current_compiler')
   finish
@@ -13,9 +14,7 @@ let s:save_cpo = &cpo
 set cpo&vim
 
 CompilerSet makeprg=zig\ build-exe\ \%:S\ \$*
-" CompilerSet errorformat=%f:%l:%c: %t%*[^:]: %m, %f:%l:%c: %m, %f:%l: %m
-CompilerSet errorformat&
 
 let &cpo = s:save_cpo
 unlet s:save_cpo
-" vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab
+" vim: tabstop=8 shiftwidth=2 softtabstop=2 expandtab
diff --git a/runtime/compiler/zig_cc.vim b/runtime/compiler/zig_cc.vim
new file mode 100644 (file)
index 0000000..331d447
--- /dev/null
@@ -0,0 +1,18 @@
+" Vim compiler file
+" Compiler: Zig Compiler (zig cc)
+" Last Change: 2026 May 12
+
+if exists('current_compiler')
+  finish
+endif
+runtime compiler/zig.vim
+let current_compiler = 'zig_cc'
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+CompilerSet makeprg=zig\ cc\ \%:S\ \$*
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
+" vim: tabstop=8 shiftwidth=2 softtabstop=2 expandtab
index afe57ad4d3a8ca267b8be741f4f1d02c9139c49d..6dee38b2f179e2409026b5d0df7117b79c79b6a3 100644 (file)
@@ -1,7 +1,8 @@
 " Vim compiler file
 " Compiler: Zig Compiler (zig test)
 " Upstream: https://github.com/ziglang/zig.vim
-" Last Change: 2025 Nov 16 by The Vim Project (set errorformat)
+" Last Change: 2025 Nov 16 by the Vim Project (set errorformat)
+" 2026 May 12 by the Vim Project (remove error format)
 
 if exists('current_compiler')
   finish
@@ -13,9 +14,7 @@ let s:save_cpo = &cpo
 set cpo&vim
 
 CompilerSet makeprg=zig\ test\ \%:S\ \$*
-" CompilerSet errorformat=%f:%l:%c: %t%*[^:]: %m, %f:%l:%c: %m, %f:%l: %m
-CompilerSet errorformat&
 
 let &cpo = s:save_cpo
 unlet s:save_cpo
-" vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab
+" vim: tabstop=8 shiftwidth=2 softtabstop=2 expandtab