motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit d0992e28ae6d478aa9209b40739389cf191f4cda (tree)
parent b30e6f8b6f21b59ca80c1aa682709ec6833d78d0
Author: Gregory Anders <greg@gpanders.com>
Date:   Tue, 14 Dec 2021 15:50:49 -0700

Allow user to specify std dir

Running 'zig env' adds a considerable amount of time to startup, and the
relevant result (the std directory) doesn't typically change often.
Allow users to manually specify the std dir through the g:zig_std_dir
global variable and fallback to calling 'zig env' only if this variable
doesn't exist.

Diffstat:
Mftplugin/zig.vim | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/ftplugin/zig.vim b/ftplugin/zig.vim @@ -35,14 +35,18 @@ endif let &l:define='\v(<fn>|<const>|<var>|^\s*\#\s*define)' -if exists("*json_decode") && executable('zig') +if !exists('g:zig_std_dir') && exists('*json_decode') && executable('zig') silent let s:env = system('zig env') if v:shell_error == 0 - let &l:path=json_decode(s:env)['std_dir'] . ',' . &l:path + let g:zig_std_dir = json_decode(s:env)['std_dir'] endif unlet! s:env endif +if exists('g:zig_std_dir') + let &l:path = g:zig_std_dir . ',' . &l:path +endif + let b:undo_ftplugin = \ 'setl isk< et< ts< sts< sw< fo< sua< mp< com< cms< inex< inc< pa<'