Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 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 |
| 6 | |
| 7 | " For version 5.x: Clear all syntax items |
| 8 | " For version 6.x: Quit when a syntax file was already loaded |
| 9 | if version < 600 |
| 10 | syntax clear |
| 11 | elseif exists("b:current_syntax") |
| 12 | finish |
| 13 | endif |
| 14 | |
| 15 | " tags |
| 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 |
| 30 | syn match abcTie "-" |
| 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 "%.*$" |
| 36 | |
| 37 | |
| 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") |
| 42 | if version < 508 |
| 43 | let did_abc_syn_inits = 1 |
| 44 | command -nargs=+ HiLink hi link <args> |
| 45 | else |
| 46 | command -nargs=+ HiLink hi def link <args> |
| 47 | endif |
| 48 | |
| 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 |
| 58 | |
| 59 | delcommand HiLink |
| 60 | endif |
| 61 | |
| 62 | let b:current_syntax = "abc" |
| 63 | |
| 64 | " vim: ts=4 |