Set jai build args in a private vimrc

This commit is contained in:
Michael Campagnaro 2023-01-19 18:13:38 -05:00
parent 9371817937
commit 2343c46b89

9
vimrc
View File

@ -180,6 +180,9 @@ let g:campo_custom_ctags_args = ""
" searching the modules and how_to directories with CtrlP " searching the modules and how_to directories with CtrlP
let g:campo_jai_path = '' let g:campo_jai_path = ''
" Args to include when compiling a Jai file.
let g:campo_jai_build_args = ''
"################################################################ "################################################################
"################################################################ "################################################################
"################################################################ "################################################################
@ -1315,9 +1318,11 @@ function! Build(optimized=0, silent=0)
if a:silent if a:silent
let l:async_cmd .= "-post=call\\ HideAsyncResults() " let l:async_cmd .= "-post=call\\ HideAsyncResults() "
endif endif
let l:is_jai = 0
let l:cmd = "" let l:cmd = ""
if filereadable(l:parent_dir . "/build.jai") if filereadable(l:parent_dir . "/build.jai")
" Jai build file " Jai build file
let l:is_jai = 1
let l:cmd = "jai " . l:parent_dir . "/build.jai " let l:cmd = "jai " . l:parent_dir . "/build.jai "
if a:optimized == 1 if a:optimized == 1
echo "Compiling release build.jai" echo "Compiling release build.jai"
@ -1326,6 +1331,7 @@ function! Build(optimized=0, silent=0)
echo "Compiling debug build.jai" echo "Compiling debug build.jai"
endif endif
elseif l:ext == "jai" elseif l:ext == "jai"
let l:is_jai = 1
let l:cmd = "jai % " let l:cmd = "jai % "
if a:optimized == 1 if a:optimized == 1
echo "Compiling release " . expand('%:t') echo "Compiling release " . expand('%:t')
@ -1343,6 +1349,9 @@ function! Build(optimized=0, silent=0)
let l:cmd .= '-o ' let l:cmd .= '-o '
endif endif
endif endif
if l:is_jai
let l:cmd .= ' '.g:campo_jai_build_args
endif
exec l:async_cmd . l:cmd exec l:async_cmd . l:cmd
endfunction endfunction