Mercurial > vim
annotate runtime/syntax/r.vim @ 13696:3b1cfbc70b43 v8.0.1720
patch 8.0.1720: when a timer is running a terminal window may not close
commit https://github.com/vim/vim/commit/802bfb14636b24d86d0ca8e0947d808b9b7c941e
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 15 17:28:13 2018 +0200
patch 8.0.1720: when a timer is running a terminal window may not close
Problem: When a timer is running a terminal window may not close after a
shell has exited.
Solution: Call job_status() more often.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 15 Apr 2018 17:30:07 +0200 |
parents | 4aae8146c21f |
children | 0ecb909e3249 |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
2 " Language: R (GNU S) |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
3 " Maintainer: Jakson Aquino <jalvesaq@gmail.com> |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
4 " Former Maintainers: Vaidotas Zemlys <zemlys@gmail.com> |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
5 " Tom Payne <tom@tompayne.org> |
7315
444efa5f5015
commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents:
6476
diff
changeset
|
6 " Contributor: Johannes Ranke <jranke@uni-bremen.de> |
444efa5f5015
commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents:
6476
diff
changeset
|
7 " Homepage: https://github.com/jalvesaq/R-Vim-runtime |
11347 | 8 " Last Change: Sat Apr 08, 2017 07:01PM |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
9 " Filenames: *.R *.r *.Rhistory *.Rt |
6476 | 10 " |
11347 | 11 " NOTE: The highlighting of R functions might be defined in |
6476 | 12 " runtime files created by a filetype plugin, if installed. |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
13 " |
2725 | 14 " CONFIGURATION: |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
7315
diff
changeset
|
15 " Syntax folding can be turned on by |
2725 | 16 " |
17 " let r_syntax_folding = 1 | |
18 " | |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
7315
diff
changeset
|
19 " ROxygen highlighting can be turned off by |
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
7315
diff
changeset
|
20 " |
11347 | 21 " let r_syntax_hl_roxygen = 0 |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
7315
diff
changeset
|
22 " |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
23 " Some lines of code were borrowed from Zhuojun Chen. |
625 | 24 |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
25 if exists("b:current_syntax") |
7 | 26 finish |
27 endif | |
28 | |
11347 | 29 if has("patch-7.4.1142") |
30 syn iskeyword @,48-57,_,. | |
31 else | |
32 setlocal iskeyword=@,48-57,_,. | |
33 endif | |
34 | |
35 " The variables g:r_hl_roxygen and g:r_syn_minlines were renamed on April 8, 2017. | |
36 if exists("g:r_hl_roxygen") | |
37 let g:r_syntax_hl_roxygen = g:r_hl_roxygen | |
38 endif | |
39 if exists("g:r_syn_minlines") | |
40 let g:r_syntax_minlines = g:r_syn_minlines | |
41 endif | |
7 | 42 |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
7315
diff
changeset
|
43 if exists("g:r_syntax_folding") && g:r_syntax_folding |
2725 | 44 setlocal foldmethod=syntax |
45 endif | |
11347 | 46 if !exists("g:r_syntax_hl_roxygen") |
47 let g:r_syntax_hl_roxygen = 1 | |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
7315
diff
changeset
|
48 endif |
2725 | 49 |
7 | 50 syn case match |
51 | |
52 " Comment | |
6051 | 53 syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):" |
7315
444efa5f5015
commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents:
6476
diff
changeset
|
54 syn match rComment contains=@Spell,rCommentTodo,rOBlock "#.*" |
4780 | 55 |
56 " Roxygen | |
11347 | 57 if g:r_syntax_hl_roxygen |
58 " A roxygen block can start at the beginning of a file (first version) and | |
59 " after a blank line (second version). It ends when a line that does not | |
60 " contain a roxygen comment. In the following comments, any line containing | |
61 " a roxygen comment marker (one or two hash signs # followed by a single | |
62 " quote ' and preceded only by whitespace) is called a roxygen line. A | |
63 " roxygen line containing only a roxygen comment marker, optionally followed | |
64 " by whitespace is called an empty roxygen line. | |
65 | |
66 " First we match all roxygen blocks as containing only a title. In case an | |
67 " empty roxygen line ending the title or a tag is found, this will be | |
68 " overriden later by the definitions of rOBlock. | |
69 syn match rOTitleBlock "\%^\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag | |
70 syn match rOTitleBlock "^\s*\n\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag | |
71 | |
72 " When a roxygen block has a title and additional content, the title | |
73 " consists of one or more roxygen lines (as little as possible are matched), | |
74 " followed either by an empty roxygen line | |
75 syn region rOBlock start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold | |
76 syn region rOBlock start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold | |
7315
444efa5f5015
commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents:
6476
diff
changeset
|
77 |
11347 | 78 " or by a roxygen tag (we match everything starting with @ but not @@ which is used as escape sequence for a literal @). |
79 syn region rOBlock start="\%^\(\s*#\{1,2}' .*\n\)\{-}\s*#\{1,2}' @\(@\)\@!" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold | |
80 syn region rOBlock start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-}\s*#\{1,2}' @\(@\)\@!" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold | |
81 | |
82 " If a block contains an @rdname, @describeIn tag, it may have paragraph breaks, but does not have a title | |
83 syn region rOBlockNoTitle start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @rdname" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold | |
84 syn region rOBlockNoTitle start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @rdname" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold | |
85 syn region rOBlockNoTitle start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @describeIn" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold | |
86 syn region rOBlockNoTitle start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @describeIn" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold | |
87 | |
88 " A title as part of a block is always at the beginning of the block, i.e. | |
89 " either at the start of a file or after a completely empty line. | |
90 syn match rOTitle "\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag | |
91 syn match rOTitle "^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag | |
92 syn match rOTitleTag contained "@title" | |
93 | |
94 syn match rOCommentKey "#\{1,2}'" contained | |
95 syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOTag fold | |
96 | |
97 " rOTag list generated from the lists in | |
98 " https://github.com/klutometis/roxygen/R/rd.R and | |
99 " https://github.com/klutometis/roxygen/R/namespace.R | |
100 " using s/^ \([A-Za-z0-9]*\) = .*/ syn match rOTag contained "@\1"/ | |
101 " Plus we need the @include tag | |
7315
444efa5f5015
commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents:
6476
diff
changeset
|
102 |
11347 | 103 " rd.R |
104 syn match rOTag contained "@aliases" | |
105 syn match rOTag contained "@author" | |
106 syn match rOTag contained "@backref" | |
107 syn match rOTag contained "@concept" | |
108 syn match rOTag contained "@describeIn" | |
109 syn match rOTag contained "@description" | |
110 syn match rOTag contained "@details" | |
111 syn match rOTag contained "@docType" | |
112 syn match rOTag contained "@encoding" | |
113 syn match rOTag contained "@evalRd" | |
114 syn match rOTag contained "@example" | |
115 syn match rOTag contained "@examples" | |
116 syn match rOTag contained "@family" | |
117 syn match rOTag contained "@field" | |
118 syn match rOTag contained "@format" | |
119 syn match rOTag contained "@inherit" | |
120 syn match rOTag contained "@inheritParams" | |
121 syn match rOTag contained "@inheritDotParams" | |
122 syn match rOTag contained "@inheritSection" | |
123 syn match rOTag contained "@keywords" | |
124 syn match rOTag contained "@method" | |
125 syn match rOTag contained "@name" | |
126 syn match rOTag contained "@md" | |
127 syn match rOTag contained "@noMd" | |
128 syn match rOTag contained "@noRd" | |
129 syn match rOTag contained "@note" | |
130 syn match rOTag contained "@param" | |
131 syn match rOTag contained "@rdname" | |
132 syn match rOTag contained "@rawRd" | |
133 syn match rOTag contained "@references" | |
134 syn match rOTag contained "@return" | |
135 syn match rOTag contained "@section" | |
136 syn match rOTag contained "@seealso" | |
137 syn match rOTag contained "@slot" | |
138 syn match rOTag contained "@source" | |
139 syn match rOTag contained "@template" | |
140 syn match rOTag contained "@templateVar" | |
141 syn match rOTag contained "@title" | |
142 syn match rOTag contained "@usage" | |
143 " namespace.R | |
144 syn match rOTag contained "@export" | |
145 syn match rOTag contained "@exportClass" | |
146 syn match rOTag contained "@exportMethod" | |
147 syn match rOTag contained "@exportPattern" | |
148 syn match rOTag contained "@import" | |
149 syn match rOTag contained "@importClassesFrom" | |
150 syn match rOTag contained "@importFrom" | |
151 syn match rOTag contained "@importMethodsFrom" | |
152 syn match rOTag contained "@rawNamespace" | |
153 syn match rOTag contained "@S3method" | |
154 syn match rOTag contained "@useDynLib" | |
155 " other | |
156 syn match rOTag contained "@include" | |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
7315
diff
changeset
|
157 endif |
4780 | 158 |
7 | 159 |
2725 | 160 if &filetype == "rhelp" |
161 " string enclosed in double quotes | |
162 syn region rString contains=rSpecial,@Spell start=/"/ skip=/\\\\\|\\"/ end=/"/ | |
163 " string enclosed in single quotes | |
164 syn region rString contains=rSpecial,@Spell start=/'/ skip=/\\\\\|\\'/ end=/'/ | |
165 else | |
166 " string enclosed in double quotes | |
167 syn region rString contains=rSpecial,rStrError,@Spell start=/"/ skip=/\\\\\|\\"/ end=/"/ | |
168 " string enclosed in single quotes | |
169 syn region rString contains=rSpecial,rStrError,@Spell start=/'/ skip=/\\\\\|\\'/ end=/'/ | |
170 endif | |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
171 |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
172 syn match rStrError display contained "\\." |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
173 |
2725 | 174 |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
175 " New line, carriage return, tab, backspace, bell, feed, vertical tab, backslash |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
176 syn match rSpecial display contained "\\\(n\|r\|t\|b\|a\|f\|v\|'\|\"\)\|\\\\" |
7 | 177 |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
178 " Hexadecimal and Octal digits |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
179 syn match rSpecial display contained "\\\(x\x\{1,2}\|[0-8]\{1,3}\)" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
180 |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
181 " Unicode characters |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
182 syn match rSpecial display contained "\\u\x\{1,4}" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
183 syn match rSpecial display contained "\\U\x\{1,8}" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
184 syn match rSpecial display contained "\\u{\x\{1,4}}" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
185 syn match rSpecial display contained "\\U{\x\{1,8}}" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
186 |
7 | 187 " Statement |
188 syn keyword rStatement break next return | |
189 syn keyword rConditional if else | |
190 syn keyword rRepeat for in repeat while | |
191 | |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
192 " Constant (not really) |
4780 | 193 syn keyword rConstant T F LETTERS letters month.abb month.name pi |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
194 syn keyword rConstant R.version.string |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
195 |
6476 | 196 syn keyword rNumber NA_integer_ NA_real_ NA_complex_ NA_character_ |
2725 | 197 |
198 " Constants | |
7 | 199 syn keyword rConstant NULL |
200 syn keyword rBoolean FALSE TRUE | |
6476 | 201 syn keyword rNumber NA Inf NaN |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
202 |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
203 " integer |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
204 syn match rInteger "\<\d\+L" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
205 syn match rInteger "\<0x\([0-9]\|[a-f]\|[A-F]\)\+L" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
206 syn match rInteger "\<\d\+[Ee]+\=\d\+L" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
207 |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
208 " number with no fractional part or exponent |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
209 syn match rNumber "\<\d\+\>" |
6476 | 210 " hexadecimal number |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
211 syn match rNumber "\<0x\([0-9]\|[a-f]\|[A-F]\)\+" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
212 |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
213 " floating point number with integer and fractional parts and optional exponent |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
214 syn match rFloat "\<\d\+\.\d*\([Ee][-+]\=\d\+\)\=" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
215 " floating point number with no integer part and optional exponent |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
216 syn match rFloat "\<\.\d\+\([Ee][-+]\=\d\+\)\=" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
217 " floating point number with no fractional part and optional exponent |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
218 syn match rFloat "\<\d\+[Ee][-+]\=\d\+" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
219 |
2725 | 220 " complex number |
221 syn match rComplex "\<\d\+i" | |
222 syn match rComplex "\<\d\++\d\+i" | |
223 syn match rComplex "\<0x\([0-9]\|[a-f]\|[A-F]\)\+i" | |
224 syn match rComplex "\<\d\+\.\d*\([Ee][-+]\=\d\+\)\=i" | |
225 syn match rComplex "\<\.\d\+\([Ee][-+]\=\d\+\)\=i" | |
226 syn match rComplex "\<\d\+[Ee][-+]\=\d\+i" | |
227 | |
6476 | 228 syn match rAssign '=' |
2725 | 229 syn match rOperator "&" |
230 syn match rOperator '-' | |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2725
diff
changeset
|
231 syn match rOperator '\*' |
2725 | 232 syn match rOperator '+' |
4780 | 233 if &filetype != "rmd" && &filetype != "rrst" |
234 syn match rOperator "[|!<>^~/:]" | |
235 else | |
236 syn match rOperator "[|!<>^~`/:]" | |
237 endif | |
6051 | 238 syn match rOperator "%\{2}\|%\S\{-}%" |
6476 | 239 syn match rOperator '\([!><]\)\@<==' |
240 syn match rOperator '==' | |
4780 | 241 syn match rOpError '\*\{3}' |
2725 | 242 syn match rOpError '//' |
243 syn match rOpError '&&&' | |
244 syn match rOpError '|||' | |
245 syn match rOpError '<<' | |
246 syn match rOpError '>>' | |
247 | |
6476 | 248 syn match rAssign "<\{1,2}-" |
249 syn match rAssign "->\{1,2}" | |
7 | 250 |
251 " Special | |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
252 syn match rDelimiter "[,;:]" |
7 | 253 |
254 " Error | |
2725 | 255 if exists("g:r_syntax_folding") |
256 syn region rRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError fold | |
257 syn region rRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rError,rBraceError,rParenError fold | |
258 syn region rRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rError,rCurlyError,rParenError fold | |
259 else | |
260 syn region rRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError | |
261 syn region rRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rError,rBraceError,rParenError | |
262 syn region rRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rError,rCurlyError,rParenError | |
263 endif | |
264 | |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
265 syn match rError "[)\]}]" |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
266 syn match rBraceError "[)}]" contained |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
267 syn match rCurlyError "[)\]]" contained |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
268 syn match rParenError "[\]}]" contained |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
269 |
11347 | 270 " Use Nvim-R to highlight functions dynamically if it is installed |
271 if !exists("g:r_syntax_fun_pattern") | |
272 let s:ff = split(substitute(globpath(&rtp, "R/functions.vim"), "functions.vim", "", "g"), "\n") | |
273 if len(s:ff) > 0 | |
274 let g:r_syntax_fun_pattern = 0 | |
275 else | |
276 let g:r_syntax_fun_pattern = 1 | |
277 endif | |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
7315
diff
changeset
|
278 endif |
11347 | 279 |
280 " Only use Nvim-R to highlight functions if they should not be highlighted | |
281 " according to a generic pattern | |
282 if g:r_syntax_fun_pattern == 1 | |
283 syn match rFunction '[0-9a-zA-Z_\.]\+\s*\ze(' | |
284 else | |
285 if !exists("g:R_hi_fun") | |
286 let g:R_hi_fun = 1 | |
287 endif | |
288 if g:R_hi_fun | |
289 " Nvim-R: | |
290 runtime R/functions.vim | |
291 endif | |
6476 | 292 endif |
2725 | 293 |
294 syn match rDollar display contained "\$" | |
4780 | 295 syn match rDollar display contained "@" |
2725 | 296 |
297 " List elements will not be highlighted as functions: | |
298 syn match rLstElmt "\$[a-zA-Z0-9\\._]*" contains=rDollar | |
4780 | 299 syn match rLstElmt "@[a-zA-Z0-9\\._]*" contains=rDollar |
2725 | 300 |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
301 " Functions that may add new objects |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
302 syn keyword rPreProc library require attach detach source |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
303 |
2725 | 304 if &filetype == "rhelp" |
6051 | 305 syn match rHelpIdent '\\method' |
306 syn match rHelpIdent '\\S4method' | |
2725 | 307 endif |
308 | |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
309 " Type |
6476 | 310 syn keyword rType array category character complex double function integer list logical matrix numeric vector data.frame |
7 | 311 |
2725 | 312 " Name of object with spaces |
4780 | 313 if &filetype != "rmd" && &filetype != "rrst" |
314 syn region rNameWSpace start="`" end="`" | |
315 endif | |
2725 | 316 |
317 if &filetype == "rhelp" | |
6476 | 318 syn match rhPreProc "^#ifdef.*" |
319 syn match rhPreProc "^#endif.*" | |
2725 | 320 syn match rhSection "\\dontrun\>" |
321 endif | |
322 | |
11347 | 323 if exists("r_syntax_minlines") |
324 exe "syn sync minlines=" . r_syntax_minlines | |
6476 | 325 else |
326 syn sync minlines=40 | |
327 endif | |
328 | |
7 | 329 " Define the default highlighting. |
6476 | 330 hi def link rAssign Statement |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
331 hi def link rBoolean Boolean |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
332 hi def link rBraceError Error |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
333 hi def link rComment Comment |
6051 | 334 hi def link rCommentTodo Todo |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
335 hi def link rComplex Number |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
336 hi def link rConditional Conditional |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
337 hi def link rConstant Constant |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
338 hi def link rCurlyError Error |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
339 hi def link rDelimiter Delimiter |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
340 hi def link rDollar SpecialChar |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
341 hi def link rError Error |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
342 hi def link rFloat Float |
2725 | 343 hi def link rFunction Function |
344 hi def link rHelpIdent Identifier | |
345 hi def link rhPreProc PreProc | |
346 hi def link rhSection PreCondit | |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
347 hi def link rInteger Number |
6476 | 348 hi def link rLstElmt Normal |
2725 | 349 hi def link rNameWSpace Normal |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
350 hi def link rNumber Number |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
351 hi def link rOperator Operator |
2725 | 352 hi def link rOpError Error |
2608
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
353 hi def link rParenError Error |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
354 hi def link rPreProc PreProc |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
355 hi def link rRepeat Repeat |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
356 hi def link rSpecial SpecialChar |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
357 hi def link rStatement Statement |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
358 hi def link rString String |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
359 hi def link rStrError Error |
7d8af31066c8
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
856
diff
changeset
|
360 hi def link rType Type |
11347 | 361 if g:r_syntax_hl_roxygen |
362 hi def link rOTitleTag Operator | |
363 hi def link rOTag Operator | |
364 hi def link rOTitleBlock Title | |
365 hi def link rOBlock Comment | |
366 hi def link rOBlockNoTitle Comment | |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
7315
diff
changeset
|
367 hi def link rOTitle Title |
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
7315
diff
changeset
|
368 hi def link rOCommentKey Comment |
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
7315
diff
changeset
|
369 hi def link rOExamples SpecialComment |
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
7315
diff
changeset
|
370 endif |
7315
444efa5f5015
commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents:
6476
diff
changeset
|
371 |
7 | 372 let b:current_syntax="r" |
373 | |
374 " vim: ts=8 sw=2 |