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

RMarkdown not working on Windows system #34

Open
santibreo opened this issue Jul 27, 2020 · 2 comments
Open

RMarkdown not working on Windows system #34

santibreo opened this issue Jul 27, 2020 · 2 comments

Comments

@santibreo
Copy link

Hi,

I am using your plugin with both vim-pandoc and vim-pandoc-syntax as they are required but I can't compile the Rmarkdown documents into any format because I am working with a Windows computer (we all hate Windows but we all need to work for a living). The error is pretty straightforward: the vim function expand("%:p") that you are using in vim-rmarkdown/autoload/rmarkdown/command.vim (lines 89 and 94) gives the file path using single backslashes which R interprets as if they were escaping characters. The minimal-effort-but-not-so-elegant workaround that I have found is:

45  -   let @9 = @+
46  -   let @+ = expand("%:p")
...
87 -    if output_type == "revealjs_presentation"
88 -        let invocation = 'Rscript -e "library(rmarkdown);library(revealjs);render('. 
89 -                        \ 'readClipboard(), '. 
90 -                        \ 'revealjs_presentation()' .
91 -                        \ render_opts.')"'
92 -    else
93 -        let invocation = 'Rscript -e "library(rmarkdown);render('. 
94 -                    \ 'readClipboard(), '. 
95 -                    \ output_type_arg .
96 -                    \ render_opts.')"'
97 -    endif
...
123-   let @+=@9 

This way it should work but now I am getting:

Error: Unrecognized output format specified

Which is because R is not understanding the format type \"html_output\". Any idea about how to solve this?

Thanks a lot!

@santibreo
Copy link
Author

I have found a solution myself. It is not the most elegant but it works. All my problems are related with the use of single and double quotes, once the Windows backslash issue has been solved.

I added a version of command.vim with minimal changes that is actually working for me (saved as txt to upload, but its extension is vim).
my_version.txt

@alerque
Copy link
Member

alerque commented Jul 29, 2020

Can you submit this directly as a PR so that we we can see how tests run, whether other users can run it, and compare how it works on *nix? We can easily iterato on a PR, it's not really feasible to iterate throwing files around like this.

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

No branches or pull requests

2 participants