robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

zeertzjqMerge pull request #40472 from zeertzjq/vim-1f337327945732ed7

master
1.5 KiB57 linesraw
1" Vim filetype plugin file
2" Language:     Zig
3" Maintainer:   Mathias Lindgren <math.lindgren@gmail.com>
4" Last Change:  2024 Oct 04
5"               2026 Jun 27 by Vim Project (normalize recommended style guard)
6" Based on:     https://codeberg.org/ziglang/zig.vim
7
8if exists("b:did_ftplugin")
9  finish
10endif
11
12let b:did_ftplugin = 1
13
14let s:cpo_save = &cpo
15set cpo&vim
16
17" Match Zig builtin fns
18setlocal iskeyword+=@-@
19setlocal formatoptions-=t formatoptions+=croql
20setlocal suffixesadd=.zig,.zir,.zon
21let &l:define='\v(<fn>|<const>|<var>|^\s*\#\s*define)'
22let b:undo_ftplugin = 'setl isk< fo< sua< mp< def<'
23
24if get(g:, 'zig_recommended_style',
25      \ get(g:, 'filetype_recommended_style', 1))
26    setlocal expandtab
27    setlocal tabstop=8
28    setlocal softtabstop=4
29    setlocal shiftwidth=4
30    let b:undo_ftplugin .= ' | setl et< ts< sts< sw<'
31endif
32
33if has('comments')
34    setlocal comments=:///,://!,://
35    setlocal commentstring=//\ %s
36    let b:undo_ftplugin .= ' | setl com< cms<'
37endif
38
39if has('find_in_path')
40    let &l:includeexpr='substitute(v:fname, "^([^.])$", "\1.zig", "")'
41    let &l:include='\v(\@import>|\@cInclude>|^\s*\#\s*include)'
42    let b:undo_ftplugin .= ' | setl inex< inc<'
43endif
44
45if exists('g:zig_std_dir')
46    let &l:path .= ',' . g:zig_std_dir
47    let b:undo_ftplugin .= ' | setl pa<'
48endif
49
50if !exists('current_compiler')
51    compiler zig_build
52    let b:undo_ftplugin .= "| compiler make"
53endif
54
55let &cpo = s:cpo_save
56unlet s:cpo_save
57" vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab