mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-13 14:03:50 -05:00
Change latex provider to luatex, closes #476
This commit is contained in:
47
autoload/vimtex/syntax/p/amsmath.vim
Normal file
47
autoload/vimtex/syntax/p/amsmath.vim
Normal file
@@ -0,0 +1,47 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! vimtex#syntax#p#amsmath#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'amsmath') | return | endif
|
||||
let b:vimtex_syntax.amsmath = 1
|
||||
|
||||
" Allow subequations (fixes #1019)
|
||||
" - This should be temporary, as it seems subequations is erroneously part of
|
||||
" texBadMath from Charles Campbell's syntax plugin.
|
||||
syntax match texBeginEnd
|
||||
\ "\(\\begin\>\|\\end\>\)\ze{subequations}"
|
||||
\ nextgroup=texBeginEndName
|
||||
|
||||
call vimtex#syntax#misc#new_math_zone('AmsA', 'align', 1)
|
||||
call vimtex#syntax#misc#new_math_zone('AmsB', 'alignat', 1)
|
||||
call vimtex#syntax#misc#new_math_zone('AmsD', 'flalign', 1)
|
||||
call vimtex#syntax#misc#new_math_zone('AmsC', 'gather', 1)
|
||||
call vimtex#syntax#misc#new_math_zone('AmsD', 'multline', 1)
|
||||
call vimtex#syntax#misc#new_math_zone('AmsE', 'xalignat', 1)
|
||||
call vimtex#syntax#misc#new_math_zone('AmsF', 'xxalignat', 0)
|
||||
call vimtex#syntax#misc#new_math_zone('AmsG', 'mathpar', 1)
|
||||
|
||||
" Amsmath [lr][vV]ert (Holger Mitschke)
|
||||
if has('conceal') && &enc ==# 'utf-8' && get(g:, 'tex_conceal', 'd') =~# 'd'
|
||||
for l:texmath in [
|
||||
\ ['\\lvert', '|'] ,
|
||||
\ ['\\rvert', '|'] ,
|
||||
\ ['\\lVert', '‖'] ,
|
||||
\ ['\\rVert', '‖'] ,
|
||||
\ ]
|
||||
execute "syntax match texMathDelim '\\\\[bB]igg\\=[lr]\\="
|
||||
\ . l:texmath[0] . "' contained conceal cchar=" . l:texmath[1]
|
||||
endfor
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
35
autoload/vimtex/syntax/p/array.vim
Normal file
35
autoload/vimtex/syntax/p/array.vim
Normal file
@@ -0,0 +1,35 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#array#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'array') | return | endif
|
||||
let b:vimtex_syntax.array = 1
|
||||
|
||||
call vimtex#syntax#p#tabularx#load()
|
||||
if !get(g:, 'tex_fast', 'M') =~# 'M' | return | endif
|
||||
|
||||
"
|
||||
" The following code changes inline math so as to support the column
|
||||
" specifiers [0], e.g.
|
||||
"
|
||||
" \begin{tabular}{*{3}{>{$}c<{$}}}
|
||||
"
|
||||
" [0]: https://en.wikibooks.org/wiki/LaTeX/Tables#Column_specification_using_.3E.7B.5Ccmd.7D_and_.3C.7B.5Ccmd.7D
|
||||
"
|
||||
|
||||
syntax clear texMathZoneX
|
||||
if has('conceal') && &enc ==# 'utf-8' && get(g:, 'tex_conceal', 'd') =~# 'd'
|
||||
syntax region texMathZoneX matchgroup=Delimiter start="\([<>]{\)\@<!\$" skip="\%(\\\\\)*\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" concealends contains=@texMathZoneGroup
|
||||
else
|
||||
syntax region texMathZoneX matchgroup=Delimiter start="\([<>]{\)\@<!\$" skip="\%(\\\\\)*\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
34
autoload/vimtex/syntax/p/asymptote.vim
Normal file
34
autoload/vimtex/syntax/p/asymptote.vim
Normal file
@@ -0,0 +1,34 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#asymptote#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'asymptote') | return | endif
|
||||
let b:vimtex_syntax.asymptote = 1
|
||||
|
||||
call vimtex#syntax#misc#add_to_section_clusters('texZoneAsymptote')
|
||||
|
||||
if !empty(vimtex#syntax#misc#include('asy'))
|
||||
syntax region texZoneAsymptote
|
||||
\ start='\\begin{asy\z(def\)\?}'rs=s
|
||||
\ end='\\end{asy\z1}'re=e
|
||||
\ keepend
|
||||
\ transparent
|
||||
\ contains=texBeginEnd,@vimtex_nested_asy
|
||||
else
|
||||
syntax region texZoneAsymptote
|
||||
\ start='\\begin{asy\z(def\)\?}'rs=s
|
||||
\ end='\\end{asy\z1}'re=e
|
||||
\ keepend
|
||||
\ contains=texBeginEnd
|
||||
highlight def link texZoneAsymptote texZone
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
32
autoload/vimtex/syntax/p/beamer.vim
Normal file
32
autoload/vimtex/syntax/p/beamer.vim
Normal file
@@ -0,0 +1,32 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#beamer#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'beamer') | return | endif
|
||||
let b:vimtex_syntax.beamer = 1
|
||||
|
||||
syntax match texBeamerDelimiter '<\|>' contained
|
||||
syntax match texBeamerOpt '<[^>]*>' contained contains=texBeamerDelimiter
|
||||
|
||||
syntax match texStatementBeamer '\\only\(<[^>]*>\)\?' contains=texBeamerOpt
|
||||
syntax match texStatementBeamer '\\item<[^>]*>' contains=texBeamerOpt
|
||||
|
||||
syntax match texInputFile
|
||||
\ '\\includegraphics<[^>]*>\(\[.\{-}\]\)\=\s*{.\{-}}'
|
||||
\ contains=texStatement,texBeamerOpt,texInputCurlies,texInputFileOpt
|
||||
|
||||
call vimtex#syntax#misc#add_to_section_clusters('texStatementBeamer')
|
||||
|
||||
highlight link texStatementBeamer texStatement
|
||||
highlight link texBeamerOpt Identifier
|
||||
highlight link texBeamerDelimiter Delimiter
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
84
autoload/vimtex/syntax/p/biblatex.vim
Normal file
84
autoload/vimtex/syntax/p/biblatex.vim
Normal file
@@ -0,0 +1,84 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#biblatex#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'biblatex') | return | endif
|
||||
let b:vimtex_syntax.biblatex = 1
|
||||
|
||||
if get(g:, 'tex_fast', 'r') !~# 'r' | return | endif
|
||||
|
||||
for l:pattern in [
|
||||
\ 'bibentry',
|
||||
\ 'cite[pt]?\*?',
|
||||
\ 'citeal[tp]\*?',
|
||||
\ 'cite(num|text|url)',
|
||||
\ '[Cc]ite%(title|author|year(par)?|date)\*?',
|
||||
\ '[Pp]arencite\*?',
|
||||
\ 'foot%(full)?cite%(text)?',
|
||||
\ 'fullcite',
|
||||
\ '[Tt]extcite',
|
||||
\ '[Ss]martcite',
|
||||
\ 'supercite',
|
||||
\ '[Aa]utocite\*?',
|
||||
\ '[Ppf]?[Nn]otecite',
|
||||
\ '%(text|block)cquote\*?',
|
||||
\]
|
||||
execute 'syntax match texStatement'
|
||||
\ '/\v\\' . l:pattern . '\ze\s*%(\[|\{)/'
|
||||
\ 'nextgroup=texRefOption,texCite'
|
||||
endfor
|
||||
|
||||
for l:pattern in [
|
||||
\ '[Cc]ites',
|
||||
\ '[Pp]arencites',
|
||||
\ 'footcite%(s|texts)',
|
||||
\ '[Tt]extcites',
|
||||
\ '[Ss]martcites',
|
||||
\ 'supercites',
|
||||
\ '[Aa]utocites',
|
||||
\ '[pPfFsStTaA]?[Vv]olcites?',
|
||||
\ 'cite%(field|list|name)',
|
||||
\]
|
||||
execute 'syntax match texStatement'
|
||||
\ '/\v\\' . l:pattern . '\ze\s*%(\[|\{)/'
|
||||
\ 'nextgroup=texRefOptions,texCites'
|
||||
endfor
|
||||
|
||||
for l:pattern in [
|
||||
\ '%(foreign|hyphen)textcquote\*?',
|
||||
\ '%(foreign|hyphen)blockcquote',
|
||||
\ 'hybridblockcquote',
|
||||
\]
|
||||
execute 'syntax match texStatement'
|
||||
\ '/\v\\' . l:pattern . '\ze\s*%(\[|\{)/'
|
||||
\ 'nextgroup=texQuoteLang'
|
||||
endfor
|
||||
|
||||
syntax region texRefOptions contained matchgroup=Delimiter
|
||||
\ start='\[' end=']'
|
||||
\ contains=@texRefGroup,texRefZone
|
||||
\ nextgroup=texRefOptions,texCites
|
||||
|
||||
syntax region texCites contained matchgroup=Delimiter
|
||||
\ start='{' end='}'
|
||||
\ contains=@texRefGroup,texRefZone,texCites
|
||||
\ nextgroup=texRefOptions,texCites
|
||||
|
||||
syntax region texQuoteLang contained matchgroup=Delimiter
|
||||
\ start='{' end='}'
|
||||
\ transparent
|
||||
\ contains=@texMatchGroup
|
||||
\ nextgroup=texRefOption,texCite
|
||||
|
||||
highlight def link texRefOptions texRefOption
|
||||
highlight def link texCites texCite
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
23
autoload/vimtex/syntax/p/breqn.vim
Normal file
23
autoload/vimtex/syntax/p/breqn.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! vimtex#syntax#p#breqn#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'breqn') | return | endif
|
||||
let b:vimtex_syntax.breqn = 1
|
||||
|
||||
call vimtex#syntax#misc#new_math_zone('BreqnA', 'dmath', 1)
|
||||
call vimtex#syntax#misc#new_math_zone('BreqnB', 'dseries', 1)
|
||||
call vimtex#syntax#misc#new_math_zone('BreqnC', 'dgroup', 1)
|
||||
call vimtex#syntax#misc#new_math_zone('BreqnD', 'darray', 1)
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
20
autoload/vimtex/syntax/p/cases.vim
Normal file
20
autoload/vimtex/syntax/p/cases.vim
Normal file
@@ -0,0 +1,20 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! vimtex#syntax#p#cases#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'cases') | return | endif
|
||||
let b:vimtex_syntax.cases = 1
|
||||
|
||||
call VimtexNewMathZone('E', '\(sub\)\?numcases', 0)
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
44
autoload/vimtex/syntax/p/cleveref.vim
Normal file
44
autoload/vimtex/syntax/p/cleveref.vim
Normal file
@@ -0,0 +1,44 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#cleveref#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'cleveref') | return | endif
|
||||
let b:vimtex_syntax.cleveref = 1
|
||||
if get(g:, 'tex_fast', 'r') !~# 'r' | return | endif
|
||||
|
||||
syntax match texStatement '\\\(\(label\)\?c\(page\)\?\|C\|auto\)ref\>'
|
||||
\ nextgroup=texCRefZone
|
||||
|
||||
" \crefrange, \cpagerefrange (these commands expect two arguments)
|
||||
syntax match texStatement '\\c\(page\)\?refrange\>'
|
||||
\ nextgroup=texCRefZoneRange skipwhite skipnl
|
||||
|
||||
" \label[xxx]{asd}
|
||||
syntax match texStatement '\\label\[.\{-}\]'
|
||||
\ nextgroup=texCRefZone skipwhite skipnl
|
||||
\ contains=texCRefLabelOpts
|
||||
|
||||
syntax region texCRefZone contained matchgroup=Delimiter
|
||||
\ start="{" end="}"
|
||||
\ contains=@texRefGroup,texRefZone
|
||||
syntax region texCRefZoneRange contained matchgroup=Delimiter
|
||||
\ start="{" end="}"
|
||||
\ contains=@texRefGroup,texRefZone
|
||||
\ nextgroup=texCRefZone skipwhite skipnl
|
||||
syntax region texCRefLabelOpts contained matchgroup=Delimiter
|
||||
\ start='\[' end=']'
|
||||
\ contains=@texRefGroup,texRefZone
|
||||
|
||||
highlight link texCRefZone texRefZone
|
||||
highlight link texCRefZoneRange texRefZone
|
||||
highlight link texCRefLabelOpts texCmdArgs
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
18
autoload/vimtex/syntax/p/csquotes.vim
Normal file
18
autoload/vimtex/syntax/p/csquotes.vim
Normal file
@@ -0,0 +1,18 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#csquotes#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'csquotes') | return | endif
|
||||
let b:vimtex_syntax.csquotes = 1
|
||||
|
||||
call vimtex#syntax#p#biblatex#load()
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
25
autoload/vimtex/syntax/p/dot2texi.vim
Normal file
25
autoload/vimtex/syntax/p/dot2texi.vim
Normal file
@@ -0,0 +1,25 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#dot2texi#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'dot2texi') | return | endif
|
||||
let b:vimtex_syntax.dot2texi = 1
|
||||
|
||||
call vimtex#syntax#misc#include('dot')
|
||||
call vimtex#syntax#misc#add_to_section_clusters('texZoneDot')
|
||||
syntax region texZoneDot
|
||||
\ start="\\begin{dot2tex}"rs=s
|
||||
\ end="\\end{dot2tex}"re=e
|
||||
\ keepend
|
||||
\ transparent
|
||||
\ contains=texBeginEnd,@vimtex_nested_dot
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
20
autoload/vimtex/syntax/p/glossaries.vim
Normal file
20
autoload/vimtex/syntax/p/glossaries.vim
Normal file
@@ -0,0 +1,20 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! vimtex#syntax#p#glossaries#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'glossaries') | return | endif
|
||||
let b:vimtex_syntax.glossaries = 1
|
||||
|
||||
" Currently nothing here
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
21
autoload/vimtex/syntax/p/glossaries_extra.vim
Normal file
21
autoload/vimtex/syntax/p/glossaries_extra.vim
Normal file
@@ -0,0 +1,21 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! vimtex#syntax#p#glossaries_extra#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'glossaries_extra') | return | endif
|
||||
let b:vimtex_syntax.glossaries_extra = 1
|
||||
|
||||
" Load amsmath
|
||||
call vimtex#syntax#p#glossaries#load()
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
25
autoload/vimtex/syntax/p/gnuplottex.vim
Normal file
25
autoload/vimtex/syntax/p/gnuplottex.vim
Normal file
@@ -0,0 +1,25 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#gnuplottex#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'gnuplottex') | return | endif
|
||||
let b:vimtex_syntax.gnuplottex = 1
|
||||
|
||||
call vimtex#syntax#misc#include('gnuplot')
|
||||
call vimtex#syntax#misc#add_to_section_clusters('texZoneGnuplot')
|
||||
syntax region texZoneGnuplot
|
||||
\ start='\\begin{gnuplot}\(\_s*\[\_[\]]\{-}\]\)\?'rs=s
|
||||
\ end='\\end{gnuplot}'re=e
|
||||
\ keepend
|
||||
\ transparent
|
||||
\ contains=texBeginEnd,texBeginEndModifier,@vimtex_nested_gnuplot
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
35
autoload/vimtex/syntax/p/hyperref.vim
Normal file
35
autoload/vimtex/syntax/p/hyperref.vim
Normal file
@@ -0,0 +1,35 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#hyperref#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'hyperref') | return | endif
|
||||
let b:vimtex_syntax.hyperref = 1
|
||||
|
||||
syntax match texStatement '\\url\ze[^\ta-zA-Z]' nextgroup=texUrlVerb
|
||||
syntax region texUrlVerb matchgroup=Delimiter
|
||||
\ start='\z([^\ta-zA-Z]\)' end='\z1' contained
|
||||
|
||||
syntax match texStatement '\\url\ze\s*{' nextgroup=texUrl
|
||||
syntax region texUrl matchgroup=Delimiter start='{' end='}' contained
|
||||
|
||||
syntax match texStatement '\\href' nextgroup=texHref
|
||||
syntax region texHref matchgroup=Delimiter start='{' end='}' contained
|
||||
\ nextgroup=texMatcher
|
||||
|
||||
syntax match texStatement '\\hyperref' nextgroup=texHyperref
|
||||
syntax region texHyperref matchgroup=Delimiter start='\[' end='\]' contained
|
||||
|
||||
highlight link texUrl Function
|
||||
highlight link texUrlVerb texUrl
|
||||
highlight link texHref texUrl
|
||||
highlight link texHyperref texRefZone
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
75
autoload/vimtex/syntax/p/listings.vim
Normal file
75
autoload/vimtex/syntax/p/listings.vim
Normal file
@@ -0,0 +1,75 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#listings#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'listings') | return | endif
|
||||
let b:vimtex_syntax.listings = s:get_nested_languages()
|
||||
|
||||
" First some general support
|
||||
syntax match texInputFile
|
||||
\ "\\lstinputlisting\s*\(\[.\{-}\]\)\={.\{-}}"
|
||||
\ contains=texStatement,texInputCurlies,texInputFileOpt
|
||||
syntax match texZone "\\lstinline\s*\(\[.\{-}\]\)\={.\{-}}"
|
||||
|
||||
" Set all listings environments to listings
|
||||
syntax cluster texFoldGroup add=texZoneListings
|
||||
syntax region texZoneListings
|
||||
\ start="\\begin{lstlisting}\(\_s*\[\_[^\]]\{-}\]\)\?"rs=s
|
||||
\ end="\\end{lstlisting}\|%stopzone\>"re=e
|
||||
\ keepend
|
||||
\ contains=texBeginEnd
|
||||
|
||||
" Next add nested syntax support for desired languages
|
||||
for l:nested in b:vimtex_syntax.listings
|
||||
let l:cluster = vimtex#syntax#misc#include(l:nested)
|
||||
if empty(l:cluster) | continue | endif
|
||||
|
||||
let l:group_main = 'texZoneListings' . toupper(l:nested[0]) . l:nested[1:]
|
||||
let l:group_lstset = l:group_main . 'Lstset'
|
||||
let l:group_contained = l:group_main . 'Contained'
|
||||
execute 'syntax cluster texFoldGroup add=' . l:group_main
|
||||
execute 'syntax cluster texFoldGroup add=' . l:group_lstset
|
||||
|
||||
execute 'syntax region' l:group_main
|
||||
\ 'start="\c\\begin{lstlisting}\s*'
|
||||
\ . '\[\_[^\]]\{-}language=' . l:nested . '\%(\s*,\_[^\]]\{-}\)\?\]"rs=s'
|
||||
\ 'end="\\end{lstlisting}"re=e'
|
||||
\ 'keepend'
|
||||
\ 'transparent'
|
||||
\ 'contains=texBeginEnd,@' . l:cluster
|
||||
|
||||
execute 'syntax match' l:group_lstset
|
||||
\ '"\c\\lstset{.*language=' . l:nested . '\%(\s*,\|}\)"'
|
||||
\ 'transparent'
|
||||
\ 'contains=texStatement,texMatcher'
|
||||
\ 'skipwhite skipempty'
|
||||
\ 'nextgroup=' . l:group_contained
|
||||
|
||||
execute 'syntax region' l:group_contained
|
||||
\ 'start="\\begin{lstlisting}"rs=s'
|
||||
\ 'end="\\end{lstlisting}"re=e'
|
||||
\ 'keepend'
|
||||
\ 'transparent'
|
||||
\ 'containedin=' . l:group_lstset
|
||||
\ 'contains=texStatement,texBeginEnd,@' . l:cluster
|
||||
endfor
|
||||
|
||||
highlight link texZoneListings texZone
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
function! s:get_nested_languages() abort " {{{1
|
||||
return map(
|
||||
\ filter(getline(1, '$'), "v:val =~# 'language='"),
|
||||
\ 'matchstr(v:val, ''language=\zs\w\+'')')
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
31
autoload/vimtex/syntax/p/luacode.vim
Normal file
31
autoload/vimtex/syntax/p/luacode.vim
Normal file
@@ -0,0 +1,31 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#luacode#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'luacode') | return | endif
|
||||
let b:vimtex_syntax.luacode = 1
|
||||
|
||||
call vimtex#syntax#misc#include('lua')
|
||||
call vimtex#syntax#misc#add_to_section_clusters('texZoneLua')
|
||||
syntax region texZoneLua
|
||||
\ start='\\begin{luacode\*\?}'rs=s
|
||||
\ end='\\end{luacode\*\?}'re=e
|
||||
\ keepend
|
||||
\ transparent
|
||||
\ contains=texBeginEnd,@vimtex_nested_lua
|
||||
syntax match texStatement '\\\(directlua\|luadirect\)' nextgroup=texZoneLuaArg
|
||||
syntax region texZoneLuaArg matchgroup=Delimiter
|
||||
\ start='{'
|
||||
\ end='}'
|
||||
\ contained
|
||||
\ contains=@vimtex_nested_lua
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
43
autoload/vimtex/syntax/p/markdown.vim
Normal file
43
autoload/vimtex/syntax/p/markdown.vim
Normal file
@@ -0,0 +1,43 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#markdown#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'markdown') | return | endif
|
||||
let b:vimtex_syntax.markdown = 1
|
||||
|
||||
call vimtex#syntax#misc#add_to_section_clusters('texZoneMarkdown')
|
||||
call vimtex#syntax#misc#include('markdown')
|
||||
|
||||
" Don't quite know why this is necessary, but it is
|
||||
syntax match texBeginEnd
|
||||
\ '\(\\begin\>\|\\end\>\)\ze{markdown}'
|
||||
\ nextgroup=texBeginEndName
|
||||
|
||||
syntax region texZoneMarkdown
|
||||
\ start='\\begin{markdown}'rs=s
|
||||
\ end='\\end{markdown}'re=e
|
||||
\ keepend
|
||||
\ transparent
|
||||
\ contains=@texFoldGroup,@texDocGroup,@vimtex_nested_markdown
|
||||
|
||||
" Input files
|
||||
syntax match texInputFile /\\markdownInput\>/
|
||||
\ contains=texStatement
|
||||
\ nextgroup=texInputFileArg
|
||||
syntax region texInputFileArg
|
||||
\ matchgroup=texInputCurlies
|
||||
\ start="{" end="}"
|
||||
\ contained
|
||||
\ contains=texComment
|
||||
|
||||
highlight default link texInputFileArg texInputFile
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
21
autoload/vimtex/syntax/p/mathtools.vim
Normal file
21
autoload/vimtex/syntax/p/mathtools.vim
Normal file
@@ -0,0 +1,21 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! vimtex#syntax#p#mathtools#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'mathtools') | return | endif
|
||||
let b:vimtex_syntax.mathtools = 1
|
||||
|
||||
" Load amsmath
|
||||
call vimtex#syntax#p#amsmath#load()
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
256
autoload/vimtex/syntax/p/minted.vim
Normal file
256
autoload/vimtex/syntax/p/minted.vim
Normal file
@@ -0,0 +1,256 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#minted#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'minted') | return | endif
|
||||
let b:vimtex_syntax.minted = 1
|
||||
|
||||
" Parse minted macros in the current project
|
||||
call s:parse_minted_constructs()
|
||||
|
||||
" Match minted language names
|
||||
syntax region texMintedName matchgroup=Delimiter start="{" end="}" contained
|
||||
syntax region texMintedNameOpt matchgroup=Delimiter start="\[" end="\]" contained
|
||||
|
||||
" Match boundaries of minted environments
|
||||
syntax match texMintedBounds '\\end{minted}'
|
||||
\ contained
|
||||
\ contains=texBeginEnd
|
||||
syntax match texMintedBounds '\\begin{minted}'
|
||||
\ contained
|
||||
\ contains=texBeginEnd
|
||||
\ nextgroup=texMintedBoundsOpts,texMintedName
|
||||
syntax region texMintedBoundsOpts matchgroup=Delimiter
|
||||
\ start="\[" end="\]"
|
||||
\ contained
|
||||
\ nextgroup=texMintedName
|
||||
|
||||
" Match starred custom minted environments with options
|
||||
syntax match texMintedStarred "\\begin{\w\+\*}"
|
||||
\ contained
|
||||
\ contains=texBeginEnd
|
||||
\ nextgroup=texMintedStarredOpts
|
||||
syntax region texMintedStarredOpts matchgroup=Delimiter
|
||||
\ start='{'
|
||||
\ end='}'
|
||||
\ contained
|
||||
\ containedin=texMintedStarred
|
||||
|
||||
" Match \newminted type macros
|
||||
syntax match texStatement '\\newmint\%(ed\|inline\)\?' nextgroup=texMintedName,texMintedNameOpt
|
||||
|
||||
" Match "unknown" environments
|
||||
call vimtex#syntax#misc#add_to_section_clusters('texZoneMinted')
|
||||
syntax region texZoneMinted
|
||||
\ start="\\begin{minted}\%(\_s*\[\_[^\]]\{-}\]\)\?\_s*{\w\+}"rs=s
|
||||
\ end="\\end{minted}"re=e
|
||||
\ keepend
|
||||
\ contains=texMintedBounds.*
|
||||
|
||||
" Match "unknown" commands
|
||||
syntax match texArgMinted "{\w\+}"
|
||||
\ contained
|
||||
\ contains=texMintedName
|
||||
\ nextgroup=texZoneMintedCmd
|
||||
syntax region texZoneMintedCmd matchgroup=Delimiter
|
||||
\ start='\z([|+/]\)'
|
||||
\ end='\z1'
|
||||
\ contained
|
||||
syntax region texZoneMintedCmd matchgroup=Delimiter
|
||||
\ start='{'
|
||||
\ end='}'
|
||||
\ contained
|
||||
|
||||
" Next add nested syntax support for desired languages
|
||||
for [l:nested, l:config] in items(b:vimtex.syntax.minted)
|
||||
let l:cluster = vimtex#syntax#misc#include(l:nested)
|
||||
|
||||
let l:name = 'Minted' . toupper(l:nested[0]) . l:nested[1:]
|
||||
let l:group_main = 'texZone' . l:name
|
||||
let l:group_arg = 'texArg' . l:name
|
||||
let l:group_arg_zone = 'texArgZone' . l:name
|
||||
call vimtex#syntax#misc#add_to_section_clusters(l:group_main)
|
||||
|
||||
if empty(l:cluster)
|
||||
let l:transparent = ''
|
||||
let l:contains_env = ''
|
||||
let l:contains_macro = ''
|
||||
execute 'highlight link' l:group_main 'texZoneMinted'
|
||||
execute 'highlight link' l:group_arg_zone 'texZoneMinted'
|
||||
else
|
||||
let l:transparent = 'transparent'
|
||||
let l:contains_env = ',@' . l:cluster
|
||||
let l:contains_macro = 'contains=@' . l:cluster
|
||||
endif
|
||||
|
||||
" Match minted environment
|
||||
execute 'syntax region' l:group_main
|
||||
\ 'start="\\begin{minted}\%(\_s*\[\_[^\]]\{-}\]\)\?\_s*{' . l:nested . '}"rs=s'
|
||||
\ 'end="\\end{minted}"re=e'
|
||||
\ 'keepend'
|
||||
\ l:transparent
|
||||
\ 'contains=texMintedBounds.*' . l:contains_env
|
||||
|
||||
" Match custom environment names
|
||||
for l:env in get(l:config, 'environments', [])
|
||||
execute 'syntax region' l:group_main
|
||||
\ 'start="\\begin{\z(' . l:env . '\*\?\)}"rs=s'
|
||||
\ 'end="\\end{\z1}"re=e'
|
||||
\ 'keepend'
|
||||
\ l:transparent
|
||||
\ 'contains=texMintedStarred,texBeginEnd' . l:contains_env
|
||||
endfor
|
||||
|
||||
" Match minted macros
|
||||
" - \mint[]{lang}|...|
|
||||
" - \mint[]{lang}{...}
|
||||
" - \mintinline[]{lang}|...|
|
||||
" - \mintinline[]{lang}{...}
|
||||
execute 'syntax match' l:group_arg '''{' . l:nested . '}'''
|
||||
\ 'contained'
|
||||
\ 'contains=texMintedName'
|
||||
\ 'nextgroup=' . l:group_arg_zone
|
||||
execute 'syntax region' l:group_arg_zone
|
||||
\ 'matchgroup=Delimiter'
|
||||
\ 'start=''\z([|+/]\)'''
|
||||
\ 'end=''\z1'''
|
||||
\ 'contained'
|
||||
\ l:contains_macro
|
||||
execute 'syntax region' l:group_arg_zone
|
||||
\ 'matchgroup=Delimiter'
|
||||
\ 'start=''{'''
|
||||
\ 'end=''}'''
|
||||
\ 'contained'
|
||||
\ l:contains_macro
|
||||
|
||||
" Match minted custom macros
|
||||
for l:cmd in sort(get(l:config, 'commands', []))
|
||||
execute printf('syntax match texStatement ''\\%s'' nextgroup=%s',
|
||||
\ l:cmd, l:group_arg_zone)
|
||||
endfor
|
||||
endfor
|
||||
|
||||
" Main matcher for the minted statements/commands
|
||||
" - Note: This comes last to allow the nextgroup pattern
|
||||
syntax match texStatement '\\mint\(inline\)\?' nextgroup=texArgOptMinted,texArgMinted.*
|
||||
syntax region texArgOptMinted matchgroup=Delimiter
|
||||
\ start='\['
|
||||
\ end='\]'
|
||||
\ contained
|
||||
\ nextgroup=texArgMinted.*
|
||||
|
||||
highlight link texZoneMinted texZone
|
||||
highlight link texZoneMintedCmd texZone
|
||||
highlight link texMintedName texInputFileOpt
|
||||
highlight link texMintedNameOpt texMintedName
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
function! s:parse_minted_constructs() abort " {{{1
|
||||
if has_key(b:vimtex.syntax, 'minted') | return | endif
|
||||
|
||||
let l:db = deepcopy(s:db)
|
||||
let b:vimtex.syntax.minted = l:db.data
|
||||
|
||||
let l:in_multi = 0
|
||||
for l:line in vimtex#parser#tex(b:vimtex.tex, {'detailed': 0})
|
||||
" Multiline minted environments
|
||||
if l:in_multi
|
||||
let l:lang = matchstr(l:line, '\]\s*{\zs\w\+\ze}')
|
||||
if !empty(l:lang)
|
||||
call l:db.register(l:lang)
|
||||
let l:in_multi = 0
|
||||
endif
|
||||
continue
|
||||
endif
|
||||
if l:line =~# '\\begin{minted}\s*\[[^\]]*$'
|
||||
let l:in_multi = 1
|
||||
continue
|
||||
endif
|
||||
|
||||
" Single line minted environments
|
||||
let l:lang = matchstr(l:line, '\\begin{minted}\%(\s*\[\[^\]]*\]\)\?\s*{\zs\w\+\ze}')
|
||||
if !empty(l:lang)
|
||||
call l:db.register(l:lang)
|
||||
continue
|
||||
endif
|
||||
|
||||
" Simple minted commands
|
||||
let l:lang = matchstr(l:line, '\\mint\%(\s*\[[^\]]*\]\)\?\s*{\zs\w\+\ze}')
|
||||
if !empty(l:lang)
|
||||
call l:db.register(l:lang)
|
||||
continue
|
||||
endif
|
||||
|
||||
" Custom environments:
|
||||
" - \newminted{lang}{opts} -> langcode
|
||||
" - \newminted[envname]{lang}{opts} -> envname
|
||||
let l:matches = matchlist(l:line,
|
||||
\ '\\newminted\%(\s*\[\([^\]]*\)\]\)\?\s*{\([a-zA-Z-]\+\)}')
|
||||
if !empty(l:matches)
|
||||
call l:db.register(l:matches[2])
|
||||
call l:db.add_environment(!empty(l:matches[1])
|
||||
\ ? l:matches[1]
|
||||
\ : l:matches[2] . 'code')
|
||||
continue
|
||||
endif
|
||||
|
||||
" Custom macros:
|
||||
" - \newmint(inline){lang}{opts} -> \lang(inline)
|
||||
" - \newmint(inline)[macroname]{lang}{opts} -> \macroname
|
||||
let l:matches = matchlist(l:line,
|
||||
\ '\\newmint\(inline\)\?\%(\s*\[\([^\]]*\)\]\)\?\s*{\([a-zA-Z-]\+\)}')
|
||||
if !empty(l:matches)
|
||||
call l:db.register(l:matches[3])
|
||||
call l:db.add_macro(!empty(l:matches[2])
|
||||
\ ? l:matches[2]
|
||||
\ : l:matches[3] . l:matches[1])
|
||||
continue
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
|
||||
let s:db = {
|
||||
\ 'data' : {},
|
||||
\}
|
||||
|
||||
function! s:db.register(lang) abort dict " {{{1
|
||||
" Avoid dashes in langnames
|
||||
let l:lang = substitute(a:lang, '-', '', 'g')
|
||||
|
||||
if !has_key(self.data, l:lang)
|
||||
let self.data[l:lang] = {
|
||||
\ 'environments' : [],
|
||||
\ 'commands' : [],
|
||||
\}
|
||||
endif
|
||||
|
||||
let self.cur = self.data[l:lang]
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
function! s:db.add_environment(envname) abort dict " {{{1
|
||||
if index(self.cur.environments, a:envname) < 0
|
||||
let self.cur.environments += [a:envname]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
function! s:db.add_macro(macroname) abort dict " {{{1
|
||||
if index(self.cur.commands, a:macroname) < 0
|
||||
let self.cur.commands += [a:macroname]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
26
autoload/vimtex/syntax/p/moreverb.vim
Normal file
26
autoload/vimtex/syntax/p/moreverb.vim
Normal file
@@ -0,0 +1,26 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#moreverb#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'moreverb') | return | endif
|
||||
let b:vimtex_syntax.moreverb = 1
|
||||
|
||||
if exists('g:tex_verbspell')
|
||||
syntax region texZone start="\\begin{verbatimtab}" end="\\end{verbatimtab}\|%stopzone\>" contains=@Spell
|
||||
syntax region texZone start="\\begin{verbatimwrite}" end="\\end{verbatimwrite}\|%stopzone\>" contains=@Spell
|
||||
syntax region texZone start="\\begin{boxedverbatim}" end="\\end{boxedverbatim}\|%stopzone\>" contains=@Spell
|
||||
else
|
||||
syntax region texZone start="\\begin{verbatimtab}" end="\\end{verbatimtab}\|%stopzone\>"
|
||||
syntax region texZone start="\\begin{verbatimwrite}" end="\\end{verbatimwrite}\|%stopzone\>"
|
||||
syntax region texZone start="\\begin{boxedverbatim}" end="\\end{boxedverbatim}\|%stopzone\>"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
18
autoload/vimtex/syntax/p/natbib.vim
Normal file
18
autoload/vimtex/syntax/p/natbib.vim
Normal file
@@ -0,0 +1,18 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#natbib#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'natbib') | return | endif
|
||||
let b:vimtex_syntax.natbib = 1
|
||||
|
||||
call vimtex#syntax#p#biblatex#load()
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
33
autoload/vimtex/syntax/p/pdfpages.vim
Normal file
33
autoload/vimtex/syntax/p/pdfpages.vim
Normal file
@@ -0,0 +1,33 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#pdfpages#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'pdfpages') | return | endif
|
||||
let b:vimtex_syntax.pdfpages = 1
|
||||
|
||||
syntax match texInputFile /\\includepdf\>/
|
||||
\ contains=texStatement
|
||||
\ nextgroup=texInputFileOpt,texInputFileArg
|
||||
syntax region texInputFileOpt
|
||||
\ matchgroup=Delimiter
|
||||
\ start="\[" end="\]"
|
||||
\ contained
|
||||
\ contains=texComment,@NoSpell
|
||||
\ nextgroup=texInputFileArg
|
||||
syntax region texInputFileArg
|
||||
\ matchgroup=texInputCurlies
|
||||
\ start="{" end="}"
|
||||
\ contained
|
||||
\ contains=texComment
|
||||
|
||||
highlight default link texInputFileArg texInputFile
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
38
autoload/vimtex/syntax/p/pgfplots.vim
Normal file
38
autoload/vimtex/syntax/p/pgfplots.vim
Normal file
@@ -0,0 +1,38 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#pgfplots#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'pgfplots') | return | endif
|
||||
let b:vimtex_syntax.pgfplots = 1
|
||||
|
||||
" Load Tikz first
|
||||
call vimtex#syntax#p#tikz#load()
|
||||
|
||||
" Add texAxisStatement to Tikz cluster
|
||||
syntax cluster texTikz add=texAxisStatement
|
||||
|
||||
" Match pgfplotsset and axis environments
|
||||
syntax match texTikzSet /\\pgfplotsset\>/
|
||||
\ contains=texStatement skipwhite nextgroup=texTikzOptsCurly
|
||||
syntax match texTikzEnv /\v\\begin\{%(log)*axis}/
|
||||
\ contains=texBeginEnd nextgroup=texTikzOpts skipwhite
|
||||
syntax match texTikzEnv /\v\\begin\{groupplot}/
|
||||
\ contains=texBeginEnd nextgroup=texTikzOpts skipwhite
|
||||
|
||||
" Match some custom pgfplots macros
|
||||
syntax match texAxisStatement /\\addplot3\>/
|
||||
\ contained skipwhite nextgroup=texTikzOpts
|
||||
syntax match texAxisStatement /\\nextgroupplot\>/
|
||||
\ contained skipwhite nextgroup=texTikzOpts
|
||||
|
||||
highlight def link texAxisStatement texStatement
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
40
autoload/vimtex/syntax/p/pythontex.vim
Normal file
40
autoload/vimtex/syntax/p/pythontex.vim
Normal file
@@ -0,0 +1,40 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#pythontex#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'pythontex') | return | endif
|
||||
let b:vimtex_syntax.pythontex = 1
|
||||
|
||||
call vimtex#syntax#misc#include('python')
|
||||
|
||||
syntax match texStatement /\\py[bsc]\?/ contained nextgroup=texPythontexArg
|
||||
syntax region texPythontexArg matchgroup=Delimiter
|
||||
\ start='{' end='}'
|
||||
\ contained contains=@vimtex_nested_python
|
||||
syntax region texPythontexArg matchgroup=Delimiter
|
||||
\ start='\z([#@]\)' end='\z1'
|
||||
\ contained contains=@vimtex_nested_python
|
||||
|
||||
call vimtex#syntax#misc#add_to_section_clusters('texZonePythontex')
|
||||
syntax region texZonePythontex
|
||||
\ start='\\begin{pyblock}'rs=s
|
||||
\ end='\\end{pyblock}'re=e
|
||||
\ keepend
|
||||
\ transparent
|
||||
\ contains=texBeginEnd,@vimtex_nested_python
|
||||
syntax region texZonePythontex
|
||||
\ start='\\begin{pycode}'rs=s
|
||||
\ end='\\end{pycode}'re=e
|
||||
\ keepend
|
||||
\ transparent
|
||||
\ contains=texBeginEnd,@vimtex_nested_python
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
19
autoload/vimtex/syntax/p/subfile.vim
Normal file
19
autoload/vimtex/syntax/p/subfile.vim
Normal file
@@ -0,0 +1,19 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#subfile#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'subfile') | return | endif
|
||||
let b:vimtex_syntax.subfile = 1
|
||||
|
||||
syntax match texInputFile /\\subfile\s*\%(\[.\{-}\]\)\=\s*{.\{-}}/
|
||||
\ contains=texStatement,texInputCurlies,texInputFileOpt
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
77
autoload/vimtex/syntax/p/tabularx.vim
Normal file
77
autoload/vimtex/syntax/p/tabularx.vim
Normal file
@@ -0,0 +1,77 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#tabularx#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'tabularx') | return | endif
|
||||
let b:vimtex_syntax.tabularx = 1
|
||||
|
||||
call vimtex#syntax#misc#add_to_section_clusters('texTabular')
|
||||
|
||||
syntax match texTabular '\\begin{tabular}\_[^{]\{-}\ze{'
|
||||
\ contains=texBeginEnd
|
||||
\ nextgroup=texTabularArg
|
||||
\ contained
|
||||
syntax region texTabularArg matchgroup=Delimiter
|
||||
\ start='{' end='}'
|
||||
\ contained
|
||||
|
||||
syntax match texTabularCol /[lcr]/
|
||||
\ containedin=texTabularArg
|
||||
\ contained
|
||||
syntax match texTabularCol /[pmb]/
|
||||
\ containedin=texTabularArg
|
||||
\ nextgroup=texTabularLength
|
||||
\ contained
|
||||
syntax match texTabularCol /\*/
|
||||
\ containedin=texTabularArg
|
||||
\ nextgroup=texTabularMulti
|
||||
\ contained
|
||||
syntax region texTabularMulti matchgroup=Delimiter
|
||||
\ start='{' end='}'
|
||||
\ containedin=texTabularArg
|
||||
\ nextgroup=texTabularArg
|
||||
\ contained
|
||||
|
||||
syntax match texTabularAtSep /@/
|
||||
\ containedin=texTabularArg
|
||||
\ nextgroup=texTabularLength
|
||||
\ contained
|
||||
syntax match texTabularVertline /||\?/
|
||||
\ containedin=texTabularArg
|
||||
\ contained
|
||||
syntax match texTabularPostPre /[<>]/
|
||||
\ containedin=texTabularArg
|
||||
\ nextgroup=texTabularPostPreArg
|
||||
\ contained
|
||||
|
||||
syntax region texTabularPostPreArg matchgroup=Delimiter
|
||||
\ start='{' end='}'
|
||||
\ containedin=texTabularArg
|
||||
\ contains=texLength,texStatement,texMathDelimSingle
|
||||
\ contained
|
||||
|
||||
syntax region texTabularLength matchgroup=Delimiter
|
||||
\ start='{' end='}'
|
||||
\ containedin=texTabularArg
|
||||
\ contains=texLength,texStatement
|
||||
\ contained
|
||||
|
||||
syntax match texMathDelimSingle /\$\$\?/
|
||||
\ containedin=texTabularPostPreArg
|
||||
\ contained
|
||||
|
||||
highlight def link texTabularCol Directory
|
||||
highlight def link texTabularAtSep Type
|
||||
highlight def link texTabularVertline Type
|
||||
highlight def link texTabularPostPre Type
|
||||
highlight def link texMathDelimSingle Delimiter
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
47
autoload/vimtex/syntax/p/tikz.vim
Normal file
47
autoload/vimtex/syntax/p/tikz.vim
Normal file
@@ -0,0 +1,47 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#tikz#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'tikz') | return | endif
|
||||
let b:vimtex_syntax.tikz = 1
|
||||
|
||||
call vimtex#syntax#misc#add_to_section_clusters('texTikzSet')
|
||||
call vimtex#syntax#misc#add_to_section_clusters('texTikzpicture')
|
||||
|
||||
" Define clusters
|
||||
syntax cluster texTikz contains=texTikzEnv,texBeginEnd,texStatement,texTikzSemicolon,texComment,@texVimtexGlobal
|
||||
syntax cluster texTikzOS contains=texTikzOptsCurly,texTikzEqual,texMathZoneX,texTypeSize,texStatement,texLength,texComment
|
||||
|
||||
" Define tikz option groups
|
||||
syntax match texTikzSet /\\tikzset\>/
|
||||
\ contains=texStatement skipwhite nextgroup=texTikzOptsCurly
|
||||
syntax region texTikzOpts matchgroup=Delimiter
|
||||
\ start='\[' end='\]' contained contains=@texTikzOS
|
||||
syntax region texTikzOptsCurly matchgroup=Delimiter
|
||||
\ start='{' end='}' contained contains=@texTikzOS
|
||||
|
||||
syntax region texTikzpicture
|
||||
\ start='\\begin{tikzpicture}'rs=s
|
||||
\ end='\\end{tikzpicture}'re=e
|
||||
\ keepend
|
||||
\ transparent
|
||||
\ contains=@texTikz
|
||||
syntax match texTikzEnv /\v\\begin\{tikzpicture\}/
|
||||
\ contains=texBeginEnd nextgroup=texTikzOpts skipwhite
|
||||
|
||||
syntax match texTikzEqual /=/ contained
|
||||
syntax match texTikzSemicolon /;/ contained
|
||||
|
||||
highlight def link texTikzEqual Operator
|
||||
highlight def link texTikzSemicolon Delimiter
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
|
||||
endif
|
||||
18
autoload/vimtex/syntax/p/url.vim
Normal file
18
autoload/vimtex/syntax/p/url.vim
Normal file
@@ -0,0 +1,18 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#url#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'url') | return | endif
|
||||
let b:vimtex_syntax.url = 1
|
||||
|
||||
call vimtex#syntax#p#hyperref#load()
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
25
autoload/vimtex/syntax/p/varioref.vim
Normal file
25
autoload/vimtex/syntax/p/varioref.vim
Normal file
@@ -0,0 +1,25 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#varioref#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'varioref') | return | endif
|
||||
let b:vimtex_syntax.varioref = 1
|
||||
if get(g:, 'tex_fast', 'r') !~# 'r' | return | endif
|
||||
|
||||
syntax match texStatement '\\Vref\>' nextgroup=texVarioRefZone
|
||||
|
||||
syntax region texVarioRefZone contained matchgroup=Delimiter
|
||||
\ start="{" end="}"
|
||||
\ contains=@texRefGroup,texRefZone
|
||||
|
||||
highlight link texVarioRefZone texRefZone
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
26
autoload/vimtex/syntax/p/wiki.vim
Normal file
26
autoload/vimtex/syntax/p/wiki.vim
Normal file
@@ -0,0 +1,26 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||
|
||||
" vimtex - LaTeX plugin for Vim
|
||||
"
|
||||
" Maintainer: Karl Yngve Lervåg
|
||||
" Email: karl.yngve@gmail.com
|
||||
"
|
||||
|
||||
function! vimtex#syntax#p#wiki#load() abort " {{{1
|
||||
if has_key(b:vimtex_syntax, 'wiki') | return | endif
|
||||
let b:vimtex_syntax.wiki = 1
|
||||
|
||||
call vimtex#syntax#misc#add_to_section_clusters('texZoneWiki')
|
||||
call vimtex#syntax#misc#include('markdown')
|
||||
|
||||
syntax region texZoneWiki
|
||||
\ start='\\wikimarkup\>'
|
||||
\ end='\\nowikimarkup\>'re=e
|
||||
\ keepend
|
||||
\ transparent
|
||||
\ contains=@vimtex_nested_markdown,@texFoldGroup,@texDocGroup
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
endif
|
||||
Reference in New Issue
Block a user