Mercurial > vim
comparison runtime/syntax/tex.vim @ 7228:873eae260c97
commit https://github.com/vim/vim/commit/b4ff518d95aa57c2f8c0568c915035bef849581b
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Nov 10 21:15:48 2015 +0100
Updated runtime files.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 10 Nov 2015 21:30:05 +0100 |
parents | ffad29dc7eee |
children | 41768bcebc9b |
comparison
equal
deleted
inserted
replaced
7227:28f3b34d076f | 7228:873eae260c97 |
---|---|
1 " Vim syntax file | 1 " Vim syntax file |
2 " Language: TeX | 2 " Language: TeX |
3 " Maintainer: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM> | 3 " Maintainer: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM> |
4 " Last Change: Oct 19, 2015 | 4 " Last Change: Oct 20, 2015 |
5 " Version: 89 | 5 " Version: 90 |
6 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX | 6 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX |
7 " | 7 " |
8 " Notes: {{{1 | 8 " Notes: {{{1 |
9 " | 9 " |
10 " 1. If you have a \begin{verbatim} that appears to overrun its boundaries, | 10 " 1. If you have a \begin{verbatim} that appears to overrun its boundaries, |
60 command -nargs=+ HiLink hi link <args> | 60 command -nargs=+ HiLink hi link <args> |
61 else | 61 else |
62 command -nargs=+ HiLink hi def link <args> | 62 command -nargs=+ HiLink hi def link <args> |
63 endif | 63 endif |
64 endif | 64 endif |
65 if exists("g:tex_no_error") && g:tex_no_error | |
66 let s:tex_no_error= 1 | |
67 else | |
68 let s:tex_no_error= 0 | |
69 endif | |
70 | 65 |
71 " by default, enable all region-based highlighting | 66 " by default, enable all region-based highlighting |
72 let s:tex_fast= "bcmMprsSvV" | 67 let s:tex_fast= "bcmMprsSvV" |
73 if exists("g:tex_fast") | 68 if exists("g:tex_fast") |
74 if type(g:tex_fast) != 1 | 69 if type(g:tex_fast) != 1 |
76 " turn off all optional region-based highighting | 71 " turn off all optional region-based highighting |
77 let s:tex_fast= "" | 72 let s:tex_fast= "" |
78 else | 73 else |
79 let s:tex_fast= g:tex_fast | 74 let s:tex_fast= g:tex_fast |
80 endif | 75 endif |
81 else | |
82 let s:tex_fast= "bcmMprsSvV" | |
83 endif | 76 endif |
84 | 77 |
85 " let user determine which classes of concealment will be supported | 78 " let user determine which classes of concealment will be supported |
86 " a=accents/ligatures d=delimiters m=math symbols g=Greek s=superscripts/subscripts | 79 " a=accents/ligatures d=delimiters m=math symbols g=Greek s=superscripts/subscripts |
87 if !exists("g:tex_conceal") | 80 if !exists("g:tex_conceal") |
112 endif | 105 endif |
113 endif | 106 endif |
114 | 107 |
115 " handle folding {{{1 | 108 " handle folding {{{1 |
116 if !exists("g:tex_fold_enabled") | 109 if !exists("g:tex_fold_enabled") |
117 let g:tex_fold_enabled= 0 | 110 let s:tex_fold_enabled= 0 |
118 elseif g:tex_fold_enabled && !has("folding") | 111 elseif g:tex_fold_enabled && !has("folding") |
119 let g:tex_fold_enabled= 0 | 112 let s:tex_fold_enabled= 0 |
120 echomsg "Ignoring g:tex_fold_enabled=".g:tex_fold_enabled."; need to re-compile vim for +fold support" | 113 echomsg "Ignoring g:tex_fold_enabled=".g:tex_fold_enabled."; need to re-compile vim for +fold support" |
121 endif | 114 else |
122 if g:tex_fold_enabled && &fdm == "manual" | 115 let s:tex_fold_enabled= 1 |
116 endif | |
117 if s:tex_fold_enabled && &fdm == "manual" | |
123 setl fdm=syntax | 118 setl fdm=syntax |
124 endif | 119 endif |
125 if g:tex_fold_enabled && has("folding") | 120 if s:tex_fold_enabled && has("folding") |
126 com! -nargs=* TexFold <args> fold | 121 com! -nargs=* TexFold <args> fold |
127 else | 122 else |
128 com! -nargs=* TexFold <args> | 123 com! -nargs=* TexFold <args> |
129 endif | 124 endif |
130 | 125 |
138 setlocal isk=48-57,a-z,A-Z,192-255 | 133 setlocal isk=48-57,a-z,A-Z,192-255 |
139 endif | 134 endif |
140 if b:tex_stylish | 135 if b:tex_stylish |
141 setlocal isk+=@-@ | 136 setlocal isk+=@-@ |
142 endif | 137 endif |
143 if exists("g:tex_nospell") && g:tex_nospell && !exists("g:tex_comment_nospell") | 138 if exists("g:tex_no_error") && g:tex_no_error |
144 let g:tex_comment_nospell= 1 | 139 let s:tex_no_error= 1 |
140 else | |
141 let s:tex_no_error= 0 | |
142 endif | |
143 if exists("g:tex_comment_nospell") && g:tex_comment_nospell | |
144 let s:tex_comment_nospell= 1 | |
145 else | |
146 let s:tex_comment_nospell= 0 | |
147 endif | |
148 if exists("g:tex_nospell") && g:tex_nospell | |
149 let s:tex_nospell = 1 | |
150 else | |
151 let s:tex_nospell = 0 | |
145 endif | 152 endif |
146 | 153 |
147 " Clusters: {{{1 | 154 " Clusters: {{{1 |
148 " -------- | 155 " -------- |
149 syn cluster texCmdGroup contains=texCmdBody,texComment,texDefParm,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texBeginEnd,texBeginEndName,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle | 156 syn cluster texCmdGroup contains=texCmdBody,texComment,texDefParm,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texBeginEnd,texBeginEndName,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle |
150 if !s:tex_no_error | 157 if !s:tex_no_error |
151 syn cluster texCmdGroup add=texMathError | 158 syn cluster texCmdGroup add=texMathError |
152 endif | 159 endif |
153 syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement | 160 syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement |
154 syn cluster texFoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texItalStyle,texNoSpell | 161 syn cluster texFoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texItalStyle,texNoSpell |
155 syn cluster texBoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texBoldItalStyle,texNoSpell | 162 syn cluster texBoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texBoldItalStyle,texNoSpell |
156 syn cluster texItalGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texItalStyle,texItalBoldStyle,texNoSpell | 163 syn cluster texItalGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texItalStyle,texItalBoldStyle,texNoSpell |
157 if !exists("g:tex_nospell") || !g:tex_nospell | 164 if !s:tex_nospell |
158 syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,@Spell | 165 syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,@Spell |
159 syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,@Spell,texStyleMatcher | 166 syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,@Spell,texStyleMatcher |
160 else | 167 else |
161 syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption | 168 syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption |
162 syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,texStyleMatcher | 169 syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,texStyleMatcher |
163 endif | 170 endif |
164 syn cluster texPreambleMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTitle,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texMathZoneZ | 171 syn cluster texPreambleMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTitle,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texMathZoneZ |
165 syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter | 172 syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter |
166 if !exists("g:tex_no_math") | 173 if !exists("g:tex_no_math") |
167 syn cluster texPreambleMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTitle,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texMathZoneZ | 174 syn cluster texPreambleMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTitle,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texMathZoneZ |
168 syn cluster texMathZones contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ | 175 syn cluster texMathZones contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ |
169 syn cluster texMatchGroup add=@texMathZones | 176 syn cluster texMatchGroup add=@texMathZones |
170 syn cluster texMathDelimGroup contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2 | 177 syn cluster texMathDelimGroup contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2 |
171 syn cluster texMathMatchGroup contains=@texMathZones,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathMatcher,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone | 178 syn cluster texMathMatchGroup contains=@texMathZones,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathMatcher,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone |
172 syn cluster texMathZoneGroup contains=texComment,texDelimiter,texLength,texMathDelim,texMathMatcher,texMathOper,texMathSymbol,texMathText,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle | 179 syn cluster texMathZoneGroup contains=texComment,texDelimiter,texLength,texMathDelim,texMathMatcher,texMathOper,texMathSymbol,texMathText,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle |
173 if !s:tex_no_error | 180 if !s:tex_no_error |
174 syn cluster texMathMatchGroup add=texMathError | 181 syn cluster texMathMatchGroup add=texMathError |
175 syn cluster texMathZoneGroup add=texMathError | 182 syn cluster texMathZoneGroup add=texMathError |
176 endif | 183 endif |
177 syn cluster texMathZoneGroup add=@NoSpell | 184 syn cluster texMathZoneGroup add=@NoSpell |
178 " following used in the \part \chapter \section \subsection \subsubsection | 185 " following used in the \part \chapter \section \subsection \subsubsection |
179 " \paragraph \subparagraph \author \title highlighting | 186 " \paragraph \subparagraph \author \title highlighting |
180 syn cluster texDocGroup contains=texPartZone,@texPartGroup | 187 syn cluster texDocGroup contains=texPartZone,@texPartGroup |
181 syn cluster texPartGroup contains=texChapterZone,texSectionZone,texParaZone | 188 syn cluster texPartGroup contains=texChapterZone,texSectionZone,texParaZone |
182 syn cluster texChapterGroup contains=texSectionZone,texParaZone | 189 syn cluster texChapterGroup contains=texSectionZone,texParaZone |
183 syn cluster texSectionGroup contains=texSubSectionZone,texParaZone | 190 syn cluster texSectionGroup contains=texSubSectionZone,texParaZone |
184 syn cluster texSubSectionGroup contains=texSubSubSectionZone,texParaZone | 191 syn cluster texSubSectionGroup contains=texSubSubSectionZone,texParaZone |
185 syn cluster texSubSubSectionGroup contains=texParaZone | 192 syn cluster texSubSubSectionGroup contains=texParaZone |
186 syn cluster texParaGroup contains=texSubParaZone | 193 syn cluster texParaGroup contains=texSubParaZone |
187 if has("conceal") && &enc == 'utf-8' | 194 if has("conceal") && &enc == 'utf-8' |
188 syn cluster texMathZoneGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol | 195 syn cluster texMathZoneGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol |
189 syn cluster texMathMatchGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol | 196 syn cluster texMathMatchGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol |
190 endif | 197 endif |
191 endif | 198 endif |
192 | 199 |
193 " Try to flag {} and () mismatches: {{{1 | 200 " Try to flag {} and () mismatches: {{{1 |
194 if s:tex_fast =~ 'm' | 201 if s:tex_fast =~ 'm' |
195 if !s:tex_no_error | 202 if !s:tex_no_error |
196 syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup,texError | 203 syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup,texError |
197 syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup,texError,@NoSpell | 204 syn region texMatcher matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchGroup,texError,@NoSpell |
198 else | 205 else |
199 syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup | 206 syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup |
200 syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup | 207 syn region texMatcher matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchGroup |
201 endif | 208 endif |
202 if !exists("g:tex_nospell") || !g:tex_nospell | 209 if !s:tex_nospell |
203 syn region texParen start="(" end=")" contains=@texMatchGroup,@Spell | 210 syn region texParen start="(" end=")" transparent contains=@texMatchGroup,@Spell |
204 else | 211 else |
205 syn region texParen start="(" end=")" contains=@texMatchGroup | 212 syn region texParen start="(" end=")" transparent contains=@texMatchGroup |
206 endif | 213 endif |
207 endif | 214 endif |
208 if !s:tex_no_error | 215 if !s:tex_no_error |
209 syn match texError "[}\])]" | 216 syn match texError "[}\])]" |
210 endif | 217 endif |
211 if s:tex_fast =~ 'M' | 218 if s:tex_fast =~ 'M' |
212 if !exists("g:tex_no_math") | 219 if !exists("g:tex_no_math") |
213 if !s:tex_no_error | 220 if !s:tex_no_error |
214 syn match texMathError "}" contained | 221 syn match texMathError "}" contained |
215 endif | 222 endif |
216 syn region texMathMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\}" end="}" end="%stopzone\>" contained contains=@texMathMatchGroup | 223 syn region texMathMatcher matchgroup=Delimiter start="{" skip="\%(\\\\\)*\\}" end="}" end="%stopzone\>" contained contains=@texMathMatchGroup |
217 endif | 224 endif |
218 endif | 225 endif |
219 | 226 |
220 " TeX/LaTeX keywords: {{{1 | 227 " TeX/LaTeX keywords: {{{1 |
221 " Instead of trying to be All Knowing, I just match \..alphameric.. | 228 " Instead of trying to be All Knowing, I just match \..alphameric.. |
230 endif | 237 endif |
231 | 238 |
232 " TeX/LaTeX delimiters: {{{1 | 239 " TeX/LaTeX delimiters: {{{1 |
233 syn match texDelimiter "&" | 240 syn match texDelimiter "&" |
234 syn match texDelimiter "\\\\" | 241 syn match texDelimiter "\\\\" |
235 " syn match texDelimiter "[{}]" | |
236 | 242 |
237 " Tex/Latex Options: {{{1 | 243 " Tex/Latex Options: {{{1 |
238 syn match texOption "[^\\]\zs#\d\+\|^#\d\+" | 244 syn match texOption "[^\\]\zs#\d\+\|^#\d\+" |
239 | 245 |
240 " texAccent (tnx to Karim Belabas) avoids annoying highlighting for accents: {{{1 | 246 " texAccent (tnx to Karim Belabas) avoids annoying highlighting for accents: {{{1 |
251 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)$" | 257 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)$" |
252 | 258 |
253 " \begin{}/\end{} section markers: {{{1 | 259 " \begin{}/\end{} section markers: {{{1 |
254 syn match texBeginEnd "\\begin\>\|\\end\>" nextgroup=texBeginEndName | 260 syn match texBeginEnd "\\begin\>\|\\end\>" nextgroup=texBeginEndName |
255 if s:tex_fast =~ 'm' | 261 if s:tex_fast =~ 'm' |
256 syn region texBeginEndName matchgroup=Delimiter start="{" end="}" contained nextgroup=texBeginEndModifier contains=texComment | 262 syn region texBeginEndName matchgroup=Delimiter start="{" end="}" contained nextgroup=texBeginEndModifier contains=texComment |
257 syn region texBeginEndModifier matchgroup=Delimiter start="\[" end="]" contained contains=texComment,@NoSpell | 263 syn region texBeginEndModifier matchgroup=Delimiter start="\[" end="]" contained contains=texComment,@NoSpell |
258 endif | 264 endif |
259 | 265 |
260 " \documentclass, \documentstyle, \usepackage: {{{1 | 266 " \documentclass, \documentstyle, \usepackage: {{{1 |
261 syn match texDocType "\\documentclass\>\|\\documentstyle\>\|\\usepackage\>" nextgroup=texBeginEndName,texDocTypeArgs | 267 syn match texDocType "\\documentclass\>\|\\documentstyle\>\|\\usepackage\>" nextgroup=texBeginEndName,texDocTypeArgs |
262 if s:tex_fast =~ 'm' | 268 if s:tex_fast =~ 'm' |
263 syn region texDocTypeArgs matchgroup=Delimiter start="\[" end="]" contained nextgroup=texBeginEndName contains=texComment,@NoSpell | 269 syn region texDocTypeArgs matchgroup=Delimiter start="\[" end="]" contained nextgroup=texBeginEndName contains=texComment,@NoSpell |
264 endif | 270 endif |
265 | 271 |
266 " Preamble syntax-based folding support: {{{1 | 272 " Preamble syntax-based folding support: {{{1 |
267 if g:tex_fold_enabled && has("folding") | 273 if s:tex_fold_enabled && has("folding") |
268 syn region texPreamble transparent fold start='\zs\\documentclass\>' end='\ze\\begin{document}' contains=texStyle,@texPreambleMatchGroup | 274 syn region texPreamble transparent fold start='\zs\\documentclass\>' end='\ze\\begin{document}' contains=texStyle,@texPreambleMatchGroup |
269 endif | 275 endif |
270 | 276 |
271 " TeX input: {{{1 | 277 " TeX input: {{{1 |
272 syn match texInput "\\input\s\+[a-zA-Z/.0-9_^]\+"hs=s+7 contains=texStatement | 278 syn match texInput "\\input\s\+[a-zA-Z/.0-9_^]\+"hs=s+7 contains=texStatement |
340 syn match texSpaceCode "\\\(math\|cat\|del\|lc\|sf\|uc\)code`"me=e-1 nextgroup=texSpaceCodeChar | 346 syn match texSpaceCode "\\\(math\|cat\|del\|lc\|sf\|uc\)code`"me=e-1 nextgroup=texSpaceCodeChar |
341 syn match texSpaceCodeChar "`\\\=.\(\^.\)\==\(\d\|\"\x\{1,6}\|`.\)" contained | 347 syn match texSpaceCodeChar "`\\\=.\(\^.\)\==\(\d\|\"\x\{1,6}\|`.\)" contained |
342 | 348 |
343 " Sections, subsections, etc: {{{1 | 349 " Sections, subsections, etc: {{{1 |
344 if s:tex_fast =~ 'p' | 350 if s:tex_fast =~ 'p' |
345 if !exists("g:tex_nospell") || !g:tex_nospell | 351 if !s:tex_nospell |
346 TexFold syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell | 352 TexFold syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell |
347 TexFold syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup,@Spell | 353 TexFold syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup,@Spell |
348 TexFold syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup,@Spell | 354 TexFold syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup,@Spell |
349 TexFold syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup,@Spell | 355 TexFold syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup,@Spell |
350 TexFold syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup,@Spell | 356 TexFold syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup,@Spell |
351 TexFold syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup,@Spell | 357 TexFold syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup,@Spell |
352 TexFold syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup,@Spell | 358 TexFold syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup,@Spell |
353 TexFold syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@Spell | 359 TexFold syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@Spell |
354 TexFold syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup,@Spell | 360 TexFold syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup,@Spell |
355 TexFold syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup,@Spell | 361 TexFold syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup,@Spell |
356 else | 362 else |
357 TexFold syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup | 363 TexFold syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup |
358 TexFold syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup | 364 TexFold syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup |
359 TexFold syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup | 365 TexFold syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup |
360 TexFold syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup | 366 TexFold syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup |
361 TexFold syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup | 367 TexFold syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup |
362 TexFold syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup | 368 TexFold syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup |
363 TexFold syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup | 369 TexFold syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup |
364 TexFold syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup | 370 TexFold syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup |
365 TexFold syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup | 371 TexFold syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup |
366 TexFold syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup | 372 TexFold syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup |
367 endif | 373 endif |
368 endif | 374 endif |
369 | 375 |
370 " particular support for bold and italic {{{1 | 376 " particular support for bold and italic {{{1 |
371 if s:tex_fast =~ 'b' | 377 if s:tex_fast =~ 'b' |
398 " forms have syntax group and synchronization groups with a | 404 " forms have syntax group and synchronization groups with a |
399 " "S" appended. Handles: cluster, syntax, sync, and HiLink. | 405 " "S" appended. Handles: cluster, syntax, sync, and HiLink. |
400 fun! TexNewMathZone(sfx,mathzone,starform) | 406 fun! TexNewMathZone(sfx,mathzone,starform) |
401 let grpname = "texMathZone".a:sfx | 407 let grpname = "texMathZone".a:sfx |
402 let syncname = "texSyncMathZone".a:sfx | 408 let syncname = "texSyncMathZone".a:sfx |
403 if g:tex_fold_enabled | 409 if s:tex_fold_enabled |
404 let foldcmd= " fold" | 410 let foldcmd= " fold" |
405 else | 411 else |
406 let foldcmd= "" | 412 let foldcmd= "" |
407 endif | 413 endif |
408 exe "syn cluster texMathZones add=".grpname | 414 exe "syn cluster texMathZones add=".grpname |
447 syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" concealends contains=@texMathZoneGroup | 453 syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" concealends contains=@texMathZoneGroup |
448 syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend concealends contains=@texMathZoneGroup | 454 syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend concealends contains=@texMathZoneGroup |
449 else | 455 else |
450 syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend contains=@texMathZoneGroup | 456 syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend contains=@texMathZoneGroup |
451 syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend contains=@texMathZoneGroup | 457 syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend contains=@texMathZoneGroup |
452 syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup | 458 syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\%(\\\\\)*\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup |
453 syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend contains=@texMathZoneGroup | 459 syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend contains=@texMathZoneGroup |
454 endif | 460 endif |
455 syn region texMathZoneZ matchgroup=texStatement start="\\ensuremath\s*{" matchgroup=texStatement end="}" end="%stopzone\>" contains=@texMathZoneGroup | 461 syn region texMathZoneZ matchgroup=texStatement start="\\ensuremath\s*{" matchgroup=texStatement end="}" end="%stopzone\>" contains=@texMathZoneGroup |
456 endif | 462 endif |
457 | 463 |
542 endif | 548 endif |
543 | 549 |
544 " Comments: {{{1 | 550 " Comments: {{{1 |
545 " Normal TeX LaTeX : %.... | 551 " Normal TeX LaTeX : %.... |
546 " Documented TeX Format: ^^A... -and- leading %s (only) | 552 " Documented TeX Format: ^^A... -and- leading %s (only) |
547 if !exists("g:tex_comment_nospell") || !g:tex_comment_nospell | 553 if !s:tex_comment_nospell |
548 syn cluster texCommentGroup contains=texTodo,@Spell | 554 syn cluster texCommentGroup contains=texTodo,@Spell |
549 else | 555 else |
550 syn cluster texCommentGroup contains=texTodo,@NoSpell | 556 syn cluster texCommentGroup contains=texTodo,@NoSpell |
551 endif | 557 endif |
552 syn case ignore | 558 syn case ignore |
554 syn case match | 560 syn case match |
555 if s:extfname == "dtx" | 561 if s:extfname == "dtx" |
556 syn match texComment "\^\^A.*$" contains=@texCommentGroup | 562 syn match texComment "\^\^A.*$" contains=@texCommentGroup |
557 syn match texComment "^%\+" contains=@texCommentGroup | 563 syn match texComment "^%\+" contains=@texCommentGroup |
558 else | 564 else |
559 if g:tex_fold_enabled | 565 if s:tex_fold_enabled |
560 " allows syntax-folding of 2 or more contiguous comment lines | 566 " allows syntax-folding of 2 or more contiguous comment lines |
561 " single-line comments are not folded | 567 " single-line comments are not folded |
562 syn match texComment "%.*$" contains=@texCommentGroup | 568 syn match texComment "%.*$" contains=@texCommentGroup |
563 if s:tex_fast =~ 'c' | 569 if s:tex_fast =~ 'c' |
564 TexFold syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' | 570 TexFold syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' contains=@texCommentGroup |
565 TexFold syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell | 571 TexFold syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell |
566 endif | 572 endif |
567 else | 573 else |
568 syn match texComment "%.*$" contains=@texCommentGroup | 574 syn match texComment "%.*$" contains=@texCommentGroup |
569 if s:tex_fast =~ 'c' | 575 if s:tex_fast =~ 'c' |
570 syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell | 576 syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell |
571 endif | 577 endif |
572 endif | 578 endif |
573 endif | 579 endif |
574 | 580 |
575 " Separate lines used for verb` and verb# so that the end conditions {{{1 | 581 " Separate lines used for verb` and verb# so that the end conditions {{{1 |