diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-04-25 21:30:46 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-04-25 21:30:46 +0200 |
commit | d757bfd643cc73c2d495355c153ed0257f5d5b47 (patch) | |
tree | ff210950456938a779d98f6a2ba7321aca512897 /autoload/vimtex/syntax/load.vim | |
parent | 8ec73a3a8974a62a613680a6b6222a77a7b99546 (diff) | |
download | vim-polyglot-d757bfd643cc73c2d495355c153ed0257f5d5b47.tar.gz vim-polyglot-d757bfd643cc73c2d495355c153ed0257f5d5b47.zip |
Change latex provider to luatex, closes #476
Diffstat (limited to 'autoload/vimtex/syntax/load.vim')
-rw-r--r-- | autoload/vimtex/syntax/load.vim | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/autoload/vimtex/syntax/load.vim b/autoload/vimtex/syntax/load.vim new file mode 100644 index 00000000..d1b8b09b --- /dev/null +++ b/autoload/vimtex/syntax/load.vim @@ -0,0 +1,82 @@ +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#load#general() abort " {{{1 + " I don't see why we can't match Math zones in the MatchNMGroup + if !exists('g:tex_no_math') + syntax cluster texMatchNMGroup add=@texMathZones + endif + + " Todo elements + syntax match texStatement '\\todo\w*' contains=texTodo + syntax match texTodo '\\todo\w*' + + " Fix strange mistake in main syntax file where \usepackage is added to the + " texInputFile group + syntax match texDocType /\\usepackage\>/ + \ nextgroup=texBeginEndName,texDocTypeArgs + + " Improve support for italic font, bold font and some conceals + if get(g:, 'tex_fast', 'b') =~# 'b' + let s:conceal = (has('conceal') && get(g:, 'tex_conceal', 'b') =~# 'b') + \ ? 'concealends' : '' + + for [s:style, s:group, s:commands] in [ + \ ['texItalStyle', 'texItalGroup', ['emph', 'textit']], + \ ['texBoldStyle', 'texBoldGroup', ['textbf']], + \] + for s:cmd in s:commands + execute 'syntax region' s:style 'matchgroup=texTypeStyle' + \ 'start="\\' . s:cmd . '\s*{" end="}"' + \ 'contains=@Spell,@' . s:group + \ s:conceal + endfor + execute 'syntax cluster texMatchGroup add=' . s:style + endfor + endif + + " Allow arguments in newenvironments + syntax region texEnvName contained matchgroup=Delimiter + \ start="{"rs=s+1 end="}" + \ nextgroup=texEnvBgn,texEnvArgs contained skipwhite skipnl + syntax region texEnvArgs contained matchgroup=Delimiter + \ start="\["rs=s+1 end="]" + \ nextgroup=texEnvBgn,texEnvArgs skipwhite skipnl + syntax cluster texEnvGroup add=texDefParm,texNewEnv,texComment + + " Add support for \renewenvironment and \renewcommand + syntax match texNewEnv "\\renewenvironment\>" + \ nextgroup=texEnvName skipwhite skipnl + syntax match texNewCmd "\\renewcommand\>" + \ nextgroup=texCmdName skipwhite skipnl + + " Match nested DefParms + syntax match texDefParmNested contained "##\+\d\+" + highlight def link texDefParmNested Identifier + syntax cluster texEnvGroup add=texDefParmNested + syntax cluster texCmdGroup add=texDefParmNested +endfunction + +" }}}1 +function! vimtex#syntax#load#packages() abort " {{{1 + try + call vimtex#syntax#p#{b:vimtex.documentclass}#load() + catch /E117:/ + endtry + + for l:pkg in map(keys(b:vimtex.packages), "substitute(v:val, '-', '_', 'g')") + try + call vimtex#syntax#p#{l:pkg}#load() + catch /E117:/ + endtry + endfor +endfunction + +" }}}1 + +endif |