9
15
Fork
You've already forked zig.vim
2
Vim configuration for Zig.
Vim Script 100%
Find a file
Ethan Estrada 74bdb43c9d Update URL for vim-plug example in README.md
Only giving `<org>/<repo>` will cause vim-plug to attempt to pull from a
repo by that path on Github, which is now archived (i.e. not mirrored)
for this repo.
2025年12月07日 17:28:35 -06:00
autoload/zig Add ZON support to zig fmt integration 2024年12月28日 17:45:02 -05:00
compiler github -> codeberg 2025年11月28日 03:54:54 +01:00
ftdetect ftdetect zon files 2023年10月10日 11:42:21 -07:00
ftplugin Add zig_recommended_style option to disable default style settings 2025年11月15日 16:47:42 +01:00
indent Set b:undo_indent 2022年07月27日 19:13:06 -07:00
syntax update escape sequence detection in string and char literals 2025年09月11日 18:41:58 +02:00
LICENSE port files from zig 2017年04月13日 05:25:31 -04:00
README.md Update URL for vim-plug example in README.md 2025年12月07日 17:28:35 -06:00

zig.vim

File detection and syntax highlighting for the zig programming language.

Installation

If using vim-plug (for Vim or Neovim)

  • Open your vim config and add the following:
call plug#begin('~/.vim/plugged')
 Plug 'https://codeberg.org/ziglang/zig.vim'
call plug#end()
  • Restart vim / reload vim config
  • type :PlugInstall

If using Vim:

  • Use Vim 8 or newer
  • mkdir -p ~/.vim/pack/plugins/start/
  • cd ~/.vim/pack/plugins/start/
  • git clone https://codeberg.org/ziglang/zig.vim

If using Neovim:

  • mkdir -p ~/.local/share/nvim/site/pack/plugins/start/
  • cd ~/.local/share/nvim/site/pack/plugins/start/
  • git clone https://codeberg.org/ziglang/zig.vim

Configuration

This plugin enables automatic code formatting on save by default using zig fmt. To disable it, you can use this configuration in vimrc:

let g:zig_fmt_autosave = 0

The default compiler which gets used by :make (:help :compiler for details) is zig_build and it runs zig build. The other options are:

  • :compiler zig_test which runs zig test on the current file.
  • :compiler zig_build_exe which runs zig build-exe on the current file.
  • :compiler zig which requires that a subcommand is passed as an argument and it runs on the current file.