Fixed #648: Improve natbib syntax support

This commit is contained in:
Karl Yngve Lervåg 2016-12-28 12:58:01 +01:00
parent 6b5c633fc8
commit 0382995382
2 changed files with 46 additions and 39 deletions

View File

@ -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

View File

@ -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