2015-03-07 23:02:15 +01:00
|
|
|
" vimtex - LaTeX plugin for Vim
|
2014-07-23 00:08:57 +02:00
|
|
|
"
|
|
|
|
" Maintainer: Karl Yngve Lervåg
|
|
|
|
" Email: karl.yngve@gmail.com
|
|
|
|
"
|
|
|
|
|
2015-04-01 08:26:19 +02:00
|
|
|
if !exists('b:current_syntax') || b:current_syntax !=# 'tex'
|
|
|
|
echoerr 'vimtex syntax error: please report issue!'
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
2013-11-03 11:49:18 +01:00
|
|
|
" Better support for cite commands
|
|
|
|
" \cite, \citep, \citet, \citeauthor, ...
|
2014-12-25 20:35:47 +01:00
|
|
|
syntax match texRefZone
|
2014-07-30 10:59:56 +02:00
|
|
|
\ "\\\%(auto\|text\)\?cite\%([tp]\*\?\|author\)\?"
|
2013-11-03 11:49:18 +01:00
|
|
|
\ nextgroup=texRefOption,texCite
|
|
|
|
|
2015-03-23 19:17:34 +01:00
|
|
|
" Add support for cleveref package
|
2013-10-16 10:17:08 +02:00
|
|
|
" \Cref, \cref, \cpageref, \labelcref, \labelcpageref
|
2014-12-25 20:35:47 +01:00
|
|
|
syntax region texRefZone matchgroup=texStatement
|
2015-03-12 09:56:24 +01:00
|
|
|
\ start="\\\(\(label\)\?c\(page\)\?\|C\|auto\)ref{"
|
2013-10-05 13:53:42 +02:00
|
|
|
\ end="}\|%stopzone\>"
|
|
|
|
\ contains=@texRefGroup
|
2013-10-16 10:17:08 +02:00
|
|
|
|
|
|
|
" \crefrange, \cpagerefrange (these commands expect two arguments)
|
2014-12-25 20:35:47 +01:00
|
|
|
syntax match texStatement
|
2013-10-16 10:17:08 +02:00
|
|
|
\ '\\c\(page\)\?refrange\>'
|
2013-10-17 13:33:52 +02:00
|
|
|
\ nextgroup=texRefRangeStart skipwhite skipnl
|
2014-12-25 20:35:47 +01:00
|
|
|
syntax region texRefRangeStart
|
2013-10-17 13:33:52 +02:00
|
|
|
\ start="{"rs=s+1 end="}"
|
|
|
|
\ matchgroup=Delimiter
|
|
|
|
\ contained contains=texRefZone
|
|
|
|
\ nextgroup=texRefRangeEnd skipwhite skipnl
|
2014-12-25 20:35:47 +01:00
|
|
|
syntax region texRefRangeEnd
|
2013-10-17 13:33:52 +02:00
|
|
|
\ start="{"rs=s+1 end="}"
|
|
|
|
\ matchgroup=Delimiter
|
|
|
|
\ contained contains=texRefZone
|
2014-12-25 20:35:47 +01:00
|
|
|
highlight link texRefRangeStart texRefZone
|
|
|
|
highlight link texRefRangeEnd texRefZone
|
2014-02-09 15:44:55 +01:00
|
|
|
|
2015-06-17 20:51:18 +02:00
|
|
|
" {{{1 Support for listings package
|
2014-12-25 20:35:47 +01:00
|
|
|
syntax region texZone
|
2015-06-17 20:51:18 +02:00
|
|
|
\ start="\\begin{lstlisting}"rs=s
|
|
|
|
\ end="\\end{lstlisting}\|%stopzone\>"re=e
|
|
|
|
\ keepend
|
|
|
|
\ contains=texBeginEnd
|
2014-12-25 20:35:47 +01:00
|
|
|
syntax match texInputFile
|
2014-06-04 14:53:49 +02:00
|
|
|
\ "\\lstinputlisting\s*\(\[.*\]\)\={.\{-}}"
|
2014-02-09 15:44:55 +01:00
|
|
|
\ contains=texStatement,texInputCurlies,texInputFileOpt
|
2014-12-25 20:35:47 +01:00
|
|
|
syntax match texZone "\\lstinline\s*\(\[.*\]\)\={.\{-}}"
|
|
|
|
|
2015-06-17 20:51:18 +02:00
|
|
|
" }}}1
|
|
|
|
" {{{1 Nested syntax highlighting for dot
|
2015-04-01 08:26:19 +02:00
|
|
|
unlet b:current_syntax
|
2014-12-25 20:35:47 +01:00
|
|
|
syntax include @DOT syntax/dot.vim
|
|
|
|
syntax region texZone
|
2015-06-17 20:51:18 +02:00
|
|
|
\ start="\\begin{dot2tex}"rs=s
|
|
|
|
\ end="\\end{dot2tex}"re=e
|
2014-12-25 20:35:47 +01:00
|
|
|
\ keepend
|
|
|
|
\ transparent
|
2015-06-17 20:51:18 +02:00
|
|
|
\ contains=texBeginEnd,@DOT
|
2015-04-01 08:26:19 +02:00
|
|
|
let b:current_syntax = 'tex'
|
2014-12-08 20:44:17 +01:00
|
|
|
|
2015-06-17 20:51:18 +02:00
|
|
|
" }}}1
|
|
|
|
|
2014-12-08 20:44:17 +01:00
|
|
|
" vim: fdm=marker sw=2
|