(summary below) I installed Vim and R using the Vim-R plugin and it works flawlessly. I also use Latex-suite in Vim and can create, compile and view .tex files without any problems. For knitr, I used Rstudio, but I really would like to stay in Vim. I'm just starting to work with the vim-latex package, so maybe I am missing something basic, but something is not working in my combination of Vim + Latex-Suite + knitr.
Following Associating .Rnw with vim latex suite , I included in my vimrc that .Rnw files should be read as .tex files (although someone stated in a comment that it should be automated in vim-r-plug-in in 2011, but itβs not: the filetype was originally discovered as rnoweb, and when I tried to compile it made a mistake saying that I was trying to compile non-.tex).
Now, if I use the following code as a .Rnw file:
\title{Data analysis} \begin{document} \maketitle \Section{Introduction} Some text as introduction \end{document}
It compiles without a problem. When i turn on
<<>>= 1 + 1 @
It compiles, however it prints on
!! ?? = 1 + 1
@
without block color and! and? turned up. And when I include a comment ( # comment ), it returns an error message
You cannot use the macro symbol # in vertical mode
but it compiles and prints like
A comment
When I run away from it with \ , an error is not displayed and prints
# a comment
I am using macvim 7.4 and updated all plugins (installed / updated using Bundle) and R 3.1.2 (latest update).
So, in summary: vim + r works, vim + latex works, but vim + r + latex does not work. R-code is not executed, and comments are not displayed correctly.
If someone can point me in the right direction, it will be appreciated!