2

When I use vim-latexsuite to indent my .Rnw files, the Sweave blocks get indented, which causes them not to work properly. What I need is a way to ensure that the vim indent scheme puts these blocks at start of lines. The emacs mode does this well, but I'm trying out vim lately, and would like to have vim work properly as well.

I have only minimal skill with vim, and am not sure how to edit my ~/.vim/indent/tex.vim file to handle this. Any ideas? It seems to me that the indentation is being set after lines are formatted (i.e. getting ready for the next line), which doesn't help. But, as I say, I'm just learning about vim, so I may be all off-kilter [kind of like my resultant Rnw file :-)]

2
  • Indentation causes the R code not to work? I didn't think indentation mattered in R...
    – Seamus
    Jan 14 '11 at 13:47
  • @Seamus: thanks for the comment. The procedure is to get R to scan the file, using the "Sweave" command. That command passes all normal text through to a .tex file, except for blocks that start with ^<<.*>>== (a regular expression that starts at column 1). In other words, R demands that these codes start at column 1 of the file. This is by design, because it lets you enter such content at other columns without triggering Sweave. (By the way, what happens for these special blocks is that R runs them, and it puts the R output into the tex file.)
    – dank
    Jan 15 '11 at 15:31
1

The update to vim's R plugin now works fine, as of yesterday. The author found a problem that, as I understand it, had to do with interactions with the tex plugin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.