]> git.donarmstrong.com Git - lilypond.git/blob - vim/lilypond-syntax.vim
* GNUmakefile.in (EXTRA_DIST_FILES): remove VIM stuff.
[lilypond.git] / vim / lilypond-syntax.vim
1 " Vim syntax file
2 " Language:     LilyPond
3 " Maintainer:   Heikki Junes <hjunes@cc.hut.fi>
4 " Created:      Oct 17, 2002
5 " Last Change:  Sep 23, 2003
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 " Read the LilyPond syntax match groups: 
19 "   lilyKeyword, lilyReservedWord, lilyNote
20 if version < 600
21   so <sfile>:p:h/lilypond.words.vim
22 else
23   runtime! syntax/lilypond.words.vim
24   if exists("b:current_syntax")
25     unlet b:current_syntax
26   endif
27 endif
28
29 " Match also parethesis of angle type
30 setlocal mps+=<:>
31
32 " Case matters
33 syn case match
34
35 syn cluster lilyMatchGroup      contains=lilyMatcher,lilyString,lilyComment,lilyStatement,lilyNumber,lilyEquation,lilySlur,lilySpecial,lilyNote,lilyKeyword,lilyReservedWord
36
37 syn region lilyMatcher  matchgroup=Delimiter start="{" skip="\\\\\|\\[<>]"      end="}" contains=@lilyMatchGroup fold
38 syn region lilyMatcher  matchgroup=Delimiter start="\["         end="]" contains=@lilyMatchGroup fold
39 syn region lilyMatcher  matchgroup=Delimiter start="<" skip="\\\\\|\\[{<>}]" end=">"    contains=@lilyMatchGroup fold
40
41 syn region lilyString   start=/"/ end=/"/ skip=/\\"/
42 syn region lilyComment  start="%{" skip="%$" end="%}"
43 syn region lilyComment  start="%\([^{]\|$\)" end="$"
44
45 syn match lilyNumber    "[-_^.]\?\d\+[.]\?"
46 syn match lilyEquation  "\(#['`]\)\?\(\a*[-]\)*\a*\s*=\s*\(#[#'`]\?\)\?\a*"
47 syn match lilySlur      "[(~)]"
48 syn match lilySlur      "\\[()]"
49 syn match lilySpecial   "\\[<!>\\]"
50
51 " Rest of syntax highlighting rules start here
52 "
53 " " Define the default highlighting.
54 " " For version 5.7 and earlier: only when not done already
55 " " For version 5.8 and later: only when an item doesn't have highlighting yet
56 if version >= 508 || !exists("did_lily_syn_inits")
57   if version < 508
58     let did_lily_syn_inits = 1
59     command -nargs=+ HiLink hi link <args>
60   else
61     command -nargs=+ HiLink hi def link <args>
62   endif
63
64   HiLink Delimiter      Identifier
65   
66   HiLink lilyString     String
67   HiLink lilyComment    Comment
68  
69   HiLink lilyNote       Identifier
70   HiLink lilyKeyword    Keyword
71   HiLink lilyReservedWord       Type
72
73   HiLink lilyNumber     Constant
74   HiLink lilySpecial    Special
75   HiLink lilySlur       ModeMsg
76
77   delcommand HiLink
78 endif