From 25a5cdc0678a0dcc814559284ec5397a578c6031 Mon Sep 17 00:00:00 2001 From: Nicholas Schwab Date: Sun, 4 Jul 2021 19:46:44 +0200 Subject: [PATCH 1/3] Revert "fix: disable appending of success_cmd on windows since escaping does not (#2085)" This reverts commit c9b3b50427d97403e8a36b3fe2d636d0a97db0d8. --- autoload/vimtex/compiler/latexmk.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/vimtex/compiler/latexmk.vim b/autoload/vimtex/compiler/latexmk.vim index 52c2c9d16e..8cca9d70fd 100644 --- a/autoload/vimtex/compiler/latexmk.vim +++ b/autoload/vimtex/compiler/latexmk.vim @@ -629,7 +629,7 @@ 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. return has('win32') - \ ? vimtex#compiler#latexmk#wrap_option(a:name, a:value) + \ ? ' -e "$' . a:name . ' = ($' . a:name . ' ? $' . a:name . ' . '' & '' : '''') . ''' . a:value . '''"' \ : ' -e ''$' . a:name . ' = ($' . a:name . ' ? $' . a:name . ' . " ; " : "") . "' . a:value . '"''' endfunction From 690185b365f1b32a8be673dd1d5d775fb2122d4c Mon Sep 17 00:00:00 2001 From: Nicholas Schwab Date: Sun, 4 Jul 2021 19:49:14 +0200 Subject: [PATCH 2/3] Escape command separator on windows nvim to fix issues in success_cmd. Co-authored with @yongrenjie --- autoload/vimtex/compiler/latexmk.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoload/vimtex/compiler/latexmk.vim b/autoload/vimtex/compiler/latexmk.vim index 8cca9d70fd..5003f131b5 100644 --- a/autoload/vimtex/compiler/latexmk.vim +++ b/autoload/vimtex/compiler/latexmk.vim @@ -628,8 +628,9 @@ 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') ? '^&' : '&' return has('win32') - \ ? ' -e "$' . a:name . ' = ($' . a:name . ' ? $' . a:name . ' . '' & '' : '''') . ''' . a:value . '''"' + \ ? ' -e "$' . a:name . ' = ($' . a:name . ' ? $' . a:name . ' . '' ' . l:win_cmd_sep . ' '' : '''') . ''' . a:value . '''"' \ : ' -e ''$' . a:name . ' = ($' . a:name . ' ? $' . a:name . ' . " ; " : "") . "' . a:value . '"''' endfunction From 7271cb91ba0eccb46182c0b307b66e24bc16f8eb Mon Sep 17 00:00:00 2001 From: Nicholas Schwab Date: Sun, 4 Jul 2021 19:55:06 +0200 Subject: [PATCH 3/3] Extract common part of success_cmd from differing OS. --- autoload/vimtex/compiler/latexmk.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/autoload/vimtex/compiler/latexmk.vim b/autoload/vimtex/compiler/latexmk.vim index 5003f131b5..01deea5fde 100644 --- a/autoload/vimtex/compiler/latexmk.vim +++ b/autoload/vimtex/compiler/latexmk.vim @@ -629,9 +629,10 @@ 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') - \ ? ' -e "$' . a:name . ' = ($' . a:name . ' ? $' . a:name . ' . '' ' . l:win_cmd_sep . ' '' : '''') . ''' . 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