xref: /vim-8.2.3635/runtime/syntax/rrst.vim (revision cf2d8dee)
1" reStructured Text with R statements
2" Language: reST with R code chunks
3" Maintainer: Alex Zvoleff, [email protected]
4" Homepage: https://github.com/jalvesaq/R-Vim-runtime
5" Last Change: Sat Feb 06, 2016  06:45AM
6"
7" CONFIGURATION:
8"   To highlight chunk headers as R code, put in your vimrc:
9"   let rrst_syn_hl_chunk = 1
10
11if exists("b:current_syntax")
12  finish
13endif
14
15" load all of the rst info
16runtime syntax/rst.vim
17unlet b:current_syntax
18
19" load all of the r syntax highlighting rules into @R
20syntax include @R syntax/r.vim
21
22setlocal iskeyword=@,48-57,_,.
23
24" highlight R chunks
25if exists("g:rrst_syn_hl_chunk")
26  " highlight R code inside chunk header
27  syntax match rrstChunkDelim "^\.\. {r" contained
28  syntax match rrstChunkDelim "}$" contained
29else
30  syntax match rrstChunkDelim "^\.\. {r .*}$" contained
31endif
32syntax match rrstChunkDelim "^\.\. \.\.$" contained
33syntax region rrstChunk start="^\.\. {r.*}$" end="^\.\. \.\.$" contains=@R,rrstChunkDelim keepend transparent fold
34
35" also highlight in-line R code
36syntax match rrstInlineDelim "`" contained
37syntax match rrstInlineDelim ":r:" contained
38syntax region rrstInline start=":r: *`" skip=/\\\\\|\\`/ end="`" contains=@R,rrstInlineDelim keepend
39
40hi def link rrstChunkDelim Special
41hi def link rrstInlineDelim Special
42
43let b:current_syntax = "rrst"
44
45" vim: ts=8 sw=2
46