diff options
Diffstat (limited to 'runtime/ftplugin/zig.vim')
-rw-r--r-- | runtime/ftplugin/zig.vim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/ftplugin/zig.vim b/runtime/ftplugin/zig.vim index cd18bfe2bd..45ea582615 100644 --- a/runtime/ftplugin/zig.vim +++ b/runtime/ftplugin/zig.vim @@ -40,14 +40,17 @@ endif let &l:define='\v(<fn>|<const>|<var>|^\s*\#\s*define)' " Safety check: don't execute zip from current directory +let s:tmp_cwd = getcwd() if !exists('g:zig_std_dir') && exists('*json_decode') && - \ executable('zig') && fnamemodify(exepath("zig"), ":p:h") != getcwd() + \ executable('zig') && (fnamemodify(exepath("zig"), ":p:h") != s:tmp_cwd + \ || (index(split($PATH,has("win32")? ';' : ':'), s:tmp_cwd) != -1 && s:tmp_cwd != '.')) silent let s:env = system('zig env') if v:shell_error == 0 let g:zig_std_dir = json_decode(s:env)['std_dir'] endif unlet! s:env endif +unlet s:tmp_cwd if exists('g:zig_std_dir') let &l:path = &l:path . ',' . g:zig_std_dir |