comparison runtime/syntax/r.vim @ 6476:11d78e58a487

Update runtime files.
author Bram Moolenaar <bram@vim.org>
date Wed, 07 Jan 2015 16:57:10 +0100
parents 0efec12f52ac
children 444efa5f5015
comparison
equal deleted inserted replaced
6475:35cfb5077f7b 6476:11d78e58a487
1 " Vim syntax file 1 " Vim syntax file
2 " Language: R (GNU S) 2 " Language: R (GNU S)
3 " Maintainer: Jakson Aquino <jalvesaq@gmail.com> 3 " Maintainer: Jakson Aquino <jalvesaq@gmail.com>
4 " Former Maintainers: Vaidotas Zemlys <zemlys@gmail.com> 4 " Former Maintainers: Vaidotas Zemlys <zemlys@gmail.com>
5 " Tom Payne <tom@tompayne.org> 5 " Tom Payne <tom@tompayne.org>
6 " Last Change: Wed Jul 09, 2014 10:29PM 6 " Last Change: Wed Dec 31, 2014 12:36AM
7 " Filenames: *.R *.r *.Rhistory *.Rt 7 " Filenames: *.R *.r *.Rhistory *.Rt
8 " 8 "
9 " NOTE: The highlighting of R functions is defined in the 9 " NOTE: The highlighting of R functions is defined in
10 " r-plugin/functions.vim, which is part of vim-r-plugin2: 10 " runtime files created by a filetype plugin, if installed.
11 " http://www.vim.org/scripts/script.php?script_id=2628
12 " 11 "
13 " CONFIGURATION: 12 " CONFIGURATION:
14 " syntax folding can be turned on by 13 " syntax folding can be turned on by
15 " 14 "
16 " let r_syntax_folding = 1 15 " let r_syntax_folding = 1
35 34
36 " Roxygen 35 " Roxygen
37 syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|include\|docType\)" 36 syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|include\|docType\)"
38 syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)" 37 syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)"
39 syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)" 38 syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)"
40 syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\)" 39 syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\|useDynLib\)"
41 syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)" 40 syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)"
42 syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritsParams\)" 41 syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritParams\)"
43 syn match rOComment contains=@Spell,rOKeyword "#'.*" 42 syn match rOComment contains=@Spell,rOKeyword "#'.*"
44 43
45 44
46 if &filetype == "rhelp" 45 if &filetype == "rhelp"
47 " string enclosed in double quotes 46 " string enclosed in double quotes
77 76
78 " Constant (not really) 77 " Constant (not really)
79 syn keyword rConstant T F LETTERS letters month.abb month.name pi 78 syn keyword rConstant T F LETTERS letters month.abb month.name pi
80 syn keyword rConstant R.version.string 79 syn keyword rConstant R.version.string
81 80
82 syn keyword rNumber NA_integer_ NA_real_ NA_complex_ NA_character_ 81 syn keyword rNumber NA_integer_ NA_real_ NA_complex_ NA_character_
83 82
84 " Constants 83 " Constants
85 syn keyword rConstant NULL 84 syn keyword rConstant NULL
86 syn keyword rBoolean FALSE TRUE 85 syn keyword rBoolean FALSE TRUE
87 syn keyword rNumber NA Inf NaN 86 syn keyword rNumber NA Inf NaN
88 87
89 " integer 88 " integer
90 syn match rInteger "\<\d\+L" 89 syn match rInteger "\<\d\+L"
91 syn match rInteger "\<0x\([0-9]\|[a-f]\|[A-F]\)\+L" 90 syn match rInteger "\<0x\([0-9]\|[a-f]\|[A-F]\)\+L"
92 syn match rInteger "\<\d\+[Ee]+\=\d\+L" 91 syn match rInteger "\<\d\+[Ee]+\=\d\+L"
93 92
94 " number with no fractional part or exponent 93 " number with no fractional part or exponent
95 syn match rNumber "\<\d\+\>" 94 syn match rNumber "\<\d\+\>"
96 " hexadecimal number 95 " hexadecimal number
97 syn match rNumber "\<0x\([0-9]\|[a-f]\|[A-F]\)\+" 96 syn match rNumber "\<0x\([0-9]\|[a-f]\|[A-F]\)\+"
98 97
99 " floating point number with integer and fractional parts and optional exponent 98 " floating point number with integer and fractional parts and optional exponent
100 syn match rFloat "\<\d\+\.\d*\([Ee][-+]\=\d\+\)\=" 99 syn match rFloat "\<\d\+\.\d*\([Ee][-+]\=\d\+\)\="
101 " floating point number with no integer part and optional exponent 100 " floating point number with no integer part and optional exponent
109 syn match rComplex "\<0x\([0-9]\|[a-f]\|[A-F]\)\+i" 108 syn match rComplex "\<0x\([0-9]\|[a-f]\|[A-F]\)\+i"
110 syn match rComplex "\<\d\+\.\d*\([Ee][-+]\=\d\+\)\=i" 109 syn match rComplex "\<\d\+\.\d*\([Ee][-+]\=\d\+\)\=i"
111 syn match rComplex "\<\.\d\+\([Ee][-+]\=\d\+\)\=i" 110 syn match rComplex "\<\.\d\+\([Ee][-+]\=\d\+\)\=i"
112 syn match rComplex "\<\d\+[Ee][-+]\=\d\+i" 111 syn match rComplex "\<\d\+[Ee][-+]\=\d\+i"
113 112
113 syn match rAssign '='
114 syn match rOperator "&" 114 syn match rOperator "&"
115 syn match rOperator '-' 115 syn match rOperator '-'
116 syn match rOperator '\*' 116 syn match rOperator '\*'
117 syn match rOperator '+' 117 syn match rOperator '+'
118 syn match rOperator '='
119 if &filetype != "rmd" && &filetype != "rrst" 118 if &filetype != "rmd" && &filetype != "rrst"
120 syn match rOperator "[|!<>^~/:]" 119 syn match rOperator "[|!<>^~/:]"
121 else 120 else
122 syn match rOperator "[|!<>^~`/:]" 121 syn match rOperator "[|!<>^~`/:]"
123 endif 122 endif
124 syn match rOperator "%\{2}\|%\S\{-}%" 123 syn match rOperator "%\{2}\|%\S\{-}%"
124 syn match rOperator '\([!><]\)\@<=='
125 syn match rOperator '=='
125 syn match rOpError '\*\{3}' 126 syn match rOpError '\*\{3}'
126 syn match rOpError '//' 127 syn match rOpError '//'
127 syn match rOpError '&&&' 128 syn match rOpError '&&&'
128 syn match rOpError '|||' 129 syn match rOpError '|||'
129 syn match rOpError '<<' 130 syn match rOpError '<<'
130 syn match rOpError '>>' 131 syn match rOpError '>>'
131 132
132 syn match rArrow "<\{1,2}-" 133 syn match rAssign "<\{1,2}-"
133 syn match rArrow "->\{1,2}" 134 syn match rAssign "->\{1,2}"
134 135
135 " Special 136 " Special
136 syn match rDelimiter "[,;:]" 137 syn match rDelimiter "[,;:]"
137 138
138 " Error 139 " Error
149 syn match rError "[)\]}]" 150 syn match rError "[)\]}]"
150 syn match rBraceError "[)}]" contained 151 syn match rBraceError "[)}]" contained
151 syn match rCurlyError "[)\]]" contained 152 syn match rCurlyError "[)\]]" contained
152 syn match rParenError "[\]}]" contained 153 syn match rParenError "[\]}]" contained
153 154
154 " Source list of R functions. The list is produced by the Vim-R-plugin 155 " Source list of R functions produced by a filetype plugin (if installed)
155 " http://www.vim.org/scripts/script.php?script_id=2628 156 if has("nvim")
156 runtime r-plugin/functions.vim 157 " Nvim-R
158 runtime R/functions.vim
159 else
160 " Vim-R-plugin
161 runtime r-plugin/functions.vim
162 endif
157 163
158 syn match rDollar display contained "\$" 164 syn match rDollar display contained "\$"
159 syn match rDollar display contained "@" 165 syn match rDollar display contained "@"
160 166
161 " List elements will not be highlighted as functions: 167 " List elements will not be highlighted as functions:
169 syn match rHelpIdent '\\method' 175 syn match rHelpIdent '\\method'
170 syn match rHelpIdent '\\S4method' 176 syn match rHelpIdent '\\S4method'
171 endif 177 endif
172 178
173 " Type 179 " Type
174 syn keyword rType array category character complex double function integer list logical matrix numeric vector data.frame 180 syn keyword rType array category character complex double function integer list logical matrix numeric vector data.frame
175 181
176 " Name of object with spaces 182 " Name of object with spaces
177 if &filetype != "rmd" && &filetype != "rrst" 183 if &filetype != "rmd" && &filetype != "rrst"
178 syn region rNameWSpace start="`" end="`" 184 syn region rNameWSpace start="`" end="`"
179 endif 185 endif
180 186
181 if &filetype == "rhelp" 187 if &filetype == "rhelp"
182 syn match rhPreProc "^#ifdef.*" 188 syn match rhPreProc "^#ifdef.*"
183 syn match rhPreProc "^#endif.*" 189 syn match rhPreProc "^#endif.*"
184 syn match rhSection "\\dontrun\>" 190 syn match rhSection "\\dontrun\>"
185 endif 191 endif
186 192
193 if exists("r_syn_minlines")
194 exe "syn sync minlines=" . r_syn_minlines
195 else
196 syn sync minlines=40
197 endif
198
187 " Define the default highlighting. 199 " Define the default highlighting.
188 hi def link rArrow Statement 200 hi def link rAssign Statement
189 hi def link rBoolean Boolean 201 hi def link rBoolean Boolean
190 hi def link rBraceError Error 202 hi def link rBraceError Error
191 hi def link rComment Comment 203 hi def link rComment Comment
192 hi def link rCommentTodo Todo 204 hi def link rCommentTodo Todo
193 hi def link rOComment Comment 205 hi def link rOComment Comment
202 hi def link rFunction Function 214 hi def link rFunction Function
203 hi def link rHelpIdent Identifier 215 hi def link rHelpIdent Identifier
204 hi def link rhPreProc PreProc 216 hi def link rhPreProc PreProc
205 hi def link rhSection PreCondit 217 hi def link rhSection PreCondit
206 hi def link rInteger Number 218 hi def link rInteger Number
207 hi def link rLstElmt Normal 219 hi def link rLstElmt Normal
208 hi def link rNameWSpace Normal 220 hi def link rNameWSpace Normal
209 hi def link rNumber Number 221 hi def link rNumber Number
210 hi def link rOperator Operator 222 hi def link rOperator Operator
211 hi def link rOpError Error 223 hi def link rOpError Error
212 hi def link rParenError Error 224 hi def link rParenError Error