6051
|
1 " reStructured Text with R statements
|
|
2 " Language: reST with R code chunks
|
|
3 " Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu
|
|
4 " Last Change: Wed Jul 09, 2014 10:29PM
|
|
5 "
|
|
6 " CONFIGURATION:
|
|
7 " To highlight chunk headers as R code, put in your vimrc:
|
|
8 " let rrst_syn_hl_chunk = 1
|
|
9
|
|
10 " for portability
|
|
11 if version < 600
|
|
12 syntax clear
|
|
13 elseif exists("b:current_syntax")
|
|
14 finish
|
|
15 endif
|
|
16
|
|
17 " load all of the rst info
|
|
18 runtime syntax/rst.vim
|
|
19 unlet b:current_syntax
|
|
20
|
|
21 " load all of the r syntax highlighting rules into @R
|
|
22 syntax include @R syntax/r.vim
|
|
23
|
|
24 setlocal iskeyword=@,48-57,_,.
|
|
25
|
|
26 " highlight R chunks
|
|
27 if exists("g:rrst_syn_hl_chunk")
|
|
28 " highlight R code inside chunk header
|
|
29 syntax match rrstChunkDelim "^\.\. {r" contained
|
|
30 syntax match rrstChunkDelim "}$" contained
|
|
31 else
|
|
32 syntax match rrstChunkDelim "^\.\. {r .*}$" contained
|
|
33 endif
|
|
34 syntax match rrstChunkDelim "^\.\. \.\.$" contained
|
|
35 syntax region rrstChunk start="^\.\. {r.*}$" end="^\.\. \.\.$" contains=@R,rrstChunkDelim keepend transparent fold
|
|
36
|
|
37 " also highlight in-line R code
|
|
38 syntax match rrstInlineDelim "`" contained
|
|
39 syntax match rrstInlineDelim ":r:" contained
|
|
40 syntax region rrstInline start=":r: *`" skip=/\\\\\|\\`/ end="`" contains=@R,rrstInlineDelim keepend
|
|
41
|
|
42 hi def link rrstChunkDelim Special
|
|
43 hi def link rrstInlineDelim Special
|
|
44
|
|
45 let b:current_syntax = "rrst"
|
|
46
|
|
47 " vim: ts=8 sw=2
|