annotate runtime/syntax/bib.vim @ 17473:466973ba4e87

Added tag v8.1.1734 for changeset dfd87ef822aaa6f313c5e9532f23e6176c73e65e
author Bram Moolenaar <Bram@vim.org>
date Mon, 22 Jul 2019 23:15:05 +0200
parents 3b26420fc639
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim syntax file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: BibTeX (bibliographic database format for (La)TeX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " Maintainer: Bernd Feige <Bernd.Feige@gmx.net>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 " Filenames: *.bib
12756
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 10191
diff changeset
5 " Last Change: 2017 Sep 29
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 " Thanks to those who pointed out problems with this file or supplied fixes!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 " Initialization
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 " ==============
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 9227
diff changeset
11 " quit when a syntax file was already loaded
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 9227
diff changeset
12 if exists("b:current_syntax")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15
3237
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
16 let s:cpo_save = &cpo
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
17 set cpo&vim
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
18
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 " Ignore case
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 syn case ignore
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 " Keywords
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 " ========
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 syn keyword bibType contained article book booklet conference inbook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 syn keyword bibType contained incollection inproceedings manual
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 syn keyword bibType contained mastersthesis misc phdthesis
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 syn keyword bibType contained proceedings techreport unpublished
5763
c52a655d927d Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
28 syn keyword bibType contained string preamble
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 syn keyword bibEntryKw contained address annote author booktitle chapter
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 syn keyword bibEntryKw contained crossref edition editor howpublished
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 syn keyword bibEntryKw contained institution journal key month note
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 syn keyword bibEntryKw contained number organization pages publisher
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 syn keyword bibEntryKw contained school series title type volume year
9227
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
35
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
36 " biblatex keywords, cf. http://mirrors.ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
37 syn keyword bibType contained mvbook bookinbook suppbook collection mvcollection suppcollection
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
38 syn keyword bibType contained online patent periodical suppperiodical mvproceedings reference
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
39 syn keyword bibType contained mvreference inreference report set thesis xdata customa customb
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
40 syn keyword bibType contained customc customd custome customf electronic www artwork audio bibnote
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
41 syn keyword bibType contained commentary image jurisdiction legislation legal letter movie music
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
42 syn keyword bibType contained performance review software standard video
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
43
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
44 syn keyword bibEntryKw contained abstract isbn issn keywords url
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
45 syn keyword bibEntryKw contained addendum afterwordannotation annotation annotator authortype
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
46 syn keyword bibEntryKw contained bookauthor bookpagination booksubtitle booktitleaddon
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
47 syn keyword bibEntryKw contained commentator date doi editora editorb editorc editortype
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
48 syn keyword bibEntryKw contained editoratype editorbtype editorctype eid entrysubtype
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
49 syn keyword bibEntryKw contained eprint eprintclass eprinttype eventdate eventtitle
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
50 syn keyword bibEntryKw contained eventtitleaddon file foreword holder indextitle
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
51 syn keyword bibEntryKw contained introduction isan ismn isrn issue issuesubtitle
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
52 syn keyword bibEntryKw contained issuetitle iswc journalsubtitle journaltitle label
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
53 syn keyword bibEntryKw contained language library location mainsubtitle maintitle
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
54 syn keyword bibEntryKw contained maintitleaddon nameaddon origdate origlanguage
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
55 syn keyword bibEntryKw contained origlocation origpublisher origtitle pagetotal
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
56 syn keyword bibEntryKw contained pagination part pubstate reprinttitle shortauthor
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
57 syn keyword bibEntryKw contained shorteditor shorthand shorthandintro shortjournal
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
58 syn keyword bibEntryKw contained shortseries shorttitle subtitle titleaddon translator
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
59 syn keyword bibEntryKw contained urldate venue version volumes entryset execute gender
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
60 syn keyword bibEntryKw contained langid langidopts ids indexsorttitle options presort
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
61 syn keyword bibEntryKw contained related relatedoptions relatedtype relatedstring
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
62 syn keyword bibEntryKw contained sortkey sortname sortshorthand sorttitle sortyear xdata
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
63 syn keyword bibEntryKw contained xref namea nameb namec nameatype namebtype namectype
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
64 syn keyword bibEntryKw contained lista listb listc listd liste listf usera userb userc
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
65 syn keyword bibEntryKw contained userd usere userf verba verbb verbc archiveprefix pdf
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
66 syn keyword bibEntryKw contained primaryclass
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
67
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 " Non-standard:
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 484
diff changeset
69 " AMS mref http://www.ams.org/mref
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 484
diff changeset
70 syn keyword bibNSEntryKw contained mrclass mrnumber mrreviewer fjournal coden
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 " Clusters
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 " ========
10191
01521953bdf1 commit https://github.com/vim/vim/commit/220adb1e9f9e0b27d28185167d2730bf2f93057d
Christian Brabandt <cb@256bit.org>
parents: 10051
diff changeset
74 syn cluster bibVarContents contains=bibUnescapedSpecial,bibBrace,bibParen,bibMath
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 " This cluster is empty but things can be added externally:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 "syn cluster bibCommentContents
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 " Matches
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 " =======
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 syn match bibUnescapedSpecial contained /[^\\][%&]/hs=s+1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 syn match bibKey contained /\s*[^ \t}="]\+,/hs=s,he=e-1 nextgroup=bibField
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 syn match bibVariable contained /[^{}," \t=]/
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 7
diff changeset
83 syn region bibComment start=/./ end=/^\s*@/me=e-1 contains=@bibCommentContents nextgroup=bibEntry
12756
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 10191
diff changeset
84 syn region bibMath contained start=/\(\\\)\@<!\$/ end=/\$/ skip=/\(\\\$\)/
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 syn region bibQuote contained start=/"/ end=/"/ skip=/\(\\"\)/ contains=@bibVarContents
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 syn region bibBrace contained start=/{/ end=/}/ skip=/\(\\[{}]\)/ contains=@bibVarContents
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 syn region bibParen contained start=/(/ end=/)/ skip=/\(\\[()]\)/ contains=@bibVarContents
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 syn region bibField contained start="\S\+\s*=\s*" end=/[}),]/me=e-1 contains=bibEntryKw,bibNSEntryKw,bibBrace,bibParen,bibQuote,bibVariable
12756
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 10191
diff changeset
89 syn region bibEntryData contained start=/[{(]/ms=e+1 end=/[})]/me=e-1 contains=bibKey,bibField,bibComment3
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 " Actually, 5.8 <= Vim < 6.0 would ignore the `fold' keyword anyway, but Vim<5.8 would produce
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 " an error, so we explicitly distinguish versions with and without folding functionality:
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 9227
diff changeset
92 syn region bibEntry start=/@\S\+\s*[{(]/ end=/^\s*[})]/ transparent fold contains=bibType,bibEntryData nextgroup=bibComment
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 484
diff changeset
93 syn region bibComment2 start=/@Comment\s*[{(]/ end=/^\s*[})]/me=e-1 contains=@bibCommentContents nextgroup=bibEntry
12756
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 10191
diff changeset
94 " biblatex style comments inside a bibEntry
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 10191
diff changeset
95 syn match bibComment3 "%.*"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 " Synchronization
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 " ===============
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 syn sync match All grouphere bibEntry /^\s*@/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 syn sync maxlines=200
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 syn sync minlines=50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 " Highlighting defaults
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 " =====================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 " Define the default highlighting.
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 9227
diff changeset
106 " Only when an item doesn't have highlighting yet
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 9227
diff changeset
107
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
108 hi def link bibType Identifier
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
109 hi def link bibEntryKw Statement
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
110 hi def link bibNSEntryKw PreProc
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
111 hi def link bibKey Special
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
112 hi def link bibVariable Constant
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
113 hi def link bibUnescapedSpecial Error
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
114 hi def link bibComment Comment
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
115 hi def link bibComment2 Comment
12756
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 10191
diff changeset
116 hi def link bibComment3 Comment
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 let b:current_syntax = "bib"
3237
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
119
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
120 let &cpo = s:cpo_save
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
121 unlet s:cpo_save