codekingpro/portable-devtools
114k
1" Vim syntax file2" Language: ChordPro 6 (https://www.chordpro.org)3" Maintainer: Niels Bo Andersen <niels@niboan.dk>4" Last Change: 2022-04-155" 2024 Dec 31: add "keys" as syntax keyword (via: https://groups.google.com/g/vim_dev/c/vP4epus0euM/m/mNoDY6hsCQAJ)6 7" Quit when a syntax file was already loaded8if exists("b:current_syntax")9 finish10endif11 12let s:cpo_save = &cpo13set cpo&vim14 15syn case ignore16 17" Include embedded abc syntax18syn include @Abc syntax/abc.vim19 20" Lilypond and Pango syntaxes could be embedded as well, but they are not21" available in the distribution.22 23" Directives without arguments24syn keyword chordproDirective contained nextgroup=chordproConditional25 \ new_song ns26 \ start_of_chorus soc27 \ chorus28 \ start_of_verse sov29 \ start_of_bridge sob30 \ start_of_tab sot31 \ start_of_grid sog32 \ start_of_abc33 \ start_of_ly34 \ end_of_chorus eoc35 \ end_of_verse eov36 \ end_of_bridge eob37 \ end_of_tab eot38 \ end_of_grid eog39 \ end_of_abc40 \ end_of_ly41 \ new_page np42 \ new_physical_page npp43 \ column_break cb44 \ grid g45 \ no_grid ng46 \ transpose47 \ chordfont cf chordsize cs chordcolour48 \ footerfont footersize footercolour49 \ gridfont gridsize gridcolour50 \ tabfont tabsize tabcolour51 \ tocfont tocsize toccolour52 \ textfont tf textsize ts textcolour53 \ titlefont titlesize titlecolour54 55" Directives with arguments. Some directives are in both groups, as they can56" be used both with and without arguments57syn keyword chordproDirWithArg contained nextgroup=chordproConditional58 \ title t59 \ subtitle st60 \ sorttitle61 \ artist62 \ composer63 \ lyricist64 \ arranger65 \ copyright66 \ album67 \ year68 \ key69 \ time70 \ tempo71 \ duration72 \ capo73 \ comment c74 \ highlight75 \ comment_italic ci76 \ comment_box cb77 \ image78 \ start_of_chorus soc79 \ chorus80 \ start_of_verse sov81 \ start_of_bridge sob82 \ start_of_tab sot83 \ start_of_grid sog84 \ start_of_abc85 \ start_of_ly86 \ define87 \ chord88 \ transpose89 \ chordfont cf chordsize cs chordcolour90 \ footerfont footersize footercolour91 \ gridfont gridsize gridcolour92 \ tabfont tabsize tabcolour93 \ tocfont tocsize toccolour94 \ textfont tf textsize ts textcolour95 \ titlefont titlesize titlecolour96 \ pagetype97 \ titles98 \ columns col99 100syn keyword chordproMetaKeyword contained meta101syn keyword chordproMetadata contained title sorttitle subtitle artist composer lyricist arranger copyright album year key time tempo duration capo102syn keyword chordproStandardMetadata contained songindex page pages pagerange today tuning instrument user103syn match chordproStandardMetadata /instrument\.type/ contained104syn match chordproStandardMetadata /instrument\.description/ contained105syn match chordproStandardMetadata /user\.name/ contained106syn match chordproStandardMetadata /user\.fullname/ contained107 108syn keyword chordproDefineKeyword contained frets fingers keys109syn match chordproDefineKeyword /base-fret/ contained110 111syn match chordproArgumentsNumber /\d\+/ contained112 113syn match chordproCustom /x_\w\+/ contained114 115syn match chordproDirMatch /{\w\+\(-\w\+\)\?}/ contains=chordproDirective contained transparent116syn match chordproDirArgMatch /{\w\+\(-\w\+\)\?[: ]/ contains=chordproDirWithArg contained transparent117syn match chordproMetaMatch /{meta\(-\w\+\)\?[: ]\+\w\+/ contains=chordproMetaKeyword,chordproMetadata contained transparent118syn match chordproCustomMatch /{x_\w\+\(-\w\+\)\?[: ]/ contains=chordproCustom contained transparent119 120syn match chordproConditional /-\w\+/ contained121 122syn match chordproMetaDataOperator /[=|]/ contained123syn match chordproMetaDataValue /%{\w*/ contains=chordproMetaData,chordproStandardMetadata contained transparent124" Handles nested metadata tags, but the end of the containing chordproTag is125" not highlighted correctly, if there are more than two levels of nesting126syn region chordproMetaDataTag start=/%{\w*/ skip=/%{[^}]*}/ end=/}/ contains=chordproMetaDataValue,chordproMetaDataOperator,chordproMetadataTag contained127 128syn region chordproArguments start=/{\w\+\(-\w\+\)\?[: ]/hs=e+1 skip=/%{[^}]*}/ end=/}/he=s-1 contains=chordproDirArgMatch,chordproArgumentsNumber,chordproMetaDataTag contained129syn region chordproArguments start=/{\(define\|chord\)\(-\w\+\)\?[: ]/hs=e+1 end=/}/he=s-1 contains=chordproDirArgMatch,chordproDefineKeyword,chordproArgumentsNumber contained130syn region chordproArguments start=/{meta\(-\w\+\)\?[: ]/hs=e+1 skip=/%{[^}]*}/ end=/}/he=s-1 contains=chordproMetaMatch,chordproMetaDataTag contained131syn region chordproArguments start=/{x_\w\+\(-\w\+\)\?[: ]/hs=e+1 end=/}/he=s-1 contains=chordproCustomMatch contained132 133syn region chordproTag start=/{/ skip=/%{[^}]*}/ end=/}/ contains=chordproDirMatch,chordproArguments oneline134 135syn region chordproChord matchgroup=chordproBracket start=/\[/ end=/]/ oneline136 137syn region chordproAnnotation matchgroup=chordproBracket start=/\[\*/ end=/]/ oneline138 139syn region chordproTab start=/{start_of_tab\(-\w\+\)\?\([: ].\+\)\?}\|{sot\(-\w\+\)\?\([: ].\+\)\?}/hs=e+1 end=/{end_of_tab}\|{eot}/me=s-1 contains=chordproTag,chordproComment keepend140 141syn 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 keepend142 143syn 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 keepend144 145syn region chordproAbc start=/{start_of_abc\(-\w\+\)\?\([: ].\+\)\?}/hs=e+1 end=/{end_of_abc}/me=s-1 contains=chordproTag,@Abc keepend146 147syn match chordproComment /^#.*/148 149" Define the default highlighting.150hi def link chordproDirective Statement151hi def link chordproDirWithArg Statement152hi def link chordproConditional Statement153hi def link chordproCustom Statement154hi def link chordproMetaKeyword Statement155hi def link chordproMetaDataOperator Operator156hi def link chordproMetaDataTag Function157hi def link chordproArguments Special158hi def link chordproArgumentsNumber Number159hi def link chordproChord Type160hi def link chordproAnnotation Identifier161hi def link chordproTag Constant162hi def link chordproTab PreProc163hi def link chordproComment Comment164hi def link chordproBracket Constant165hi def link chordproDefineKeyword Identifier166hi def link chordproMetadata Identifier167hi def link chordproStandardMetadata Identifier168hi def chordproChorus term=bold cterm=bold gui=bold169hi def chordproBridge term=italic cterm=italic gui=italic170 171let b:current_syntax = "chordpro"172 173let &cpo = s:cpo_save174unlet s:cpo_save175 