]> git.donarmstrong.com Git - lilypond.git/blob - lilypond.vim
* input/regression/chord-scripts.ly (texidoc): new file
[lilypond.git] / lilypond.vim
1 " Vim syntax file
2 " Language:     LilyPond
3 " Maintainer:   Heikki Junes <hjunes@cc.hut.fi>
4 " Created:      Oct 17, 2002
5 " Last Change:  Oct 17, 2002
6 " Version:      6.1-1
7 " Latest:
8 " http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lilypond.vim
9
10 " For version 5.x: Clear all syntax items
11 " For version 6.x: Quit when a syntax file was already loaded
12 if version < 600
13   syntax clear
14 elseif exists("b:current_syntax")
15   finish
16 endif
17
18 " Match also parethesis of angle type
19 set mps+=<:>
20
21 syn cluster lilyMatchGroup      contains=lilyMatcher,lilyString,lilyComment,lilyStatement,lilyNote,lilyNumber,lilyEquation,lilySlur,lilySpecial
22
23 syn region lilyMatcher  matchgroup=Delimiter start="{" skip="\\\\\|\\[{<>}]"    end="}" contains=@lilyMatchGroup fold
24 syn region lilyMatcher  matchgroup=Delimiter start="\["         end="]" contains=@lilyMatchGroup fold
25 syn region lilyMatcher  matchgroup=Delimiter start="<" skip="\\\\\|\\[{<>}]" end=">"    contains=@lilyMatchGroup fold
26
27 syn region lilyString   start=/"/ end=/"/ skip=/\\"/
28 syn region lilyComment  start="%{" skip="%$" end="%}"
29 syn region lilyComment  start="%\([^{]\|$\)" end="$"
30
31 syn match lilyStatement "[-_^]\?\\\a\+"
32 syn match lilyNote      "\<\(\(\(bb\|as[ae]s\|[ae]s\|eses\|[a-h]\([ei]s\)\{,2}\)\([,']\)\{,4}\([?!]\)\?\|[srR]\)\(\(128\|6\?4\|3\?2\|16\?\|8\|\\breve\)[.]*\)\?\)\(\A\|\n\)"me=e-1
33 syn match lilyNumber    "[-_^.]\?\d\+[.]\?"
34 syn match lilyEquation  "\(#['`]\)\?\(\a*[-]\)*\a*\s*=\s*\(#[#'`]\?\)\?\a*"
35 syn match lilySlur      "[(~)]"
36 syn match lilySlur      "\\[()]"
37 syn match lilySpecial   "\\[<!>\\]"
38
39 " Rest of syntax highlighting rules start here
40 "
41 " " Define the default highlighting.
42 " " For version 5.7 and earlier: only when not done already
43 " " For version 5.8 and later: only when an item doesn't have highlighting yet
44 if version >= 508 || !exists("did_lily_syn_inits")
45   if version < 508
46     let did_lily_syn_inits = 1
47     command -nargs=+ HiLink hi link <args>
48   else
49     command -nargs=+ HiLink hi def link <args>
50   endif
51
52   HiLink Delimiter      Identifier
53   
54   HiLink lilyString     String
55   HiLink lilyComment    Comment
56  
57   HiLink lilyNote       Identifier
58   HiLink lilyNumber     Constant
59   HiLink lilyStatement  Statement
60   HiLink lilySpecial    Special
61   HiLink lilySlur       ModeMsg
62
63   delcommand HiLink
64 endif