Mercurial > vim
annotate runtime/syntax/bib.vim @ 9836:bc591685594a v7.4.2193
commit https://github.com/vim/vim/commit/717e196060d946fe20bb0f0307f417dc4d0e9b17
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Aug 10 21:28:44 2016 +0200
patch 7.4.2193
Problem: With Gnome when the GUI can't start test_startup hangs.
Solution: Call gui_mch_early_init_check(). (Hirohito Higashi)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 10 Aug 2016 21:30:07 +0200 |
parents | ecb621205ed1 |
children | 43efa4f5a8ea |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: BibTeX (bibliographic database format for (La)TeX) | |
3 " Maintainer: Bernd Feige <Bernd.Feige@gmx.net> | |
4 " Filenames: *.bib | |
9227
ecb621205ed1
commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents:
5763
diff
changeset
|
5 " Last Change: 2016 May 31 |
7 | 6 |
7 " Thanks to those who pointed out problems with this file or supplied fixes! | |
8 | |
9 " Initialization | |
10 " ============== | |
11 " For version 5.x: Clear all syntax items | |
12 " For version 6.x: Quit when a syntax file was already loaded | |
13 if version < 600 | |
14 syntax clear | |
15 elseif exists("b:current_syntax") | |
16 finish | |
17 endif | |
18 | |
3237 | 19 let s:cpo_save = &cpo |
20 set cpo&vim | |
21 | |
7 | 22 " Ignore case |
23 syn case ignore | |
24 | |
25 " Keywords | |
26 " ======== | |
27 syn keyword bibType contained article book booklet conference inbook | |
28 syn keyword bibType contained incollection inproceedings manual | |
29 syn keyword bibType contained mastersthesis misc phdthesis | |
30 syn keyword bibType contained proceedings techreport unpublished | |
5763 | 31 syn keyword bibType contained string preamble |
7 | 32 |
33 syn keyword bibEntryKw contained address annote author booktitle chapter | |
34 syn keyword bibEntryKw contained crossref edition editor howpublished | |
35 syn keyword bibEntryKw contained institution journal key month note | |
36 syn keyword bibEntryKw contained number organization pages publisher | |
37 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
|
38 |
ecb621205ed1
commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents:
5763
diff
changeset
|
39 " 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
|
40 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
|
41 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
|
42 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
|
43 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
|
44 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
|
45 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
|
46 |
ecb621205ed1
commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents:
5763
diff
changeset
|
47 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
|
48 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
|
49 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
|
50 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
|
51 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
|
52 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
|
53 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
|
54 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
|
55 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
|
56 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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 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
|
67 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
|
68 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
|
69 syn keyword bibEntryKw contained primaryclass |
ecb621205ed1
commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents:
5763
diff
changeset
|
70 |
7 | 71 " Non-standard: |
2908 | 72 " AMS mref http://www.ams.org/mref |
73 syn keyword bibNSEntryKw contained mrclass mrnumber mrreviewer fjournal coden | |
7 | 74 |
75 " Clusters | |
76 " ======== | |
77 syn cluster bibVarContents contains=bibUnescapedSpecial,bibBrace,bibParen | |
78 " This cluster is empty but things can be added externally: | |
79 "syn cluster bibCommentContents | |
80 | |
81 " Matches | |
82 " ======= | |
83 syn match bibUnescapedSpecial contained /[^\\][%&]/hs=s+1 | |
84 syn match bibKey contained /\s*[^ \t}="]\+,/hs=s,he=e-1 nextgroup=bibField | |
85 syn match bibVariable contained /[^{}," \t=]/ | |
484 | 86 syn region bibComment start=/./ end=/^\s*@/me=e-1 contains=@bibCommentContents nextgroup=bibEntry |
7 | 87 syn region bibQuote contained start=/"/ end=/"/ skip=/\(\\"\)/ contains=@bibVarContents |
88 syn region bibBrace contained start=/{/ end=/}/ skip=/\(\\[{}]\)/ contains=@bibVarContents | |
89 syn region bibParen contained start=/(/ end=/)/ skip=/\(\\[()]\)/ contains=@bibVarContents | |
90 syn region bibField contained start="\S\+\s*=\s*" end=/[}),]/me=e-1 contains=bibEntryKw,bibNSEntryKw,bibBrace,bibParen,bibQuote,bibVariable | |
91 syn region bibEntryData contained start=/[{(]/ms=e+1 end=/[})]/me=e-1 contains=bibKey,bibField | |
92 " Actually, 5.8 <= Vim < 6.0 would ignore the `fold' keyword anyway, but Vim<5.8 would produce | |
93 " an error, so we explicitly distinguish versions with and without folding functionality: | |
94 if version < 600 | |
2908 | 95 syn region bibEntry start=/@\S\+\s*[{(]/ end=/^\s*[})]/ transparent contains=bibType,bibEntryData nextgroup=bibComment |
7 | 96 else |
2908 | 97 syn region bibEntry start=/@\S\+\s*[{(]/ end=/^\s*[})]/ transparent fold contains=bibType,bibEntryData nextgroup=bibComment |
7 | 98 endif |
2908 | 99 syn region bibComment2 start=/@Comment\s*[{(]/ end=/^\s*[})]/me=e-1 contains=@bibCommentContents nextgroup=bibEntry |
7 | 100 |
101 " Synchronization | |
102 " =============== | |
103 syn sync match All grouphere bibEntry /^\s*@/ | |
104 syn sync maxlines=200 | |
105 syn sync minlines=50 | |
106 | |
107 " Highlighting defaults | |
108 " ===================== | |
109 " Define the default highlighting. | |
110 " For version 5.7 and earlier: only when not done already | |
111 " For version 5.8 and later: only when an item doesn't have highlighting yet | |
112 if version >= 508 || !exists("did_bib_syn_inits") | |
113 if version < 508 | |
114 let did_bib_syn_inits = 1 | |
115 command -nargs=+ HiLink hi link <args> | |
116 else | |
117 command -nargs=+ HiLink hi def link <args> | |
118 endif | |
119 HiLink bibType Identifier | |
120 HiLink bibEntryKw Statement | |
121 HiLink bibNSEntryKw PreProc | |
122 HiLink bibKey Special | |
123 HiLink bibVariable Constant | |
124 HiLink bibUnescapedSpecial Error | |
125 HiLink bibComment Comment | |
484 | 126 HiLink bibComment2 Comment |
7 | 127 delcommand HiLink |
128 endif | |
129 | |
130 let b:current_syntax = "bib" | |
3237 | 131 |
132 let &cpo = s:cpo_save | |
133 unlet s:cpo_save |