[R] VIM Syntax Highlighting

Christophe Declercq cdeclercq at nordnet.fr
Mon Mar 10 11:21:33 CET 2003

Hi, Fernando

> -----Message d'origine-----
> De : r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch]De la part de Fernando Henrique
> Ferraz Pereira da Rosa
> Envoyé : lundi 10 mars 2003 01:52
> À : r-help at stat.math.ethz.ch
> Objet : [R] VIM Syntax Highlighting
>      Has anyone got vim to have syntax highlighting with R
> function codes? I
> know there's something similar that works with emacs (ESS or
> something like
> that), but I was wondering if anyone knew an equivalent that
> worked with vim.

I use the MS-WINDOWS port of vim version 6, which has a syntax file for R by
Tom Payne (see http://linux.clare.cam.ac.uk/~twp20/vim/syntax/r.vim).

You can also use both TeX and R syntax in Sweave files. Below is what I use
in my 'noweb.vim' file:

syntax clear
runtime! syntax/tex.vim
syntax include @nowebR syntax/r.vim
syntax region nowebChunk start="^<<.*>>=" end="^@ " contains=@nowebR
syntax region Sexpr  start="\\Sexpr{"  end="}" keepend
hi Sexpr gui=bold guifg=chocolate2

Hope it helps.

Christophe DECLERCQ, MD
Observatoire Régional de la Santé Nord-Pas-de-Calais
13, rue Faidherbe 59046 LILLE Cedex FRANCE
Phone +33 3 20 15 49 24
Fax   +33 3 20 55 92 30
E-mail c.declercq at orsnpdc.org

More information about the R-help mailing list