I have been a great fan of Vim with its awesome Vim-latex suite providing extremely useful keybindings and autocompletion features. Then I installed vim-r-plugin
and opened a .Rnw
Sweave file. While syntax highlighting and other R related features such as key shortcuts are working fine, LaTeX shortcuts no longer works. For example, if I type SSE
it longer gives \section{}
. But if I instead I open a .tex file, those shortcuts works just fine. I am using gVim 7.3 in windows 7. Any suggestions would be highly appreciated.
[Tex/LaTex] LaTeX Suite Autocompletion Feature Not working With Rnw file
editorssweavevim
Best Answer
You need to associate the .Rnw files with tex.
The most direct way to do this is to issue the following command with the open .Rnw file:
As soon as you have done that the vim-latex behaviour you are used to should be back. To incorporate this in a nice way in your vimrc is described here in a stackoverflow question. To wit:
Plugins are associated with a filetype, and as far as I know a file can have only one filetype at any particular time (otherwise you could have clashes between the various plugin functionalities, UltiSnips would not know which snipps to offer etc.).
You can do this by hand of course, but if you want to avoid having to
set filetype=
every time you want to switch between the plugins associated with a filetype, you can use the following script in your .vimrc:You can set your own keyboard shortcut of course, by changing
<F12>
to something that works for you.