2 " Language: abc music notation language
3 " Maintainer: James Allwright <J.R.Allwright@westminster.ac.uk>
4 " URL: http://perun.hscs.wmin.ac.uk/~jra/vim/syntax/abc.vim
5 " Last Change: 27th April 2001
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 syn region abcGuitarChord start=+"[A-G]+ end=+"+ contained
17 syn match abcNote "z[1-9]*[0-9]*" contained
18 syn match abcNote "z[1-9]*[0-9]*/[248]\=" contained
19 syn match abcNote "[=_\^]\{,2}[A-G],*[1-9]*[0-9]*" contained
20 syn match abcNote "[=_\^]\{,2}[A-G],*[1-9]*[0-9]*/[248]\=" contained
21 syn match abcNote "[=_\^]\{,2}[a-g]'*[1-9]*[0-9]*" contained
22 syn match abcNote "[=_\^]\{,2}[a-g]'*[1-9]*[0-9]*/[248]\=" contained
23 syn match abcBar "|" contained
24 syn match abcBar "[:|][:|]" contained
25 syn match abcBar ":|2" contained
26 syn match abcBar "|1" contained
27 syn match abcBar "\[[12]" contained
28 syn match abcTuple "([1-9]\+:\=[0-9]*:\=[0-9]*" contained
29 syn match abcBroken "<\|<<\|<<<\|>\|>>\|>>>" contained
31 syn match abcHeadField "^[A-EGHIK-TVWXZ]:.*$" contained
32 syn match abcBodyField "^[KLMPQWVw]:.*$" contained
33 syn region abcHeader start="^X:" end="^K:.*$" contained contains=abcHeadField,abcComment keepend
34 syn region abcTune start="^X:" end="^ *$" contains=abcHeader,abcComment,abcBar,abcNote,abcBodyField,abcGuitarChord,abcTuple,abcBroken,abcTie
35 syn match abcComment "%.*$"
38 " Define the default highlighting.
39 " For version 5.7 and earlier: only when not done already
40 " For version 5.8 and later: only when an item doesn't have highlighting yet
41 if version >= 508 || !exists("did_abc_syn_inits")
43 let did_abc_syn_inits = 1
44 command -nargs=+ HiLink hi link <args>
46 command -nargs=+ HiLink hi def link <args>
49 HiLink abcComment Comment
50 HiLink abcHeadField Type
51 HiLink abcBodyField Special
52 HiLink abcBar Statement
53 HiLink abcTuple Statement
54 HiLink abcBroken Statement
55 HiLink abcTie Statement
56 HiLink abcGuitarChord Identifier
57 HiLink abcNote Constant
62 let b:current_syntax = "abc"