Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix problems with success_cmd on windows nvim. #2088

Closed
wants to merge 3 commits into from

Conversation

Nicholas42
Copy link
Contributor

Applied changes as suggested by @yongrenjie in #2084

@yongrenjie
Copy link
Contributor

I think, just to be safe, I should check what happens if &shell is different from the default, since that may affect how the command string is quoted... I'll do that when I can...

@Nicholas42
Copy link
Contributor Author

Yes, that seems like a good idea. One could also think about a parameter en/disabling this since it seems to be very fragile and not that important (though, personally I like it very much).

@yongrenjie
Copy link
Contributor

Yeah, sadly, adding

set shell=powershell
set shellcmdflag=-command

to init.vim gives this error

At line:1 char:13
+ "cmd /s /c "set max_print_line=2000 & latexmk -verbose -file-line-err ...
+             ~~~
Unexpected token 'set' in expression or statement.
At line:1 char:37
+ "cmd /s /c "set max_print_line=2000 & latexmk -verbose -file-line-err ...
+                                     ~
The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double 
quotation marks ("&") to pass it as part of a string.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

But this ampersand is already part of the existing code, and wasn't introduced by this PR. So it's probably not our/your problem to fix. :-)

@yongrenjie
Copy link
Contributor

And I just noticed :h vimtex-faq-windows says to not change &shell anyway, so I guess that's not really a problem.

@lervag
Copy link
Owner

lervag commented Jul 4, 2021

Thanks for this, and for the discussion. As I'm not a Windows user, I really do depend on the contribution of others to help make VimTeX work well on Windows as well - it is much appreciated!

lervag added a commit that referenced this pull request Jul 4, 2021
@lervag
Copy link
Owner

lervag commented Jul 4, 2021

Please note I also made a simple adjustment; see here:

function! s:wrap_option_appendcmd(name, value) abort " {{{1
" 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 = printf('$%s = ($%s ? $%s', a:name, a:name, a:name)
return has('win32')
\ ? printf(' -e "%s . '' %s '' : '''') . ''%s''"',
\ l:common, l:win_cmd_sep, a:value)
\ : printf(' -e ''%s . " ; " : "") . "%s"''',
\ l:common, a:value)
endfunction

I believe this should still work and I think it is slightly more readable. I also believe the comment makes more sense now. Can you confirm?

1 similar comment
@lervag
Copy link
Owner

lervag commented Jul 4, 2021

Please note I also made a simple adjustment; see here:

function! s:wrap_option_appendcmd(name, value) abort " {{{1
" 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 = printf('$%s = ($%s ? $%s', a:name, a:name, a:name)
return has('win32')
\ ? printf(' -e "%s . '' %s '' : '''') . ''%s''"',
\ l:common, l:win_cmd_sep, a:value)
\ : printf(' -e ''%s . " ; " : "") . "%s"''',
\ l:common, a:value)
endfunction

I believe this should still work and I think it is slightly more readable. I also believe the comment makes more sense now. Can you confirm?

@lervag lervag closed this Jul 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants