Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions ftplugin/zig.vim
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,16 @@ endif
let &l:define='\v(<fn>|<const>|<var>|^\s*\#\s*define)'

if !exists('g:zig_std_dir') && exists('*json_decode') && executable('zig')
silent let s:env = system('zig env')
if v:shell_error == 0
let g:zig_std_dir = json_decode(s:env)['std_dir']
let s:env = system('zig env --plain')
if s:env !~ '^{'
" Remove any leading garbage which might be forcefully inserted by the shell
let s:env = substitute(s:env, '[^{]*\({.*}\)[^}]*', '\1', '')
endif
try
let g:zig_std_dir = json_decode(s:env)['std_dir']
catch
echom "Error parsing zig env output: " . v:exception
endtry
unlet! s:env
endif

Expand Down