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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
" VimTeX - LaTeX plugin for Vim
"
" Maintainer: Karl Yngve LervÄg
" Email: karl.yngve@gmail.com
"
function! vimtex#syntax#p#hyperref#load(cfg) abort " {{{1
call vimtex#syntax#packages#load('nameref')
syntax match texCmdHyperref '\\autoref\>'
\ skipwhite nextgroup=texRefOpt,texRefArg
syntax match texCmdHyperref '\\hyperref\>'
\ skipwhite nextgroup=texRefOpt,texRefArg
syntax match texCmdHyperref "\\url\>"
\ skipwhite nextgroup=texUrlArg
call vimtex#syntax#core#new_arg('texUrlArg', {'contains': '@NoSpell'})
if a:cfg.conceal
syntax match texCmdHyperref '\\href\>'
\ skipwhite nextgroup=texHrefArgLink
\ conceal
call vimtex#syntax#core#new_arg('texHrefArgLink', {
\ 'opts': 'contained conceal',
\ 'next': 'texHrefArgTextC',
\ 'contains': 'texHrefLinkGroup,@NoSpell',
\})
call vimtex#syntax#core#new_arg('texHrefLinkGroup', {
\ 'matchgroup': 'matchgroup=NONE',
\ 'opts': 'contained conceal',
\ 'contains': 'texHrefLinkGroup',
\})
call vimtex#syntax#core#new_arg('texHrefArgTextC', {
\ 'opts': 'contained concealends',
\})
syntax match texCmdHyperref '\\texorpdfstring\>'
\ skipwhite nextgroup=texTOPSArgTex
\ conceal
call vimtex#syntax#core#new_arg('texTOPSArgTex', {
\ 'opts': 'contained concealends transparent',
\ 'next': 'texTOPSArgPdf',
\})
call vimtex#syntax#core#new_arg('texTOPSArgPdf', {
\ 'opts': 'contained conceal',
\ 'contains': '',
\})
else
syntax match texCmdHyperref '\\href\>'
\ skipwhite nextgroup=texHrefArgLink
call vimtex#syntax#core#new_arg('texHrefArgLink', {
\ 'next': 'texHrefArgText',
\ 'contains': 'texHrefLinkGroup,@NoSpell',
\})
call vimtex#syntax#core#new_arg('texHrefLinkGroup', {
\ 'matchgroup': 'matchgroup=NONE',
\ 'contains': 'texHrefLinkGroup',
\})
call vimtex#syntax#core#new_arg('texHrefArgText')
syntax match texCmdHyperref '\\texorpdfstring\>'
\ skipwhite nextgroup=texTOPSArgTex
call vimtex#syntax#core#new_arg('texTOPSArgTex', {
\ 'opts': 'contained transparent',
\ 'next': 'texTOPSArgPdf',
\})
call vimtex#syntax#core#new_arg('texTOPSArgPdf', {
\ 'contains': '',
\})
endif
highlight def link texCmdHyperref texCmd
highlight def link texHrefArgLink texOpt
highlight def link texHrefArgTextC texArg
highlight def link texHrefLinkGroup texHrefArgLink
highlight def link texUrlArg texOpt
highlight def link texTOPSArgPdf texOpt
endfunction
" }}}1
|