annotate runtime/syntax/bib.vim @ 2589:d5681bd2661b v7.3.013

updated for version 7.3.013 Problem: Dynamic loading with Ruby doesn't work for 1.9.2. Solution: Handle rb_str2cstr differently. Also support dynamic loading on Unix. (Jon Maken)
author Bram Moolenaar <bram@vim.org>
date Wed, 29 Sep 2010 13:02:53 +0200
parents f012c4ed8c38
children fd09a9c8468e
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
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 7
diff changeset
5 " Last Change: Aug 02, 2005
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 " ==============
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 " For version 5.x: Clear all syntax items
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 " For version 6.x: Quit when a syntax file was already loaded
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 if version < 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 syntax clear
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 elseif exists("b:current_syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 syn keyword bibType contained string
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 " Non-standard:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 syn keyword bibNSEntryKw contained abstract isbn issn keywords url
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 " Clusters
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 " ========
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 syn cluster bibVarContents contains=bibUnescapedSpecial,bibBrace,bibParen
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 " This cluster is empty but things can be added externally:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 "syn cluster bibCommentContents
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 " Matches
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 " =======
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 syn match bibUnescapedSpecial contained /[^\\][%&]/hs=s+1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 syn match bibKey contained /\s*[^ \t}="]\+,/hs=s,he=e-1 nextgroup=bibField
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 syn match bibVariable contained /[^{}," \t=]/
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 7
diff changeset
49 syn region bibComment start=/./ end=/^\s*@/me=e-1 contains=@bibCommentContents nextgroup=bibEntry
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 syn region bibQuote contained start=/"/ end=/"/ skip=/\(\\"\)/ contains=@bibVarContents
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 syn region bibBrace contained start=/{/ end=/}/ skip=/\(\\[{}]\)/ contains=@bibVarContents
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 syn region bibParen contained start=/(/ end=/)/ skip=/\(\\[()]\)/ contains=@bibVarContents
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 syn region bibField contained start="\S\+\s*=\s*" end=/[}),]/me=e-1 contains=bibEntryKw,bibNSEntryKw,bibBrace,bibParen,bibQuote,bibVariable
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 syn region bibEntryData contained start=/[{(]/ms=e+1 end=/[})]/me=e-1 contains=bibKey,bibField
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 " 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
56 " an error, so we explicitly distinguish versions with and without folding functionality:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 if version < 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 syn region bibEntry start=/@\S\+[{(]/ end=/^\s*[})]/ transparent contains=bibType,bibEntryData nextgroup=bibComment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 syn region bibEntry start=/@\S\+[{(]/ end=/^\s*[})]/ transparent fold contains=bibType,bibEntryData nextgroup=bibComment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 7
diff changeset
62 syn region bibComment2 start=/@Comment[{(]/ end=/^\s*@/me=e-1 contains=@bibCommentContents nextgroup=bibEntry
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 " Synchronization
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 " ===============
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 syn sync match All grouphere bibEntry /^\s*@/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 syn sync maxlines=200
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 syn sync minlines=50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 " Highlighting defaults
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 " =====================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 " Define the default highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 " For version 5.7 and earlier: only when not done already
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 " For version 5.8 and later: only when an item doesn't have highlighting yet
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 if version >= 508 || !exists("did_bib_syn_inits")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 if version < 508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 let did_bib_syn_inits = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 command -nargs=+ HiLink hi link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 command -nargs=+ HiLink hi def link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 HiLink bibType Identifier
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 HiLink bibEntryKw Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 HiLink bibNSEntryKw PreProc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 HiLink bibKey Special
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 HiLink bibVariable Constant
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 HiLink bibUnescapedSpecial Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 HiLink bibComment Comment
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 7
diff changeset
89 HiLink bibComment2 Comment
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 delcommand HiLink
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 let b:current_syntax = "bib"