Start pictograms branch.
[lilypond/mpolesky.git] / vim / lilypond-syntax.vim
blobc8322f697e4808e3ed673bc3e7af782ea624dd06
1 " LilyPond syntax file
2 " Language:     LilyPond
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
11 if version < 600
12   syntax clear
13 elseif exists("b:current_syntax")
14   finish
15 endif
17 " Read the LilyPond syntax match groups: 
18 "   lilyKeyword, lilyReservedWord, lilyNote
19 if version < 600
20   so <sfile>:p:h/lilypond-words.vim
21 else
22   runtime! syntax/lilypond-words.vim
23   if exists("b:current_syntax")
24     unlet b:current_syntax
25   endif
26 endif
28 " Match also parethesis of angle type
29 setlocal mps+=<:>
31 " Case matters
32 syn case match
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")
63   if version < 508
64     let did_lily_syn_inits = 1
65     command -nargs=+ HiLink hi link <args>
66   else
67     command -nargs=+ HiLink hi def link <args>
68   endif
70   HiLink Delimiter      Identifier
71   
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
84   delcommand HiLink
85 endif
87 let b:current_syntax = "lilypond"