Mercurial > vim
comparison runtime/syntax/rmd.vim @ 6051:0efec12f52ac
Updated runtime files.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Thu, 10 Jul 2014 22:01:47 +0200 |
parents | |
children | da01d5da2cfa |
comparison
equal
deleted
inserted
replaced
6050:f5c7483cbbb4 | 6051:0efec12f52ac |
---|---|
1 " markdown Text with R statements | |
2 " Language: markdown with R code chunks | |
3 " Last Change: Wed Jul 09, 2014 10:29PM | |
4 " | |
5 " CONFIGURATION: | |
6 " To highlight chunk headers as R code, put in your vimrc: | |
7 " let rmd_syn_hl_chunk = 1 | |
8 | |
9 " for portability | |
10 if version < 600 | |
11 syntax clear | |
12 elseif exists("b:current_syntax") | |
13 finish | |
14 endif | |
15 | |
16 " load all of pandoc info | |
17 runtime syntax/pandoc.vim | |
18 if exists("b:current_syntax") | |
19 let rmdIsPandoc = 1 | |
20 unlet b:current_syntax | |
21 else | |
22 let rmdIsPandoc = 0 | |
23 runtime syntax/markdown.vim | |
24 if exists("b:current_syntax") | |
25 unlet b:current_syntax | |
26 endif | |
27 endif | |
28 | |
29 " load all of the r syntax highlighting rules into @R | |
30 syntax include @R syntax/r.vim | |
31 if exists("b:current_syntax") | |
32 unlet b:current_syntax | |
33 endif | |
34 | |
35 if exists("g:rmd_syn_hl_chunk") | |
36 " highlight R code inside chunk header | |
37 syntax match rmdChunkDelim "^[ \t]*```{r" contained | |
38 syntax match rmdChunkDelim "}$" contained | |
39 else | |
40 syntax match rmdChunkDelim "^[ \t]*```{r.*}$" contained | |
41 endif | |
42 syntax match rmdChunkDelim "^[ \t]*```$" contained | |
43 syntax region rmdChunk start="^[ \t]*``` *{r.*}$" end="^[ \t]*```$" contains=@R,rmdChunkDelim keepend fold | |
44 | |
45 " also match and syntax highlight in-line R code | |
46 syntax match rmdEndInline "`" contained | |
47 syntax match rmdBeginInline "`r " contained | |
48 syntax region rmdrInline start="`r " end="`" contains=@R,rmdBeginInline,rmdEndInline keepend | |
49 | |
50 " match slidify special marker | |
51 syntax match rmdSlidifySpecial "\*\*\*" | |
52 | |
53 | |
54 if rmdIsPandoc == 0 | |
55 syn match rmdBlockQuote /^\s*>.*\n\(.*\n\@<!\n\)*/ skipnl | |
56 " LaTeX | |
57 syntax include @LaTeX syntax/tex.vim | |
58 if exists("b:current_syntax") | |
59 unlet b:current_syntax | |
60 endif | |
61 " Inline | |
62 syntax match rmdLaTeXInlDelim "\$" | |
63 syntax match rmdLaTeXInlDelim "\\\$" | |
64 syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup | |
65 " Region | |
66 syntax match rmdLaTeXRegDelim "\$\$" contained | |
67 syntax match rmdLaTeXRegDelim "\$\$latex$" contained | |
68 syntax region rmdLaTeXRegion start="^\$\$" skip="\\\$" end="\$\$$" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend | |
69 syntax region rmdLaTeXRegion2 start="^\\\[" end="\\\]" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend | |
70 hi def link rmdLaTeXSt Statement | |
71 hi def link rmdLaTeXInlDelim Special | |
72 hi def link rmdLaTeXRegDelim Special | |
73 endif | |
74 | |
75 setlocal iskeyword=@,48-57,_,. | |
76 | |
77 syn sync match rmdSyncChunk grouphere rmdChunk "^[ \t]*``` *{r" | |
78 | |
79 hi def link rmdChunkDelim Special | |
80 hi def link rmdBeginInline Special | |
81 hi def link rmdEndInline Special | |
82 hi def link rmdBlockQuote Comment | |
83 hi def link rmdSlidifySpecial Special | |
84 | |
85 let b:current_syntax = "rmd" | |
86 | |
87 " vim: ts=8 sw=2 |