diff --git a/after/syntax/tex.vim b/after/syntax/tex.vim index e213012..112b058 100644 --- a/after/syntax/tex.vim +++ b/after/syntax/tex.vim @@ -64,48 +64,42 @@ highlight link texHyperref texRefZone " }}}1 " {{{1 Improve support for cite commands if get(g:, 'tex_fast', 'r') =~# 'r' - " - " biblatex - " - execute 'syntax match texStatement /\v\\%(' . join([ - \ '[Cc]iteauthor\*?', - \ '[Cc]ite%(title|year|date)?\*?', - \ 'citeurl', - \ '[Pp]arencite\*?', - \ 'foot%(full)?cite%(text)?', - \ 'fullcite', - \ '[Tt]extcite', - \ '[Ss]martcite', - \ 'supercite', - \ '[Aa]utocite\*?', - \ '[Ppf]?[Nn]otecite'], '|') . ')/' - \ 'nextgroup=texRefOption,texCite' - execute 'syntax match texStatement /\v\\%(' . join([ - \ '[Cc]ites', - \ '[Pp]arencites', - \ 'footcite%(s|texts)', - \ '[Tt]extcites', - \ '[Ss]martcites', - \ 'supercites', - \ '[Aa]utocites'], '|') . ')/' - \ 'nextgroup=texRefOptions,texCites' + for s:pattern in [ + \ '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', + \] + execute 'syntax match texStatement' + \ '/\v\\' . s:pattern . '\ze\s*\{/' + \ 'nextgroup=texRefOption,texCite' + endfor - execute 'syntax match texStatement /\\[pPfFsStTaA]\?[Vv]olcites\?/' - \ 'nextgroup=texRefOptions,texCites' + for s: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\\' . s:pattern . '\ze\s*\{/' + \ 'nextgroup=texRefOptions,texCites' + endfor - execute 'syntax match texStatement /\\cite\%(field\|list\|name\)/' - \ 'nextgroup=texRefOptions,texCites' - - " - " natbib - " - syntax match texStatement '\\cite\%([tp]\*\?\)\?' - \ nextgroup=texRefOption,texCite - - " - " Common - " syntax region texRefOptions contained matchgroup=Delimiter \ start='\[' end=']' \ contains=@texRefGroup,texRefZone diff --git a/test/features/syntax/test-syntax.tex b/test/features/syntax/test-syntax.tex index c8474f9..c684548 100644 --- a/test/features/syntax/test-syntax.tex +++ b/test/features/syntax/test-syntax.tex @@ -87,6 +87,19 @@ const double pi = 3.1415926535 \urldef{\mysite}\url{http://example.com} \hyperref[asdasd]{asd} +% Cite commands +\citet*{} +\citealt{} +\citealt*{} +\citealp{} +\citealp*{} +\citenum{} +\citetext{} +\citeauthor{} +\citeauthor*{} +\citeyear{} +\citeyearpar{} + \end{document} % vim: fdl=9