annotate runtime/syntax/rmd.vim @ 33297:6340c608ca54 v9.0.1914

patch 9.0.1914: Vim9: few issues when accessing object members Commit: https://github.com/vim/vim/commit/1db151436541a3e64cdd5e3d9eb3ace1ce1e1ad0 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Tue Sep 19 20:34:05 2023 +0200 patch 9.0.1914: Vim9: few issues when accessing object members Problem: Vim9: few issues when accessing object members Solution: When calling an object method, check for null object. Accessing a Dict object member doesn't work. closes: #13119 closes: #13123 closes: #13124 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author Christian Brabandt <cb@256bit.org>
date Tue, 19 Sep 2023 20:45:06 +0200
parents d46f974fd69e
children 033f22d4a52a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
1 " Language: Markdown with chunks of R, Python and other languages
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
2 " Maintainer: Jakson Aquino <jalvesaq@gmail.com>
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
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
4 " Last Change: Fri Feb 24, 2023 08:28AM
11347
4aae8146c21f Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
5 "
4aae8146c21f Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
6 " For highlighting pandoc extensions to markdown like citations and TeX and
4aae8146c21f Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
7 " many other advanced features like folding of markdown sections, it is
4aae8146c21f Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
8 " recommended to install the vim-pandoc filetype plugin as well as the
4aae8146c21f Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
9 " vim-pandoc-syntax filetype plugin from https://github.com/vim-pandoc.
14637
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
10
6051
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11
8497
da01d5da2cfa commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents: 6051
diff changeset
12 if exists("b:current_syntax")
6051
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
13 finish
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14 endif
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
15
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
16 let s:cpo_save = &cpo
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
17 set cpo&vim
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
18
24520
5bda4653aced Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 16610
diff changeset
19 " Highlight the header of the chunks as R code
5bda4653aced Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 16610
diff changeset
20 let g:rmd_syn_hl_chunk = get(g:, 'rmd_syn_hl_chunk', 0)
14637
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
21
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
22 " Pandoc-syntax has more features, but it is slower.
11347
4aae8146c21f Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 9975
diff changeset
23 " https://github.com/vim-pandoc/vim-pandoc-syntax
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
24
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
25 " Don't waste time loading syntax that will be discarded:
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
26 let s:save_pandoc_lngs = get(g:, 'pandoc#syntax#codeblocks#embeds#langs', [])
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
27 let g:pandoc#syntax#codeblocks#embeds#langs = []
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
28
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
29 " Step_1: Source pandoc.vim if it is installed:
6051
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30 runtime syntax/pandoc.vim
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
31 if exists("b:current_syntax")
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
32 if hlexists('pandocDelimitedCodeBlock')
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
33 syn clear pandocDelimitedCodeBlock
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
34 endif
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
35
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
36 if len(s:save_pandoc_lngs) > 0 && !exists('g:rmd_fenced_languages')
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
37 let g:rmd_fenced_languages = deepcopy(s:save_pandoc_lngs)
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
38 endif
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
39
24520
5bda4653aced Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 16610
diff changeset
40 " Recognize inline R code
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
41 syn region rmdrInline matchgroup=rmdInlineDelim start="`r " end="`" contains=@Rmdr containedin=pandocLaTeXRegion,yamlFlowString keepend
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
42 else
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
43 " Step_2: Source markdown.vim if pandoc.vim is not installed
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
44
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
45 " Configuration if not using pandoc syntax:
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
46 " Add syntax highlighting of YAML header
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
47 let g:rmd_syn_hl_yaml = get(g:, 'rmd_syn_hl_yaml', 1)
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
48 " Add syntax highlighting of citation keys
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
49 let g:rmd_syn_hl_citations = get(g:, 'rmd_syn_hl_citations', 1)
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
50
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
51 " R chunks will not be highlighted by syntax/markdown because their headers
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
52 " follow a non standard pattern: "```{lang" instead of "^```lang".
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
53 " Make a copy of g:markdown_fenced_languages to highlight the chunks later:
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
54 if exists('g:markdown_fenced_languages') && !exists('g:rmd_fenced_languages')
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
55 let g:rmd_fenced_languages = deepcopy(g:markdown_fenced_languages)
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
56 endif
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
57
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
58 if exists('g:markdown_fenced_languages') && len(g:markdown_fenced_languages) > 0
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
59 let s:save_mfl = deepcopy(g:markdown_fenced_languages)
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
60 endif
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
61 " Don't waste time loading syntax that will be discarded:
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
62 let g:markdown_fenced_languages = []
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
63 runtime syntax/markdown.vim
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
64 if exists('s:save_mfl') > 0
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
65 let g:markdown_fenced_languages = deepcopy(s:save_mfl)
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
66 unlet s:save_mfl
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
67 endif
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
68 syn region rmdrInline matchgroup=rmdInlineDelim start="`r " end="`" contains=@Rmdr keepend
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
69
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
70 " Step_2a: Add highlighting for both YAML and citations which are pandoc
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
71 " specific, but also used in Rmd files
24520
5bda4653aced Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 16610
diff changeset
72
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
73 " You don't need this if either your markdown/syntax.vim already highlights
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
74 " the YAML header or you are writing standard markdown
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
75 if g:rmd_syn_hl_yaml
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
76 " Basic highlighting of YAML header
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
77 syn match rmdYamlFieldTtl /^\s*\zs\w\%(-\|\w\)*\ze:/ contained
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
78 syn match rmdYamlFieldTtl /^\s*-\s*\zs\w\%(-\|\w\)*\ze:/ contained
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
79 syn region yamlFlowString matchgroup=yamlFlowStringDelimiter start='"' skip='\\"' end='"' contains=yamlEscape,rmdrInline contained
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
80 syn region yamlFlowString matchgroup=yamlFlowStringDelimiter start="'" skip="''" end="'" contains=yamlSingleEscape,rmdrInline contained
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
81 syn match yamlEscape contained '\\\%([\\"abefnrtv\^0_ NLP\n]\|x\x\x\|u\x\{4}\|U\x\{8}\)'
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
82 syn match yamlSingleEscape contained "''"
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
83 syn match yamlComment /#.*/ contained
32974
d46f974fd69e runtime: Fix typos in various files
Christian Brabandt <cb@256bit.org>
parents: 32061
diff changeset
84 " A second colon is a syntax error, unless within a string or following !expr
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
85 syn match yamlColonError /:\s*[^'^"^!]*:/ contained
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
86 if &filetype == 'quarto'
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
87 syn region pandocYAMLHeader matchgroup=rmdYamlBlockDelim start=/\%(\%^\|\_^\s*\n\)\@<=\_^-\{3}\ze\n.\+/ end=/^---$/ keepend contains=rmdYamlFieldTtl,yamlFlowString,yamlComment,yamlColonError
24520
5bda4653aced Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 16610
diff changeset
88 else
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
89 syn region pandocYAMLHeader matchgroup=rmdYamlBlockDelim start=/\%(\%^\|\_^\s*\n\)\@<=\_^-\{3}\ze\n.\+/ end=/^\([-.]\)\1\{2}$/ keepend contains=rmdYamlFieldTtl,yamlFlowString,yamlComment,yamlColonError
24520
5bda4653aced Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 16610
diff changeset
90 endif
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
91 hi def link rmdYamlBlockDelim Delimiter
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
92 hi def link rmdYamlFieldTtl Identifier
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
93 hi def link yamlFlowString String
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
94 hi def link yamlComment Comment
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
95 hi def link yamlColonError Error
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
96 endif
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
97
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
98 " You don't need this if either your markdown/syntax.vim already highlights
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
99 " citations or you are writing standard markdown
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
100 if g:rmd_syn_hl_citations
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
101 " From vim-pandoc-syntax
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
102 " parenthetical citations
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
103 syn match pandocPCite /\^\@<!\[[^\[\]]\{-}-\{0,1}@[[:alnum:]_][[:alnum:]à-öø-ÿÀ-ÖØ-ß_:.#$%&\-+?<>~\/]*.\{-}\]/ contains=pandocEmphasis,pandocStrong,pandocLatex,pandocCiteKey,@Spell,pandocAmpersandEscape display
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
104 " in-text citations with location
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
105 syn match pandocICite /@[[:alnum:]_][[:alnum:]à-öø-ÿÀ-ÖØ-ß_:.#$%&\-+?<>~\/]*\s\[.\{-1,}\]/ contains=pandocCiteKey,@Spell display
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
106 " cite keys
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
107 syn match pandocCiteKey /\(-\=@[[:alnum:]_][[:alnum:]à-öø-ÿÀ-ÖØ-ß_:.#$%&\-+?<>~\/]*\)/ containedin=pandocPCite,pandocICite contains=@NoSpell display
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
108 syn match pandocCiteAnchor /[-@]/ contained containedin=pandocCiteKey display
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
109 syn match pandocCiteLocator /[\[\]]/ contained containedin=pandocPCite,pandocICite
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
110 hi def link pandocPCite Operator
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
111 hi def link pandocICite Operator
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
112 hi def link pandocCiteKey Label
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
113 hi def link pandocCiteAnchor Operator
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
114 hi def link pandocCiteLocator Operator
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
115 endif
6051
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
116 endif
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
117
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
118 " Step_3: Highlight code blocks.
14637
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
119
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
120 syn region rmdCodeBlock matchgroup=rmdCodeDelim start="^\s*```\s*{.*}$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
121 syn region rmdCodeBlock matchgroup=rmdCodeDelim start="^\s*```.+$" matchgroup=rmdCodeDelim end="^```$" keepend
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
122 hi link rmdCodeBlock Special
6051
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
123
14637
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
124 " Now highlight chunks:
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
125 syn region knitrBodyOptions start='^#| ' end='$' contained containedin=rComment,pythonComment contains=knitrBodyVar,knitrBodyValue transparent
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
126 syn match knitrBodyValue ': \zs.*\ze$' keepend contained containedin=knitrBodyOptions
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
127 syn match knitrBodyVar '| \zs\S\{-}\ze:' contained containedin=knitrBodyOptions
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
128
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
129 let g:rmd_fenced_languages = get(g:, 'rmd_fenced_languages', ['r'])
14637
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
130 for s:type in g:rmd_fenced_languages
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
131 if s:type =~ '='
16610
1eaf34420bb3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14637
diff changeset
132 let s:ft = substitute(s:type, '.*=', '', '')
1eaf34420bb3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14637
diff changeset
133 let s:nm = substitute(s:type, '=.*', '', '')
14637
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
134 else
16610
1eaf34420bb3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14637
diff changeset
135 let s:ft = s:type
14637
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
136 let s:nm = s:type
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
137 endif
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
138 unlet! b:current_syntax
16610
1eaf34420bb3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14637
diff changeset
139 exe 'syn include @Rmd'.s:nm.' syntax/'.s:ft.'.vim'
14637
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
140 if g:rmd_syn_hl_chunk
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
141 exe 'syn match knitrChunkDelim /```\s*{\s*'.s:nm.'/ contained containedin=knitrChunkBrace contains=knitrChunkLabel'
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
142 exe 'syn match knitrChunkLabelDelim /```\s*{\s*'.s:nm.',\=\s*[-[:alnum:]]\{-1,}[,}]/ contained containedin=knitrChunkBrace'
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
143 syn match knitrChunkDelim /}\s*$/ contained containedin=knitrChunkBrace
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
144 exe 'syn match knitrChunkBrace /```\s*{\s*'.s:nm.'.*$/ contained containedin=rmd'.s:nm.'Chunk contains=knitrChunkDelim,knitrChunkLabelDelim,@Rmd'.s:nm
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
145 exe 'syn region rmd'.s:nm.'Chunk start="^\s*```\s*{\s*=\?'.s:nm.'\>.*$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend contains=knitrChunkBrace,@Rmd'.s:nm
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
146
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
147 hi link knitrChunkLabel Identifier
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
148 hi link knitrChunkDelim rmdCodeDelim
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
149 hi link knitrChunkLabelDelim rmdCodeDelim
14637
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
150 else
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
151 exe 'syn region rmd'.s:nm.'Chunk matchgroup=rmdCodeDelim start="^\s*```\s*{\s*=\?'.s:nm.'\>.*$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend contains=@Rmd'.s:nm
6051
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
152 endif
14637
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
153 endfor
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
154 unlet! s:type
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
155
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
156 " Step_4: Highlight code recognized by pandoc but not defined in pandoc.vim yet:
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
157 syn match pandocDivBegin '^:::\+ {.\{-}}' contains=pandocHeaderAttr
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
158 syn match pandocDivEnd '^:::\+$'
24520
5bda4653aced Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 16610
diff changeset
159
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
160 hi def link knitrBodyVar PreProc
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
161 hi def link knitrBodyValue Constant
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
162 hi def link knitrBodyOptions rComment
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
163 hi def link pandocDivBegin Delimiter
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
164 hi def link pandocDivEnd Delimiter
14637
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
165 hi def link rmdInlineDelim Delimiter
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
166 hi def link rmdCodeDelim Delimiter
0ecb909e3249 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11347
diff changeset
167
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
168 if len(s:save_pandoc_lngs)
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
169 let g:pandoc#syntax#codeblocks#embeds#langs = s:save_pandoc_lngs
6051
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
170 endif
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
171 unlet s:save_pandoc_lngs
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
172 let &cpo = s:cpo_save
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24520
diff changeset
173 unlet s:cpo_save
6051
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
174
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
175 let b:current_syntax = "rmd"
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
176
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
177 " vim: ts=8 sw=2