| 
									
										
										
										
											2022-12-06 18:20:10 +00:00
										 |  |  | " Vim filetype plugin file | 
					
						
							| 
									
										
										
										
											2024-05-21 23:27:03 +02:00
										 |  |  | " Language:     Zig | 
					
						
							|  |  |  | " Maintainer:   Mathias Lindgren <math.lindgren@gmail.com> | 
					
						
							|  |  |  | " Last Change:  2024 May 21 | 
					
						
							|  |  |  | " Based on:     https://github.com/ziglang/zig.vim | 
					
						
							| 
									
										
										
										
											2022-12-06 18:20:10 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | if exists("b:did_ftplugin") | 
					
						
							|  |  |  |   finish | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | let b:did_ftplugin = 1 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-21 23:27:03 +02:00
										 |  |  | let s:cpo_save = &cpo | 
					
						
							| 
									
										
										
										
											2022-12-06 18:20:10 +00:00
										 |  |  | set cpo&vim | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | compiler zig_build | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " Match Zig builtin fns | 
					
						
							|  |  |  | setlocal iskeyword+=@-@ | 
					
						
							|  |  |  | setlocal formatoptions-=t formatoptions+=croql | 
					
						
							| 
									
										
										
										
											2024-05-21 23:27:03 +02:00
										 |  |  | setlocal suffixesadd=.zig,.zir,.zon | 
					
						
							|  |  |  | let &l:define='\v(<fn>|<const>|<var>|^\s*\#\s*define)' | 
					
						
							|  |  |  | let b:undo_ftplugin = 'setl isk< fo< sua< mp< def<' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if get(g:, 'zig_recommended_style', 1) | 
					
						
							|  |  |  |     setlocal expandtab | 
					
						
							|  |  |  |     setlocal tabstop=8 | 
					
						
							|  |  |  |     setlocal softtabstop=4 | 
					
						
							|  |  |  |     setlocal shiftwidth=4 | 
					
						
							|  |  |  |     let b:undo_ftplugin .= ' | setl et< ts< sts< sw<' | 
					
						
							|  |  |  | endif | 
					
						
							| 
									
										
										
										
											2022-12-06 18:20:10 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | if has('comments') | 
					
						
							| 
									
										
										
										
											2023-10-19 10:16:59 -05:00
										 |  |  |     setlocal comments=:///,://!,:// | 
					
						
							| 
									
										
										
										
											2022-12-06 18:20:10 +00:00
										 |  |  |     setlocal commentstring=//\ %s | 
					
						
							| 
									
										
										
										
											2024-05-21 23:27:03 +02:00
										 |  |  |     let b:undo_ftplugin .= ' | setl com< cms<' | 
					
						
							| 
									
										
										
										
											2022-12-06 18:20:10 +00:00
										 |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if has('find_in_path') | 
					
						
							|  |  |  |     let &l:includeexpr='substitute(v:fname, "^([^.])$", "\1.zig", "")' | 
					
						
							|  |  |  |     let &l:include='\v(\@import>|\@cInclude>|^\s*\#\s*include)' | 
					
						
							| 
									
										
										
										
											2024-05-21 23:27:03 +02:00
										 |  |  |     let b:undo_ftplugin .= ' | setl inex< inc<' | 
					
						
							| 
									
										
										
										
											2022-12-06 18:20:10 +00:00
										 |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if exists('g:zig_std_dir') | 
					
						
							| 
									
										
										
										
											2024-05-21 23:27:03 +02:00
										 |  |  |     let &l:path .= ',' . g:zig_std_dir | 
					
						
							|  |  |  |     let b:undo_ftplugin .= ' | setl pa<' | 
					
						
							| 
									
										
										
										
											2022-12-06 18:20:10 +00:00
										 |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-21 23:27:03 +02:00
										 |  |  | let &cpo = s:cpo_save | 
					
						
							|  |  |  | unlet s:cpo_save | 
					
						
							| 
									
										
										
										
											2022-12-06 18:20:10 +00:00
										 |  |  | " vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab |