2 " Language: BibTeX Bibliography Style
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.info>
5 " $Id: bst.vim,v 1.2 2007/05/05 18:24:42 vimboss Exp $
7 " For version 5.x: Clear all syntax items
8 " For version 6.x: Quit when a syntax file was already loaded
11 elseif exists("b:current_syntax")
16 command -nargs=1 SetIsk set iskeyword=<args>
18 command -nargs=1 SetIsk setlocal iskeyword=<args>
20 SetIsk 48-57,#,$,',.,A-Z,a-z
25 syn match bstString +"[^"]*\%("\|$\)+ contains=bstField,bstType,bstError
26 " Highlight the last character of an unclosed string, but only when the cursor
27 " is not beyond it (i.e., it is still being edited). Imperfect.
28 syn match bstError '[^"]\%#\@!$' contained
30 syn match bstNumber "#-\=\d\+\>"
31 syn keyword bstNumber entry.max$ global.max$
32 syn match bstComment "%.*"
34 syn keyword bstCommand ENTRY FUNCTION INTEGERS MACRO STRINGS
35 syn keyword bstCommand READ EXECUTE ITERATE REVERSE SORT
36 syn match bstBuiltIn "\s[-<>=+*]\|\s:="
37 syn keyword bstBuiltIn add.period$
38 syn keyword bstBuiltIn call.type$ change.case$ chr.to.int$ cite$
39 syn keyword bstBuiltIn duplicate$ empty$ format.name$
40 syn keyword bstBuiltIn if$ int.to.chr$ int.to.str$
41 syn keyword bstBuiltIn missing$
42 syn keyword bstBuiltIn newline$ num.names$
43 syn keyword bstBuiltIn pop$ preamble$ purify$ quote$
44 syn keyword bstBuiltIn skip$ stack$ substring$ swap$
45 syn keyword bstBuiltIn text.length$ text.prefix$ top$ type$
46 syn keyword bstBuiltIn warning$ while$ width$ write$
47 syn match bstIdentifier "'\k*"
48 syn keyword bstType article book booklet conference
49 syn keyword bstType inbook incollection inproceedings
50 syn keyword bstType manual mastersthesis misc
51 syn keyword bstType phdthesis proceedings
52 syn keyword bstType techreport unpublished
53 syn keyword bstField abbr address annote author
54 syn keyword bstField booktitle chapter crossref comment
55 syn keyword bstField edition editor
56 syn keyword bstField howpublished institution journal key month
57 syn keyword bstField note number
58 syn keyword bstField organization
59 syn keyword bstField pages publisher
60 syn keyword bstField school series
61 syn keyword bstField title type
62 syn keyword bstField volume year
64 " Define the default highlighting.
65 " For version 5.7 and earlier: only when not done already
66 " For version 5.8 and later: only when an item doesn't have highlighting yet
67 if version >= 508 || !exists("did_bst_syn_inits")
69 let did_bst_syn_inits = 1
70 command -nargs=+ HiLink hi link <args>
72 command -nargs=+ HiLink hi def link <args>
75 HiLink bstComment Comment
76 HiLink bstString String
77 HiLink bstCommand PreProc
78 HiLink bstBuiltIn Statement
79 HiLink bstField Special
80 HiLink bstNumber Number
82 HiLink bstIdentifier Identifier
87 let b:current_syntax = "bst"
89 " vim:set ft=vim sts=4 sw=4: