mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			86 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			VimL
		
	
	
	
	
	
			
		
		
	
	
			86 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			VimL
		
	
	
	
	
	
| " markdown Text with R statements
 | |
| " Language: markdown with R code chunks
 | |
| " Homepage: https://github.com/jalvesaq/R-Vim-runtime
 | |
| " Last Change: Tue Jun 28, 2016  10:09AM
 | |
| "
 | |
| " CONFIGURATION:
 | |
| "   To highlight chunk headers as R code, put in your vimrc:
 | |
| "   let rmd_syn_hl_chunk = 1
 | |
| 
 | |
| if 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
 | |
|   " Extend cluster
 | |
|   syn cluster texMathZoneGroup add=rmdrInline
 | |
|   " 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
 | |
| 
 | |
| 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
 | 
