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