blob: 5ccec265085549b417387467a1f251963ae457bb [file] [log] [blame]
Bram Moolenaar57657d82006-04-21 22:12:41 +00001" Vim syntax file
2" Language: ChordPro (v. 3.6.2)
3" Maintainer: Niels Bo Andersen <niels@niboan.dk>
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00004" Last Change: 2006 Apr 30
Bram Moolenaar57657d82006-04-21 22:12:41 +00005" Remark: Requires VIM version 6.00 or greater
6
7" Quit when a syntax file was already loaded
8if exists("b:current_syntax")
9 finish
10endif
11
12let s:cpo_save = &cpo
13set cpo&vim
14
15setlocal iskeyword+=-
16
17syn case ignore
18
19syn keyword chordproDirective contained
20 \ start_of_chorus soc end_of_chorus eoc new_song ns no_grid ng grid g
21 \ new_page np new_physical_page npp start_of_tab sot end_of_tab eot
22 \ column_break colb
23
24syn keyword chordproDirWithOpt contained
25 \ comment c comment_italic ci comment_box cb title t subtitle st define
26 \ textfont textsize chordfont chordsize columns col
27
28syn keyword chordproDefineKeyword contained base-fret frets
29
30syn match chordproDirMatch /{\w*}/ contains=chordproDirective contained transparent
31syn match chordproDirOptMatch /{\w*:/ contains=chordproDirWithOpt contained transparent
32
33" Workaround for a bug in VIM 6, which causes incorrect coloring of the first {
34if version < 700
35 syn region chordproOptions start=/{\w*:/ end=/}/ contains=chordproDirOptMatch contained transparent
36 syn region chordproOptions start=/{define:/ end=/}/ contains=chordproDirOptMatch, chordproDefineKeyword contained transparent
37else
38 syn region chordproOptions start=/{\w*:/hs=e+1 end=/}/he=s-1 contains=chordproDirOptMatch contained
39 syn region chordproOptions start=/{define:/hs=e+1 end=/}/he=s-1 contains=chordproDirOptMatch, chordproDefineKeyword contained
40endif
41
42syn region chordproTag start=/{/ end=/}/ contains=chordproDirMatch,chordproOptions oneline
43
44syn region chordproChord matchgroup=chordproBracket start=/\[/ end=/]/ oneline
45
46syn region chordproTab start=/{start_of_tab}\|{sot}/hs=e+1 end=/{end_of_tab}\|{eot}/he=s-1 contains=chordproTag,chordproComment keepend
47
48syn region chordproChorus start=/{start_of_chorus}\|{soc}/hs=e+1 end=/{end_of_chorus}\|{eoc}/he=s-1 contains=chordproTag,chordproChord,chordproComment keepend
49
50syn match chordproComment /^#.*/
51
52" Define the default highlighting.
53hi def link chordproDirective Statement
54hi def link chordproDirWithOpt Statement
55hi def link chordproOptions Special
56hi def link chordproChord Type
57hi def link chordproTag Constant
58hi def link chordproTab PreProc
59hi def link chordproComment Comment
60hi def link chordproBracket Constant
61hi def link chordproDefineKeyword Type
62hi def chordproChorus term=bold cterm=bold gui=bold
63
64let b:current_syntax = "chordpro"
65
66let &cpo = s:cpo_save
67unlet s:cpo_save