3 " Maintainer: Heikki Junes <hjunes@cc.hut.fi>
4 " Last Change: 2010 Jul 26
6 " Installed As: vim/syntax/lilypond.vim
7 " Uses Generated File: vim/syntax/lilypond-words.vim
9 " For version 5.x: Clear all syntax items
10 " For version 6.x: Quit when a syntax file was already loaded
13 elseif exists("b:current_syntax")
17 " Read the LilyPond syntax match groups:
18 " lilyKeyword, lilyReservedWord, lilyNote
20 so <sfile>:p:h/lilypond-words.vim
22 runtime! syntax/lilypond-words.vim
23 if exists("b:current_syntax")
24 unlet b:current_syntax
28 " Match also parethesis of angle type
34 syn cluster lilyMatchGroup contains=lilyMatcher,lilyString,lilyComment,lilyStatement,lilyNumber,lilySlur,lilySpecial,lilyNote,lilyKeyword,lilyArticulation,lilyReservedWord,lilyScheme
36 syn region lilyMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[<>]" end="}" contains=@lilyMatchGroup fold
37 syn region lilyMatcher matchgroup=Delimiter start="\[" end="]" contains=@lilyMatchGroup fold
38 syn region lilyMatcher matchgroup=Delimiter start="<" skip="\\\\\|\\[{<>}]" end=">" contains=@lilyMatchGroup fold
40 syn region lilyString start=/"/ end=/"/ skip=/\\"/
41 syn region lilyComment start="%{" skip="%$" end="%}"
42 syn region lilyComment start="%\([^{]\|$\)" end="$"
44 syn match lilyNumber "[-_^.]\?\d\+[.]\?"
45 syn match lilySlur "[(~)]"
46 syn match lilySlur "\\[()]"
47 syn match lilySpecial "\\[<!>\\]"
48 " avoid highlighting the extra character in situations like
49 " c--\mf c^^\mf c__\mf
50 syn match lilyArticulation "[-_^][-_^+|>.]"
52 " Include Scheme syntax highlighting, where appropriate
53 syn include @embeddedScheme syntax/scheme.vim
54 unlet b:current_syntax
55 syn region lilyScheme matchgroup=Delimiter start="#['`]\?(" matchgroup=Delimiter end=")" contains=@embeddedScheme
57 " Rest of syntax highlighting rules start here
59 " " Define the default highlighting.
60 " " For version 5.7 and earlier: only when not done already
61 " " For version 5.8 and later: only when an item doesn't have highlighting yet
62 if version >= 508 || !exists("did_lily_syn_inits")
64 let did_lily_syn_inits = 1
65 command -nargs=+ HiLink hi link <args>
67 command -nargs=+ HiLink hi def link <args>
70 HiLink Delimiter Identifier
72 HiLink lilyString String
73 HiLink lilyComment Comment
75 HiLink lilyNote Identifier
76 HiLink lilyArticulation PreProc
77 HiLink lilyKeyword Keyword
78 HiLink lilyReservedWord Type
80 HiLink lilyNumber Constant
81 HiLink lilySpecial Special
82 HiLink lilySlur ModeMsg
87 let b:current_syntax = "lilypond"