File: cleveref.vim

package info (click to toggle)
vim-vimtex 2.16-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,660 kB
  • sloc: makefile: 367; python: 103
file content (60 lines) | stat: -rw-r--r-- 2,079 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
" VimTeX - LaTeX plugin for Vim
"
" Maintainer: Karl Yngve LervÄg
" Email:      karl.yngve@gmail.com
"

function! vimtex#syntax#p#cleveref#load(cfg) abort " {{{1
  " \cref, \namecref, etc
  syntax match texCmdCRef nextgroup=texCRefArg skipwhite skipnl
        \ "\v\\%(%(label)?c%(page)?|C)ref>"
  syntax match texCmdCRef nextgroup=texCRefArg skipwhite skipnl
        \ "\v\\%(lc)?name[cC]refs?>"

  " \crefrange, \cpagerefrange (these commands expect two arguments)
  syntax match texCmdCRef nextgroup=texCRefRangeArg skipwhite skipnl
        \ "\\c\%(page\)\?refrange\>"

  " \label[xxx]{asd}
  syntax match texCmdCRef nextgroup=texCRefOpt,texRefArg skipwhite skipnl
        \ "\\label\>"

  " \crefname
  syntax match texCmdCRName nextgroup=texCRNameArgType skipwhite skipnl
        \ "\\[cC]refname\>"

  " Argument and option groups
  call vimtex#syntax#core#new_arg('texCRefArg', {
        \ 'contains': 'texComment,@NoSpell',
        \})
  call vimtex#syntax#core#new_arg('texCRefRangeArg', {
        \ 'next': 'texCRefArg',
        \ 'contains': 'texComment,@NoSpell',
        \})
  call vimtex#syntax#core#new_opt('texCRefOpt', {
        \ 'next': 'texRefArg',
        \ 'opts': 'oneline',
        \})
  call vimtex#syntax#core#new_arg('texCRNameArgType', {
        \ 'next': 'texCRNameArgSingular',
        \ 'contains': 'texComment,@NoSpell',
        \})
  call vimtex#syntax#core#new_arg('texCRNameArgSingular', {
        \ 'next': 'texCRNameArgPlural',
        \ 'contains': 'texComment,@NoSpell'
        \})
  call vimtex#syntax#core#new_arg('texCRNameArgPlural', {
        \ 'contains': 'texComment,@NoSpell'
        \})

  highlight def link texCRefArg           texRefArg
  highlight def link texCRefOpt           texRefOpt
  highlight def link texCRefRangeArg      texRefArg
  highlight def link texCmdCRef           texCmdRef
  highlight def link texCmdCRName         texCmd
  highlight def link texCRNameArgType     texArgNew
  highlight def link texCRNameArgSingular texArg
  highlight def link texCRNameArgPlural   texCRNameArgSingular
endfunction

" }}}1