diff --git a/after/syntax/tex.vim b/after/syntax/tex.vim index 450a044..577fa6a 100644 --- a/after/syntax/tex.vim +++ b/after/syntax/tex.vim @@ -1,5 +1,20 @@ -" Add support for cleverref package (`\cref` and `\Cref`) +" Add support for cleverref package +" \Cref, \cref, \cpageref, \labelcref, \labelcpageref syn region texRefZone matchgroup=texStatement - \ start="\\\(c\|C\)ref{" + \ start="\\\(\(label\)\?c\(page\)\?\|C\)ref{" \ end="}\|%stopzone\>" \ contains=@texRefGroup + +" \crefrange, \cpagerefrange (these commands expect two arguments) +syn match texStatement + \ '\\c\(page\)\?refrange\>' + \ nextgroup=texRefRangeStart +syn region texRefRangeStart matchgroup=texStatement + \ start='{' end='}' + \ contains=texRefZone + \ nextgroup=texRefRangeEnd +syn region texRefRangeEnd matchgroup=texStatement + \ start='{' end='}' + \ contains=texRefZone +hi link texRefRangeStart texRefZone +hi link texRefRangeEnd texRefZone diff --git a/ftplugin/tex.vim b/ftplugin/tex.vim index ffb69cc..1b54be4 100644 --- a/ftplugin/tex.vim +++ b/ftplugin/tex.vim @@ -19,7 +19,7 @@ call latex#util#set_default('g:latex_complete_enabled', 1) call latex#util#set_default('g:latex_complete_close_braces', 0) call latex#util#set_default('g:latex_complete_patterns', \ { - \ 'ref' : '\C\\v\?\(eq\|page\|[cC]\)\?ref\*\?\_\s*{[^{}]*', + \ 'ref' : '\C\\v\?\(eq\|page\|[cC]\|labelc\)\?ref\*\?\_\s*{[^{}]*', \ 'bib' : '\C\\\a*cite\a*\*\?\(\[[^\]]*\]\)*\_\s*{[^{}]*', \ }) call latex#util#set_default('g:latex_errorformat_show_warnings', 1)