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: Tue Jun 28, 2016 08:53AM 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 22" highlight R chunks 23if exists("g:rrst_syn_hl_chunk") 24 " highlight R code inside chunk header 25 syntax match rrstChunkDelim "^\.\. {r" contained 26 syntax match rrstChunkDelim "}$" contained 27else 28 syntax match rrstChunkDelim "^\.\. {r .*}$" contained 29endif 30syntax match rrstChunkDelim "^\.\. \.\.$" contained 31syntax region rrstChunk start="^\.\. {r.*}$" end="^\.\. \.\.$" contains=@R,rrstChunkDelim keepend transparent fold 32 33" also highlight in-line R code 34syntax match rrstInlineDelim "`" contained 35syntax match rrstInlineDelim ":r:" contained 36syntax region rrstInline start=":r: *`" skip=/\\\\\|\\`/ end="`" contains=@R,rrstInlineDelim keepend 37 38hi def link rrstChunkDelim Special 39hi def link rrstInlineDelim Special 40 41let b:current_syntax = "rrst" 42 43" vim: ts=8 sw=2 44