From c1e02461f5ccb15892bf8ce21d41f7fcac33d0db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Sun, 4 Jul 2021 22:54:04 +0200 Subject: [PATCH] chore: minor improvement --- autoload/vimtex/compiler/latexmk.vim | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/autoload/vimtex/compiler/latexmk.vim b/autoload/vimtex/compiler/latexmk.vim index 01deea5fde..76e36187b8 100644 --- a/autoload/vimtex/compiler/latexmk.vim +++ b/autoload/vimtex/compiler/latexmk.vim @@ -626,13 +626,15 @@ endfunction " Utility functions " 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. + " Note: On Linux, we use double quoted perl strings; these interpolate + " variables. One should therefore NOT pass values that contain `$`. let l:win_cmd_sep = has('nvim') ? '^&' : '&' - let l:common = a:name . ' = ($' . a:name . ' ? $' . a:name + let l:common = printf('$%s = ($%s ? $%s', a:name, a:name, a:name) return has('win32') - \ ? ' -e "$' . l:common . ' . '' ' . l:win_cmd_sep . ' '' : '''') . ''' . a:value . '''"' - \ : ' -e ''$' . l:common . ' . " ; " : "") . "' . a:value . '"''' + \ ? printf(' -e "%s . '' %s '' : '''') . ''%s''"', + \ l:common, l:win_cmd_sep, a:value) + \ : printf(' -e ''%s . " ; " : "") . "%s"''', + \ l:common, a:value) endfunction "}}}1