aboutsummaryrefslogtreecommitdiff
path: root/runtime/syntax/rmd.vim
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-07-11 04:05:51 +0000
committerJustin M. Keyes <justinkz@gmail.com>2014-07-29 02:12:31 +0000
commita98a6996c291b3e300d27b791eded9eed333d677 (patch)
tree51d92f6cac128f938cd0aaa9a8dd0ce7a83d63a9 /runtime/syntax/rmd.vim
parent66bc13163398786c88e20b7cdd61c66978b4d3fb (diff)
downloadrneovim-a98a6996c291b3e300d27b791eded9eed333d677.tar.gz
rneovim-a98a6996c291b3e300d27b791eded9eed333d677.tar.bz2
rneovim-a98a6996c291b3e300d27b791eded9eed333d677.zip
re-integrate runtime/ vim-patch:0 #938
Vim runtime files based on 7.4.384 / hg changeset 7090d7f160f7 Excluding: Amiga icons (*.info, icons/) doc/hangulin.txt tutor/ spell/ lang/ (only used for menu translations) macros/maze/, macros/hanoi/, macros/life/, macros/urm/ These were used to test vi compatibility. termcap "Demonstration of a termcap file (for the Amiga and Archimedes)" Helped-by: Rich Wareham <rjw57@cam.ac.uk> Helped-by: John <john.schmidt.h@gmail.com> Helped-by: Yann <yann@yann-salaun.com> Helped-by: Christophe Badoit <c.badoit@lesiteimmo.com> Helped-by: drasill <github@tof2k.com> Helped-by: Tae Sandoval Murgan <taecilla@gmail.com> Helped-by: Lowe Thiderman <lowe.thiderman@gmail.com>
Diffstat (limited to 'runtime/syntax/rmd.vim')
-rw-r--r--runtime/syntax/rmd.vim87
1 files changed, 87 insertions, 0 deletions
diff --git a/runtime/syntax/rmd.vim b/runtime/syntax/rmd.vim
new file mode 100644
index 0000000000..6f1b847453
--- /dev/null
+++ b/runtime/syntax/rmd.vim
@@ -0,0 +1,87 @@
+" markdown Text with R statements
+" Language: markdown with R code chunks
+" Last Change: Wed Jul 09, 2014 10:29PM
+"
+" CONFIGURATION:
+" To highlight chunk headers as R code, put in your vimrc:
+" let rmd_syn_hl_chunk = 1
+
+" for portability
+if version < 600
+ syntax clear
+elseif exists("b:current_syntax")
+ finish
+endif
+
+" load all of pandoc info
+runtime syntax/pandoc.vim
+if exists("b:current_syntax")
+ let rmdIsPandoc = 1
+ unlet b:current_syntax
+else
+ let rmdIsPandoc = 0
+ runtime syntax/markdown.vim
+ if exists("b:current_syntax")
+ unlet b:current_syntax
+ endif
+endif
+
+" load all of the r syntax highlighting rules into @R
+syntax include @R syntax/r.vim
+if exists("b:current_syntax")
+ unlet b:current_syntax
+endif
+
+if exists("g:rmd_syn_hl_chunk")
+ " highlight R code inside chunk header
+ syntax match rmdChunkDelim "^[ \t]*```{r" contained
+ syntax match rmdChunkDelim "}$" contained
+else
+ syntax match rmdChunkDelim "^[ \t]*```{r.*}$" contained
+endif
+syntax match rmdChunkDelim "^[ \t]*```$" contained
+syntax region rmdChunk start="^[ \t]*``` *{r.*}$" end="^[ \t]*```$" contains=@R,rmdChunkDelim keepend fold
+
+" also match and syntax highlight in-line R code
+syntax match rmdEndInline "`" contained
+syntax match rmdBeginInline "`r " contained
+syntax region rmdrInline start="`r " end="`" contains=@R,rmdBeginInline,rmdEndInline keepend
+
+" match slidify special marker
+syntax match rmdSlidifySpecial "\*\*\*"
+
+
+if rmdIsPandoc == 0
+ syn match rmdBlockQuote /^\s*>.*\n\(.*\n\@<!\n\)*/ skipnl
+ " LaTeX
+ syntax include @LaTeX syntax/tex.vim
+ if exists("b:current_syntax")
+ unlet b:current_syntax
+ endif
+ " Inline
+ syntax match rmdLaTeXInlDelim "\$"
+ syntax match rmdLaTeXInlDelim "\\\$"
+ syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup
+ " Region
+ syntax match rmdLaTeXRegDelim "\$\$" contained
+ syntax match rmdLaTeXRegDelim "\$\$latex$" contained
+ syntax region rmdLaTeXRegion start="^\$\$" skip="\\\$" end="\$\$$" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend
+ syntax region rmdLaTeXRegion2 start="^\\\[" end="\\\]" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend
+ hi def link rmdLaTeXSt Statement
+ hi def link rmdLaTeXInlDelim Special
+ hi def link rmdLaTeXRegDelim Special
+endif
+
+setlocal iskeyword=@,48-57,_,.
+
+syn sync match rmdSyncChunk grouphere rmdChunk "^[ \t]*``` *{r"
+
+hi def link rmdChunkDelim Special
+hi def link rmdBeginInline Special
+hi def link rmdEndInline Special
+hi def link rmdBlockQuote Comment
+hi def link rmdSlidifySpecial Special
+
+let b:current_syntax = "rmd"
+
+" vim: ts=8 sw=2