Mercurial > vim
annotate runtime/syntax/rmd.vim @ 8967:df5f9284fcba v7.4.1769
commit https://github.com/vim/vim/commit/6d4431e7b675ba7a0194c0b8eb84b7d92e4e7953
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Apr 21 20:00:56 2016 +0200
patch 7.4.1769
Problem: No "closed", "errors" and "encoding" attribute on Python output.
Solution: Add attributes and more tests. (Roland Puntaier, closes https://github.com/vim/vim/issues/622)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 21 Apr 2016 20:15:05 +0200 |
parents | da01d5da2cfa |
children | 03fa8a51e9dc |
rev | line source |
---|---|
6051 | 1 " markdown Text with R statements |
2 " Language: markdown with R code chunks | |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6051
diff
changeset
|
3 " Homepage: https://github.com/jalvesaq/R-Vim-runtime |
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6051
diff
changeset
|
4 " Last Change: Sat Feb 06, 2016 06:45AM |
6051 | 5 " |
6 " CONFIGURATION: | |
7 " To highlight chunk headers as R code, put in your vimrc: | |
8 " let rmd_syn_hl_chunk = 1 | |
9 | |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6051
diff
changeset
|
10 if exists("b:current_syntax") |
6051 | 11 finish |
12 endif | |
13 | |
14 " load all of pandoc info | |
15 runtime syntax/pandoc.vim | |
16 if exists("b:current_syntax") | |
17 let rmdIsPandoc = 1 | |
18 unlet b:current_syntax | |
19 else | |
20 let rmdIsPandoc = 0 | |
21 runtime syntax/markdown.vim | |
22 if exists("b:current_syntax") | |
23 unlet b:current_syntax | |
24 endif | |
25 endif | |
26 | |
27 " load all of the r syntax highlighting rules into @R | |
28 syntax include @R syntax/r.vim | |
29 if exists("b:current_syntax") | |
30 unlet b:current_syntax | |
31 endif | |
32 | |
33 if exists("g:rmd_syn_hl_chunk") | |
34 " highlight R code inside chunk header | |
35 syntax match rmdChunkDelim "^[ \t]*```{r" contained | |
36 syntax match rmdChunkDelim "}$" contained | |
37 else | |
38 syntax match rmdChunkDelim "^[ \t]*```{r.*}$" contained | |
39 endif | |
40 syntax match rmdChunkDelim "^[ \t]*```$" contained | |
41 syntax region rmdChunk start="^[ \t]*``` *{r.*}$" end="^[ \t]*```$" contains=@R,rmdChunkDelim keepend fold | |
42 | |
43 " also match and syntax highlight in-line R code | |
44 syntax match rmdEndInline "`" contained | |
45 syntax match rmdBeginInline "`r " contained | |
46 syntax region rmdrInline start="`r " end="`" contains=@R,rmdBeginInline,rmdEndInline keepend | |
47 | |
48 " match slidify special marker | |
49 syntax match rmdSlidifySpecial "\*\*\*" | |
50 | |
51 | |
52 if rmdIsPandoc == 0 | |
53 syn match rmdBlockQuote /^\s*>.*\n\(.*\n\@<!\n\)*/ skipnl | |
54 " LaTeX | |
55 syntax include @LaTeX syntax/tex.vim | |
56 if exists("b:current_syntax") | |
57 unlet b:current_syntax | |
58 endif | |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6051
diff
changeset
|
59 " Extend cluster |
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6051
diff
changeset
|
60 syn cluster texMathZoneGroup add=rmdrInline |
6051 | 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 |