839
|
1 " Vim syntax file
|
28620
|
2 " Language: ChordPro 6 (https://www.chordpro.org)
|
839
|
3 " Maintainer: Niels Bo Andersen <niels@niboan.dk>
|
28620
|
4 " Last Change: 2022-04-15
|
839
|
5
|
|
6 " Quit when a syntax file was already loaded
|
|
7 if exists("b:current_syntax")
|
|
8 finish
|
|
9 endif
|
|
10
|
|
11 let s:cpo_save = &cpo
|
|
12 set cpo&vim
|
|
13
|
|
14 syn case ignore
|
|
15
|
28620
|
16 " Include embedded abc syntax
|
|
17 syn include @Abc syntax/abc.vim
|
|
18
|
|
19 " Lilypond and Pango syntaxes could be embedded as well, but they are not
|
|
20 " available in the distribution.
|
839
|
21
|
28620
|
22 " Directives without arguments
|
|
23 syn keyword chordproDirective contained nextgroup=chordproConditional
|
|
24 \ new_song ns
|
|
25 \ start_of_chorus soc
|
|
26 \ chorus
|
|
27 \ start_of_verse sov
|
|
28 \ start_of_bridge sob
|
|
29 \ start_of_tab sot
|
|
30 \ start_of_grid sog
|
|
31 \ start_of_abc
|
|
32 \ start_of_ly
|
|
33 \ end_of_chorus eoc
|
|
34 \ end_of_verse eov
|
|
35 \ end_of_bridge eob
|
|
36 \ end_of_tab eot
|
|
37 \ end_of_grid eog
|
|
38 \ end_of_abc
|
|
39 \ end_of_ly
|
|
40 \ new_page np
|
|
41 \ new_physical_page npp
|
|
42 \ column_break cb
|
|
43 \ grid g
|
|
44 \ no_grid ng
|
|
45 \ transpose
|
|
46 \ chordfont cf chordsize cs chordcolour
|
|
47 \ footerfont footersize footercolour
|
|
48 \ gridfont gridsize gridcolour
|
|
49 \ tabfont tabsize tabcolour
|
|
50 \ tocfont tocsize toccolour
|
|
51 \ textfont tf textsize ts textcolour
|
|
52 \ titlefont titlesize titlecolour
|
839
|
53
|
28620
|
54 " Directives with arguments. Some directives are in both groups, as they can
|
|
55 " be used both with and without arguments
|
|
56 syn keyword chordproDirWithArg contained nextgroup=chordproConditional
|
|
57 \ title t
|
|
58 \ subtitle st
|
|
59 \ sorttitle
|
|
60 \ artist
|
|
61 \ composer
|
|
62 \ lyricist
|
|
63 \ arranger
|
|
64 \ copyright
|
|
65 \ album
|
|
66 \ year
|
|
67 \ key
|
|
68 \ time
|
|
69 \ tempo
|
|
70 \ duration
|
|
71 \ capo
|
|
72 \ comment c
|
|
73 \ highlight
|
|
74 \ comment_italic ci
|
|
75 \ comment_box cb
|
|
76 \ image
|
|
77 \ start_of_chorus soc
|
|
78 \ chorus
|
|
79 \ start_of_verse sov
|
|
80 \ start_of_bridge sob
|
|
81 \ start_of_tab sot
|
|
82 \ start_of_grid sog
|
|
83 \ start_of_abc
|
|
84 \ start_of_ly
|
|
85 \ define
|
|
86 \ chord
|
|
87 \ transpose
|
|
88 \ chordfont cf chordsize cs chordcolour
|
|
89 \ footerfont footersize footercolour
|
|
90 \ gridfont gridsize gridcolour
|
|
91 \ tabfont tabsize tabcolour
|
|
92 \ tocfont tocsize toccolour
|
|
93 \ textfont tf textsize ts textcolour
|
|
94 \ titlefont titlesize titlecolour
|
|
95 \ pagetype
|
|
96 \ titles
|
|
97 \ columns col
|
839
|
98
|
28620
|
99 syn keyword chordproMetaKeyword contained meta
|
|
100 syn keyword chordproMetadata contained title sorttitle subtitle artist composer lyricist arranger copyright album year key time tempo duration capo
|
|
101 syn keyword chordproStandardMetadata contained songindex page pages pagerange today tuning instrument user
|
|
102 syn match chordproStandardMetadata /instrument\.type/ contained
|
|
103 syn match chordproStandardMetadata /instrument\.description/ contained
|
|
104 syn match chordproStandardMetadata /user\.name/ contained
|
|
105 syn match chordproStandardMetadata /user\.fullname/ contained
|
|
106
|
|
107 syn keyword chordproDefineKeyword contained frets fingers
|
|
108 syn match chordproDefineKeyword /base-fret/ contained
|
|
109
|
|
110 syn match chordproArgumentsNumber /\d\+/ contained
|
|
111
|
|
112 syn match chordproCustom /x_\w\+/ contained
|
839
|
113
|
28620
|
114 syn match chordproDirMatch /{\w\+\(-\w\+\)\?}/ contains=chordproDirective contained transparent
|
|
115 syn match chordproDirArgMatch /{\w\+\(-\w\+\)\?[: ]/ contains=chordproDirWithArg contained transparent
|
|
116 syn match chordproMetaMatch /{meta\(-\w\+\)\?[: ]\+\w\+/ contains=chordproMetaKeyword,chordproMetadata contained transparent
|
|
117 syn match chordproCustomMatch /{x_\w\+\(-\w\+\)\?[: ]/ contains=chordproCustom contained transparent
|
|
118
|
|
119 syn match chordproConditional /-\w\+/ contained
|
|
120
|
|
121 syn match chordproMetaDataOperator /[=|]/ contained
|
|
122 syn match chordproMetaDataValue /%{\w*/ contains=chordproMetaData,chordproStandardMetadata contained transparent
|
|
123 " Handles nested metadata tags, but the end of the containing chordproTag is
|
|
124 " not highlighted correctly, if there are more than two levels of nesting
|
|
125 syn region chordproMetaDataTag start=/%{\w*/ skip=/%{[^}]*}/ end=/}/ contains=chordproMetaDataValue,chordproMetaDataOperator,chordproMetadataTag contained
|
|
126
|
|
127 syn region chordproArguments start=/{\w\+\(-\w\+\)\?[: ]/hs=e+1 skip=/%{[^}]*}/ end=/}/he=s-1 contains=chordproDirArgMatch,chordproArgumentsNumber,chordproMetaDataTag contained
|
|
128 syn region chordproArguments start=/{\(define\|chord\)\(-\w\+\)\?[: ]/hs=e+1 end=/}/he=s-1 contains=chordproDirArgMatch,chordproDefineKeyword,chordproArgumentsNumber contained
|
|
129 syn region chordproArguments start=/{meta\(-\w\+\)\?[: ]/hs=e+1 skip=/%{[^}]*}/ end=/}/he=s-1 contains=chordproMetaMatch,chordproMetaDataTag contained
|
|
130 syn region chordproArguments start=/{x_\w\+\(-\w\+\)\?[: ]/hs=e+1 end=/}/he=s-1 contains=chordproCustomMatch contained
|
|
131
|
|
132 syn region chordproTag start=/{/ skip=/%{[^}]*}/ end=/}/ contains=chordproDirMatch,chordproArguments oneline
|
839
|
133
|
|
134 syn region chordproChord matchgroup=chordproBracket start=/\[/ end=/]/ oneline
|
|
135
|
28620
|
136 syn region chordproAnnotation matchgroup=chordproBracket start=/\[\*/ end=/]/ oneline
|
|
137
|
|
138 syn region chordproTab start=/{start_of_tab\(-\w\+\)\?\([: ].\+\)\?}\|{sot\(-\w\+\)\?\([: ].\+\)\?}/hs=e+1 end=/{end_of_tab}\|{eot}/me=s-1 contains=chordproTag,chordproComment keepend
|
839
|
139
|
28620
|
140 syn region chordproChorus start=/{start_of_chorus\(-\w\+\)\?\([: ].\+\)\?}\|{soc\(-\w\+\)\?\([: ].\+\)\?}/hs=e+1 end=/{end_of_chorus}\|{eoc}/me=s-1 contains=chordproTag,chordproChord,chordproAnnotation,chordproComment keepend
|
|
141
|
|
142 syn region chordproBridge start=/{start_of_bridge\(-\w\+\)\?\([: ].\+\)\?}\|{sob\(-\w\+\)\?\([: ].\+\)\?}/hs=e+1 end=/{end_of_bridge}\|{eob}/me=s-1 contains=chordproTag,chordproChord,chordproAnnotation,chordproComment keepend
|
|
143
|
|
144 syn region chordproAbc start=/{start_of_abc\(-\w\+\)\?\([: ].\+\)\?}/hs=e+1 end=/{end_of_abc}/me=s-1 contains=chordproTag,@Abc keepend
|
839
|
145
|
|
146 syn match chordproComment /^#.*/
|
|
147
|
|
148 " Define the default highlighting.
|
|
149 hi def link chordproDirective Statement
|
28620
|
150 hi def link chordproDirWithArg Statement
|
|
151 hi def link chordproConditional Statement
|
|
152 hi def link chordproCustom Statement
|
|
153 hi def link chordproMetaKeyword Statement
|
|
154 hi def link chordproMetaDataOperator Operator
|
|
155 hi def link chordproMetaDataTag Function
|
|
156 hi def link chordproArguments Special
|
|
157 hi def link chordproArgumentsNumber Number
|
839
|
158 hi def link chordproChord Type
|
28620
|
159 hi def link chordproAnnotation Identifier
|
839
|
160 hi def link chordproTag Constant
|
|
161 hi def link chordproTab PreProc
|
|
162 hi def link chordproComment Comment
|
|
163 hi def link chordproBracket Constant
|
28620
|
164 hi def link chordproDefineKeyword Identifier
|
|
165 hi def link chordproMetadata Identifier
|
|
166 hi def link chordproStandardMetadata Identifier
|
839
|
167 hi def chordproChorus term=bold cterm=bold gui=bold
|
28620
|
168 hi def chordproBridge term=italic cterm=italic gui=italic
|
839
|
169
|
|
170 let b:current_syntax = "chordpro"
|
|
171
|
|
172 let &cpo = s:cpo_save
|
|
173 unlet s:cpo_save
|