diff --git a/autoload/vimtex/compiler/latexmk.vim b/autoload/vimtex/compiler/latexmk.vim index 00d7dce723..fcbb9bb942 100644 --- a/autoload/vimtex/compiler/latexmk.vim +++ b/autoload/vimtex/compiler/latexmk.vim @@ -22,6 +22,14 @@ endfunction "}}}1 +function! vimtex#compiler#latexmk#wrap_append_cmd_option(name, value) abort " {{{1 + return has('win32') + \ ? ' -e "$' . a:name . ' .= '';' . a:value . '''"' + \ : ' -e ''$' . a:name . ' .= ";' . a:value . '"''' +endfunction + +"}}}1 + function! vimtex#compiler#latexmk#get_rc_opt(root, opt, type, default) abort " {{{1 " " Parse option from .latexmkrc. @@ -263,7 +271,7 @@ function! s:compiler.build_cmd() abort dict " {{{1 \ 'failure_cmd' : 'vimtex_compiler_callback_failure', \}) let l:func = 'echo ' . l:val - let l:cmd .= vimtex#compiler#latexmk#wrap_option(l:opt, l:func) + let l:cmd .= vimtex#compiler#latexmk#wrap_append_cmd_option(l:opt, l:func) endfor elseif empty(v:servername) call vimtex#log#warning('Can''t use callbacks with empty v:servername') @@ -280,7 +288,7 @@ function! s:compiler.build_cmd() abort dict " {{{1 \ . vimtex#util#shellescape('""') \ . ' --servername ' . vimtex#util#shellescape(v:servername) \ . ' --remote-expr ' . l:callback - let l:cmd .= vimtex#compiler#latexmk#wrap_option(l:opt, l:func) + let l:cmd .= vimtex#compiler#latexmk#wrap_append_cmd_option(l:opt, l:func) endfor endif endif