3 " Maintainer: Heikki Junes <hjunes@cc.hut.fi>
4 " Created: Oct 17, 2002
5 " Last Change: Sep 23, 2003
8 " Installed As: vim/syntax/lilypond.vim
9 " Uses Generated File: vim/syntax/lilypond-words.vim
11 " For version 5.x: Clear all syntax items
12 " For version 6.x: Quit when a syntax file was already loaded
15 elseif exists("b:current_syntax")
19 " Read the LilyPond syntax match groups:
20 " lilyKeyword, lilyReservedWord, lilyNote
22 so <sfile>:p:h/lilypond-words.vim
24 runtime! syntax/lilypond-words.vim
25 if exists("b:current_syntax")
26 unlet b:current_syntax
30 " Match also parethesis of angle type
36 syn cluster lilyMatchGroup contains=lilyMatcher,lilyString,lilyComment,lilyStatement,lilyNumber,lilyEquation,lilySlur,lilySpecial,lilyNote,lilyKeyword,lilyArticulation,lilyReservedWord
38 syn region lilyMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[<>]" end="}" contains=@lilyMatchGroup fold
39 syn region lilyMatcher matchgroup=Delimiter start="\[" end="]" contains=@lilyMatchGroup fold
40 syn region lilyMatcher matchgroup=Delimiter start="<" skip="\\\\\|\\[{<>}]" end=">" contains=@lilyMatchGroup fold
42 syn region lilyString start=/"/ end=/"/ skip=/\\"/
43 syn region lilyComment start="%{" skip="%$" end="%}"
44 syn region lilyComment start="%\([^{]\|$\)" end="$"
46 syn match lilyNumber "[-_^.]\?\d\+[.]\?"
47 syn match lilyEquation "\(#['`]\)\?\(\a*[-]\)*\a*\s*=\s*\(#[#'`]\?\)\?\a*"
48 syn match lilySlur "[(~)]"
49 syn match lilySlur "\\[()]"
50 syn match lilySpecial "\\[<!>\\]"
51 " avoid highlighting the extra character in situations like
52 " c--\mf c^^\mf c__\mf
53 syn match lilyArticulation "[-_^][-_^+|>.]"
55 " Rest of syntax highlighting rules start here
57 " " Define the default highlighting.
58 " " For version 5.7 and earlier: only when not done already
59 " " For version 5.8 and later: only when an item doesn't have highlighting yet
60 if version >= 508 || !exists("did_lily_syn_inits")
62 let did_lily_syn_inits = 1
63 command -nargs=+ HiLink hi link <args>
65 command -nargs=+ HiLink hi def link <args>
68 HiLink Delimiter Identifier
70 HiLink lilyString String
71 HiLink lilyComment Comment
73 HiLink lilyNote Identifier
74 HiLink lilyArticulation PreProc
75 HiLink lilyKeyword Keyword
76 HiLink lilyReservedWord Type
78 HiLink lilyNumber Constant
79 HiLink lilySpecial Special
80 HiLink lilySlur ModeMsg