diff --git a/autoload/vimtex/compiler/latexmk.vim b/autoload/vimtex/compiler/latexmk.vim index 52c2c9d16e..01deea5fde 100644 --- a/autoload/vimtex/compiler/latexmk.vim +++ b/autoload/vimtex/compiler/latexmk.vim @@ -628,9 +628,11 @@ endfunction function! s:wrap_option_appendcmd(name, value) abort " {{{1 " Do not use with $ in value. On linux, we use double quoted perl strings " that interpolate. + let l:win_cmd_sep = has('nvim') ? '^&' : '&' + let l:common = a:name . ' = ($' . a:name . ' ? $' . a:name return has('win32') - \ ? vimtex#compiler#latexmk#wrap_option(a:name, a:value) - \ : ' -e ''$' . a:name . ' = ($' . a:name . ' ? $' . a:name . ' . " ; " : "") . "' . a:value . '"''' + \ ? ' -e "$' . l:common . ' . '' ' . l:win_cmd_sep . ' '' : '''') . ''' . a:value . '''"' + \ : ' -e ''$' . l:common . ' . " ; " : "") . "' . a:value . '"''' endfunction "}}}1