From 86721731c740d0ea07e6b90e601a80770c3d9f36 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 5 Mar 2019 09:34:59 +0100 Subject: [PATCH] Add lilypond support, closes #278 --- README.md | 3 +- build | 1 + compiler/lilypond.vim | 23 ++++++++++ ftdetect/polyglot.vim | 10 +++++ ftplugin/lilypond.vim | 61 ++++++++++++++++++++++++++ indent/lilypond.vim | 64 +++++++++++++++++++++++++++ syntax/lilypond-words.vim | 7 +++ syntax/lilypond.vim | 91 +++++++++++++++++++++++++++++++++++++++ 8 files changed, 259 insertions(+), 1 deletion(-) create mode 100644 compiler/lilypond.vim create mode 100644 ftplugin/lilypond.vim create mode 100644 indent/lilypond.vim create mode 100644 syntax/lilypond-words.vim create mode 100644 syntax/lilypond.vim diff --git a/README.md b/README.md index 86a4159..eefb9ee 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ A collection of language packs for Vim. > One to rule them all, one to find them, one to bring them all and in the darkness bind them. - It **won't affect your startup time**, as scripts are loaded only on demand\*. -- It **installs and updates 100+ times faster** than the 128 packages it consists of. +- It **installs and updates 100+ times faster** than the 129 packages it consists of. - Solid syntax and indentation support (other features skipped). Only the best language packs. - All unnecessary files are ignored (like enormous documentation from php support). - No support for esoteric languages, only most popular ones (modern too, like `slim`). @@ -103,6 +103,7 @@ If you need full functionality of any plugin, please use it directly with your p - [kotlin](https://github.com/udalov/kotlin-vim) (syntax, indent, ftplugin) - [latex](https://github.com/LaTeX-Box-Team/LaTeX-Box) (syntax, indent, ftplugin) - [less](https://github.com/groenewege/vim-less) (syntax, indent, ftplugin) +- [lilypond](https://github.com/anowlcalledjosh/vim-lilypond) (syntax, indent, compiler, ftplugin) - [liquid](https://github.com/tpope/vim-liquid) (syntax, indent, ftplugin) - [livescript](https://github.com/gkz/vim-ls) (syntax, indent, compiler, ftplugin) - [lua](https://github.com/tbastos/vim-lua) (syntax, indent) diff --git a/build b/build index 597846c..8de0a45 100755 --- a/build +++ b/build @@ -212,6 +212,7 @@ PACKS=" latex:LaTeX-Box-Team/LaTeX-Box less:groenewege/vim-less liquid:tpope/vim-liquid + lilypond:anowlcalledjosh/vim-lilypond livescript:gkz/vim-ls lua:tbastos/vim-lua mako:sophacles/vim-bundle-mako diff --git a/compiler/lilypond.vim b/compiler/lilypond.vim new file mode 100644 index 0000000..6d39803 --- /dev/null +++ b/compiler/lilypond.vim @@ -0,0 +1,23 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'lilypond') != -1 + finish +endif + +" LilyPond compiler file +" Language: LilyPond +" Maintainer: Heikki Junes +" Last Change: 2004 Mar 01 +" +" Installed As: vim/compiler/lilypond.vim +" +" Only load this indent file when no other was loaded. +if exists("current_compiler") + finish +endif +let current_compiler = "lilypond" + +" default make +setlocal makeprg=lilypond\ $* +" errorformat for lily (with columns) and gcc +" (how to see multiple-line error messages?) +setlocal errorformat=%f:%l:%c:\ %m,%f:%l:\ %m,In\ file\ included\ from\ %f:%l:,\^I\^Ifrom\ %f:%l%m +" diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 2113780..3ab9380 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -667,6 +667,16 @@ au BufNewFile,BufRead */templates/**.liquid,*/layout/**.liquid,*/snippets/**.liq augroup end endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'lilypond') == -1 + augroup filetypedetect + " lilypond, from lilypond.vim in anowlcalledjosh/vim-lilypond +" +" Installed As: vim/ftdetect/lilypond.vim +" +au! BufNewFile,BufRead *.ly,*.ily set ft=lilypond + augroup end +endif + if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'livescript') == -1 augroup filetypedetect " livescript, from ls.vim in gkz/vim-ls diff --git a/ftplugin/lilypond.vim b/ftplugin/lilypond.vim new file mode 100644 index 0000000..b755a6b --- /dev/null +++ b/ftplugin/lilypond.vim @@ -0,0 +1,61 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'lilypond') != -1 + finish +endif + +" LilyPond filetype plugin +" Language: LilyPond (ft=ly) +" Maintainer: Heikki Junes +" Last Change: 2010 Jul 26 +" +" Installed As: vim/ftplugin/lilypond.vim +" Uses Generated File: vim/syntax/lilypond-words.vim +" +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +setlocal autoindent +setlocal shiftwidth=2 +" +" some handy key mappings +" +" save & make and play midi with timidity +map :w:se makeprg=lilypond\ \"%<\":make:!timidity "%<.midi" +" +" save & make +map :w:se makeprg=lilypond\ \"%<\":make +" +" view ps with ghostview +map :!gv --watch "%<.ps" & +" +" prev error +map :cp +" +" next error +map :cn +" +" make +map :w:se makeprg=make\ -k:make +" +" menu +source $VIMRUNTIME/menu.vim +setlocal wildmenu +setlocal cpo-=< +setlocal wcm= +map :emenu +" +" comment region +map :g!/%.*/normal 0i% +" +" remove comments in region +map :g/%.*/normal 0x +" +" Completions in Insert/Replace-mode with +setlocal dictionary-=$VIM/syntax/lilypond-words dictionary+=$VIM/syntax/lilypond-words +setlocal complete-=k complete+=k +" +setlocal showmatch diff --git a/indent/lilypond.vim b/indent/lilypond.vim new file mode 100644 index 0000000..169a675 --- /dev/null +++ b/indent/lilypond.vim @@ -0,0 +1,64 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'lilypond') != -1 + finish +endif + +" LilyPond indent file +" Language: LilyPond +" Maintainer: Heikki Junes +" Last Change: 2010 Jul 26 +" +" Installed As: vim/indent/lilypond.vim +" +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal indentexpr=GetLilyPondIndent() +setlocal indentkeys=o,O,},>>,!^F + +" Only define the function once. +if exists("*GetLilyPondIndent") + finish +endif + +function GetLilyPondIndent() + if v:lnum == 1 + return 0 + endif + + "Find a non-blank line above the current line. + let lnum = prevnonblank(v:lnum - 1) + "Check if a block was started: '{' or '<<' is the last non-blank character of the previous line. + if getline(lnum) =~ '^.*\({\|<<\)\s*$' + let ind = indent(lnum) + &sw + else + let ind = indent(lnum) + endif + + "Check if a block was ended: '}' or '>>' is the first non-blank character of the current line. + if getline(v:lnum) =~ '^\s*\(}\|>>\)' + let ind = ind - &sw + endif + + " Check if the first character from the previous line is within + " a `lilyScheme' region, and if so, use lisp-style indentation + " for the current line. + " + " TODO: + " - Only works in version 7.1.215 or later, though it should + " silently fail in older versions. + " - We should support `lilyScheme' regions that begin in the + " middle of the line, too. + for id in synstack(lnum, 1) + if synIDattr(id, "name") == "lilyScheme" + let ind = lispindent(v:lnum) + endif + endfor + + return ind +endfunction +" +" +" diff --git a/syntax/lilypond-words.vim b/syntax/lilypond-words.vim new file mode 100644 index 0000000..6fafeae --- /dev/null +++ b/syntax/lilypond-words.vim @@ -0,0 +1,7 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'lilypond') != -1 + finish +endif + +syn match lilyKeyword "[-_^]\?\\\(xNotesOn\|xNotesOff\|xNote\|wordwrap-string-internal\|wordwrap-string\|wordwrap-lines\|wordwrap-internal\|wordwrap-field\|wordwrap\|withMusicProperty\|with-url\|with-link\|with-dimensions\|with-color\|with\|whiteout\|whiteTriangleMarkup\|walkerHeadsMinor\|walkerHeads\|vspace\|void\|voiceTwoStyle\|voiceTwo\|voiceThreeStyle\|voiceThree\|voiceOneStyle\|voiceOne\|voiceNeutralStyle\|voiceFourStyle\|voiceFour\|vocalName\|virgula\|virga\|verylongfermata\|versus\|version\|verbatim-file\|vcenter\|varcoda\|upright\|upprall\|upmordent\|upbow\|up\|unset\|unit\|unfoldRepeats\|undo\|underline\|unaCorda\|unHideNotes\|typewriter\|type\|tweak\|turn\|tupletUp\|tupletSpan\|tupletNeutral\|tupletDown\|tuplet\|trill\|triangle\|treCorde\|transposition\|transposedCueDuring\|transpose\|transparent\|translate-scaled\|translate\|topLevelAlignment\|tocTitleMarkup\|tocItemWithDotsMarkup\|tocItemMarkup\|tocItem\|tiny\|timing\|times\|timeSignatureSettings\|timeSignatureFraction\|time\|tied-lyric\|tieWaitForNote\|tieUp\|tieSolid\|tieNeutral\|tieHalfSolid\|tieHalfDashed\|tieDown\|tieDotted\|tieDashed\|tieDashPattern\|thumb\|textSpannerUp\|textSpannerNeutral\|textSpannerDown\|textLengthOn\|textLengthOff\|text\|tenuto\|temporary\|tempoWholesPerMinute\|tempo\|teeny\|tag\|table-of-contents\|tablatureFormat\|tabStaffLineLayoutFunction\|tabFullNotation\|systemStartDelimiter\|sustainOn\|sustainOff\|super\|subdivideBeams\|sub\|styledNoteHeads\|strut\|stropha\|strokeFingerOrientations\|stringTunings\|stringOneTopmost\|stringNumberOrientations\|stopped\|stopTrillSpan\|stopTextSpan\|stopStaff\|stopSlashedGraceMusic\|stopMeasureCount\|stopGroup\|stopGraceSlur\|stopGraceMusic\|stopAppoggiaturaMusic\|stopAcciaccaturaMusic\|stop\|stencil\|stemUp\|stemNeutral\|stemDown\|startTrillSpan\|startTextSpan\|startStaff\|startSlashedGraceMusic\|startRepeatType\|startMeasureCount\|startGroup\|startGraceSlur\|startGraceMusic\|startAppoggiaturaMusic\|startAcciaccaturaMusic\|start\|staccato\|staccatissimo\|squashedPosition\|spp\|spacingTweaks\|sp\|southernHarmonyHeadsMinor\|southernHarmonyHeads\|sostenutoOn\|sostenutoOff\|soloText\|soloIIText\|snappizzicato\|smaller\|smallCaps\|small\|slurUp\|slurSolid\|slurNeutral\|slurHalfSolid\|slurHalfDashed\|slurDown\|slurDotted\|slurDashed\|slurDashPattern\|slashedGrace\|slashed-digit\|slashChordSeparator\|skipTypesetting\|skip\|single\|simultaneous\|simple\|signumcongruentiae\|showStaffSwitch\|showSplitTiedTabNotes\|shortfermata\|shortVocalName\|shortInstrumentName\|shiftOnnn\|shiftOnn\|shiftOn\|shiftOff\|shiftDurations\|sharp\|shape\|sfz\|sfp\|sff\|sf\|settingsFrom\|setDefaultDurationToQuarter\|set\|sesquisharp\|sesquiflat\|sequential\|semisharp\|semiflat\|semicirculus\|semiGermanChords\|segno\|searchForVoice\|scriptDefinitions\|score\|scaleDurations\|scale\|sans\|sacredHarpHeadsMinor\|sacredHarpHeads\|rtoe\|rounded-box\|rotate\|roman\|rightHandFinger\|right-column\|right-brace\|right-align\|right\|rheel\|rfz\|revertTimeSignatureSettings\|revert\|reverseturn\|retrograde\|restrainOpenStrings\|rest-by-number\|rest\|responsum\|resetRelativeOctave\|replace\|repeatTie\|repeatCountVisibility\|repeat\|removeWithTag\|remove\|relative\|rehearsalMark\|raise\|quotedEventTypes\|quotedCueEventTypes\|quoteDuring\|quilisma\|put-adjacent\|pushToTag\|pt\|property-recursive\|printPartCombineTexts\|printKeyCancellation\|predefinedFretboardsOn\|predefinedFretboardsOff\|predefinedDiagramTable\|prallup\|prallprall\|prallmordent\|pralldown\|prall\|ppppp\|pppp\|ppp\|pp\|powerChords\|powerChordSymbol\|powerChordExceptions\|postscript\|portato\|pointAndClickTypes\|pointAndClickOn\|pointAndClickOff\|pitchedTrill\|phrygian\|phrasingSlurUp\|phrasingSlurSolid\|phrasingSlurNeutral\|phrasingSlurHalfSolid\|phrasingSlurHalfDashed\|phrasingSlurDown\|phrasingSlurDotted\|phrasingSlurDashed\|phrasingSlurDashPattern\|pes\|pedalUnaCordaStyle\|pedalUnaCordaStrings\|pedalSustainStyle\|pedalSustainStrings\|pedalSostenutoStyle\|pedalSostenutoStrings\|pattern\|path\|partialJazzMusic\|partialJazzExceptions\|partial\|partcombineUp\|partcombineUnisonoOnce\|partcombineUnisono\|partcombineSoloIOnce\|partcombineSoloIIOnce\|partcombineSoloII\|partcombineSoloI\|partcombineForce\|partcombineDown\|partcombineChordsOnce\|partcombineChords\|partcombineAutomaticOnce\|partcombineAutomatic\|partcombineApartOnce\|partcombineApart\|partcombine\|partCombineTextsOnNote\|partCombineListener\|parenthesize\|parallelMusic\|paper\|palmMuteOn\|palmMuteOff\|palmMute\|pageTurn\|pageBreak\|page-ref\|page-link\|pad-x\|pad-to-box\|pad-markup\|pad-around\|p\|overrideTimeSignatureSettings\|overrideProperty\|override-lines\|override\|oval\|ottava\|oriscus\|open\|oneVoice\|once\|on-the-fly\|omit\|offset\|octaveCheck\|numericTimeSignature\|number\|null\|notemode\|noteToFretFunction\|note-by-number\|note\|normalsize\|normal-text\|normal-size-super\|normal-size-sub\|noPageTurn\|noPageBreak\|noChordSymbol\|noBreak\|noBeam\|newSpacingSection\|new\|neumeDemoLayout\|natural\|name\|musicglyph\|musicMap\|mp\|mordent\|modalTranspose\|modalInversion\|mm\|mixolydian\|minorChordModifier\|minor\|midiInstrument\|midiChannelMapping\|midi\|middleCPosition\|middleCClefPosition\|mf\|metronomeMarkFormatter\|mergeDifferentlyHeadedOn\|mergeDifferentlyHeadedOff\|mergeDifferentlyDottedOn\|mergeDifferentlyDottedOff\|melismaEnd\|melismaBusyProperties\|melisma\|medium\|maxima\|markuplist\|markup\|markletter\|markalphabet\|markLengthOn\|markLengthOff\|markFormatter\|mark\|marcato\|map-markup-commands\|makeClusters\|majorSevenSymbol\|major\|maininput\|magnify\|lyricsto\|lyrics\|lyricmode\|lyricMelismaAlignment\|lydian\|ltoe\|lower\|lookup\|longfermata\|longa\|locrian\|localKeySignature\|lineprall\|linea\|line\|ligature\|lheel\|left-column\|left-brace\|left-align\|left\|layout\|larger\|large\|languageSaveAndChange\|languageRestore\|language\|laissezVibrer\|label\|killCues\|kievanOn\|kievanOff\|keyAlterationOrder\|key\|keepWithTag\|keepAliveInterfaces\|justify-string\|justify-field\|justify\|justified-lines\|italic\|italianChords\|ionian\|inversion\|interscoreline\|instrumentTransposition\|instrumentSwitch\|instrumentName\|instrumentEqualizer\|indent\|include\|inclinatum\|inStaffSegno\|in\|improvisationOn\|improvisationOff\|implicitTimeSignatureVisibility\|ij\|iij\|ignoreFiguredBassRest\|ignoreBarChecks\|ignatzekExceptions\|ignatzekExceptionMusic\|ictus\|huge\|hspace\|highStringOne\|hideStaffSwitch\|hideSplitTiedTabNotes\|hideNotes\|hide\|header\|hcenter-in\|hbracket\|harp-pedal\|harmonicsOn\|harmonicsOff\|harmonicNote\|harmonicByRatio\|harmonicByFret\|harmonicAccidentals\|harmonic\|handleNegativeFrets\|halign\|halfopen\|grobdescriptions\|graceSettings\|grace\|glissando\|germanChords\|general-align\|fz\|funkHeadsMinor\|funkHeads\|fullJazzExceptions\|fromproperty\|fret-diagram-verbose\|fret-diagram-terse\|fret-diagram\|frenchChords\|fraction\|fp\|footnote\|fontsize\|fontSize\|fontCaps\|flexa\|flat\|flageolet\|firstClef\|fingeringOrientations\|finger\|finalis\|filled-box\|fill-with-pattern\|fill-line\|figures\|figuremode\|figuredBassFormatter\|fffff\|ffff\|fff\|ff\|fermataMarkup\|fermata\|featherDurations\|f\|eyeglasses\|extraNatural\|explicitKeySignatureVisibility\|explicitCueClefVisibility\|explicitClefVisibility\|expandFullBarRests\|eventChords\|espressivo\|epsfile\|episemInitium\|episemFinis\|endincipit\|enddim\|enddecresc\|enddecr\|endcresc\|endcr\|endSpanners\|endRepeatType\|ellipse\|easyHeadsOn\|easyHeadsOff\|dynamicUp\|dynamicNeutral\|dynamicDown\|dynamicAbsoluteVolumeFunction\|dynamic\|drums\|drummode\|drumStyleTable\|drumPitchTable\|draw-line\|draw-hline\|draw-dotted-line\|draw-dashed-line\|draw-circle\|downprall\|downmordent\|downbow\|down\|doublesharp\|doubleflat\|doubleRepeatType\|dotsUp\|dotsNeutral\|dotsDown\|dorian\|divisioMinima\|divisioMaxima\|divisioMaior\|displayScheme\|displayMusic\|displayLilyMusic\|dir-column\|dimTextDim\|dimTextDecresc\|dimTextDecr\|dimHairpin\|dim\|description\|descendens\|deprecatedenddim\|deprecatedendcresc\|deprecateddim\|deprecatedcresc\|denies\|deminutum\|defineBarLine\|defaultchild\|defaultTimeSignature\|defaultNoteHeads\|defaultBarType\|default\|decrescendoSpanner\|decresc\|decr\|deadNotesOn\|deadNotesOff\|deadNote\|dashUnderscore\|dashPlus\|dashLarger\|dashHat\|dashDot\|dashDash\|dashBang\|cueDuringWithClef\|cueDuring\|cueClefUnset\|cueClefTranspositionFormatter\|cueClef\|crossStaff\|crescendoSpanner\|crescTextCresc\|crescHairpin\|cresc\|createSpacing\|cr\|context\|consists\|concat\|compressFullBarRests\|compoundMeter\|command-name\|combine\|column-lines\|column\|coda\|cm\|clefTranspositionFormatter\|clefTransposition\|clefPosition\|clefGlyph\|clef\|circulus\|circle\|chords\|chordmodifiers\|chordmode\|chordRootNamer\|chordPrefixSpacer\|chordNoteNamer\|chordNameSeparator\|chordNameLowercaseMinor\|chordNameFunction\|chordNameExceptionsPartial\|chordNameExceptionsFull\|chordNameExceptions\|char\|change\|center-column\|center-align\|center\|cavum\|caps\|caesura\|cadenzaOn\|cadenzaOff\|breve\|breathe\|breakDynamicSpan\|break\|bracket\|box\|bookpart\|bookOutputSuffix\|bookOutputName\|book\|bold\|blackTriangleMarkup\|bigger\|bendAfter\|beamHalfMeasure\|beam\|bassStaffProperties\|bassFigureStaffAlignmentUp\|bassFigureStaffAlignmentNeutral\|bassFigureStaffAlignmentDown\|bassFigureExtendersOn\|bassFigureExtendersOff\|barNumberVisibility\|barNumberFormatter\|barNumberCheck\|barCheckSynchronize\|barAlways\|bar\|balloonText\|balloonLengthOn\|balloonLengthOff\|balloonGrobText\|backslashed-digit\|automaticBars\|autochange\|autoCautionaries\|autoBeaming\|autoBeamOn\|autoBeamOff\|autoBeamCheck\|autoAccidentals\|auto-footnote\|augmentum\|auctum\|assertBeamSlope\|assertBeamQuant\|ascendens\|arrow-head\|arpeggioParenthesisDashed\|arpeggioParenthesis\|arpeggioNormal\|arpeggioBracket\|arpeggioArrowUp\|arpeggioArrowDown\|arpeggio\|appoggiatura\|applyOutput\|applyMusic\|applyContext\|appendToTag\|alternative\|alterBroken\|allowVoltaHook\|allowPageTurn\|alias\|aikenHeadsMinor\|aikenHeads\|afterGraceFraction\|afterGrace\|aeolian\|addlyrics\|additionalPitchPrefix\|addQuote\|addInstrumentDefinition\|accidentalStyle\|acciaccatura\|accepts\|accentus\|accent\|absolute\|abs-fontsize\|aDueText\|RemoveEmptyTabStaffContext\|RemoveEmptyStaffContext\|RemoveEmptyRhythmicStaffContext\|RemoveEmptyDrumStaffContext\|IJ\|IIJ\|C\|B\|AncientRemoveEmptyStaffContext\|A\|n\)\(\A\|\n\)"me=e-1 +syn match lilyReservedWord "\(\A\|\n\)\(warnings\|staff\|spacing\|signature\|shift\|routine\|notes\|handler\|corrected\|beams\|arpeggios\|Volta_engraver\|Voice\|Vertical_align_engraver\|Vaticana_ligature_engraver\|VaticanaVoice\|VaticanaStaff\|Tweak_engraver\|Tuplet_engraver\|Trill_spanner_engraver\|Timing_translator\|Time_signature_performer\|Time_signature_engraver\|Tie_performer\|Tie_engraver\|Text_spanner_engraver\|Text_engraver\|Tempo_performer\|Tab_tie_follow_engraver\|Tab_staff_symbol_engraver\|Tab_note_heads_engraver\|TabVoice\|TabStaff\|System_start_delimiter_engraver\|Stem_engraver\|Stanza_number_engraver\|Stanza_number_align_engraver\|Staff_symbol_engraver\|Staff_performer\|Staff_collecting_engraver\|StaffGroup\|Staff\|Spanner_break_forbid_engraver\|Span_bar_stub_engraver\|Span_bar_engraver\|Span_arpeggio_engraver\|Spacing_engraver\|Slur_performer\|Slur_engraver\|Slash_repeat_engraver\|Separating_line_group_engraver\|Script_row_engraver\|Script_engraver\|Script_column_engraver\|Score\|Rhythmic_column_engraver\|RhythmicStaff\|Rest_engraver\|Rest_collision_engraver\|Repeat_tie_engraver\|Repeat_acknowledge_engraver\|Pure_from_neighbor_engraver\|Pitched_trill_engraver\|Pitch_squash_engraver\|Piano_pedal_performer\|Piano_pedal_engraver\|Piano_pedal_align_engraver\|PianoStaff\|Phrasing_slur_engraver\|PetrucciVoice\|PetrucciStaff\|Percent_repeat_engraver\|Part_combine_engraver\|Parenthesis_engraver\|Paper_column_engraver\|Output_property_engraver\|Ottava_spanner_engraver\|NullVoice\|Note_spacing_engraver\|Note_performer\|Note_name_engraver\|Note_heads_engraver\|Note_head_line_engraver\|NoteNames\|New_fingering_engraver\|Multi_measure_rest_engraver\|Midi_control_function_performer\|Metronome_mark_engraver\|Mensural_ligature_engraver\|MensuralVoice\|MensuralStaff\|Mark_engraver\|Lyrics\|Lyric_performer\|Lyric_engraver\|Ligature_bracket_engraver\|Ledger_line_engraver\|Laissez_vibrer_engraver\|Kievan_ligature_engraver\|KievanVoice\|KievanStaff\|Key_performer\|Key_engraver\|Keep_alive_together_engraver\|Instrument_switch_engraver\|Instrument_name_engraver\|Hyphen_engraver\|Grob_pq_engraver\|GregorianTranscriptionVoice\|GregorianTranscriptionStaff\|GrandStaff\|Grace_spacing_engraver\|Grace_engraver\|Grace_beam_engraver\|Grace_auto_beam_engraver\|Global\|Glissando_engraver\|Fretboard_engraver\|FretBoards\|Forbid_line_break_engraver\|Footnote_engraver\|Font_size_engraver\|Fingering_engraver\|Fingering_column_engraver\|Figured_bass_position_engraver\|Figured_bass_engraver\|FiguredBass\|Extender_engraver\|Episema_engraver\|Dynamics\|Dynamic_performer\|Dynamic_engraver\|Dynamic_align_engraver\|Drum_notes_engraver\|Drum_note_performer\|DrumVoice\|DrumStaff\|Double_percent_repeat_engraver\|Dots_engraver\|Dot_column_engraver\|Devnull\|Default_bar_line_engraver\|Custos_engraver\|Cue_clef_engraver\|CueVoice\|Control_track_performer\|Concurrent_hairpin_engraver\|Collision_engraver\|Cluster_spanner_engraver\|Clef_engraver\|Chord_tremolo_engraver\|Chord_name_engraver\|ChordNames\|ChordNameVoice\|ChoirStaff\|Breathing_sign_engraver\|Break_align_engraver\|Bend_engraver\|Beam_performer\|Beam_engraver\|Beam_collision_engraver\|Bar_number_engraver\|Bar_engraver\|Axis_group_engraver\|Auto_beam_engraver\|Arpeggio_engraver\|Accidental_engraver\|Score\)\(\A\|\n\)"ms=s+1,me=e-1 +syn match lilyNote "\<\(\(\(solx\|soltcs\|soltcb\|solstqt\|solss\|solsqt\|solsd\|solsb\|sols\|solkk\|solk\|soldsd\|soldd\|sold\|solcs\|solcb\|solbtqt\|solbsb\|solbqt\|solbb\|solb\|sol\|six\|sitcs\|sitcb\|sistqt\|siss\|sisqt\|sisd\|sisb\|sis\|sikk\|sik\|sidsd\|sidd\|sid\|sics\|sicb\|sibtqt\|sibsb\|sibqt\|sibb\|sib\|si\|rex\|retcs\|retcb\|restqt\|ress\|resqt\|resd\|resb\|res\|rekk\|rek\|redsd\|redd\|red\|recs\|recb\|rebtqt\|rebsb\|rebqt\|rebb\|reb\|re\|mix\|mitcs\|mitcb\|mistqt\|miss\|misqt\|misd\|misb\|mis\|mikk\|mik\|midsd\|midd\|mid\|mics\|micb\|mibtqt\|mibsb\|mibqt\|mibb\|mib\|mi\|lax\|latcs\|latcb\|lastqt\|lass\|lasqt\|lasd\|lasb\|las\|lakk\|lak\|ladsd\|ladd\|lad\|lacs\|lacb\|labtqt\|labsb\|labqt\|labb\|lab\|la\|hississ\|hiss\|hisis\|hisih\|his\|hih\|hessess\|heses\|heseh\|h\|gx\|gtqs\|gtqf\|gss\|gsharpsharp\|gsharp\|gs\|gqs\|gqf\|gississ\|giss\|gisis\|gisih\|gis\|gih\|gflatflat\|gflat\|gff\|gf\|gessess\|gess\|geses\|geseh\|ges\|geh\|g\|fx\|ftqs\|ftqf\|fss\|fsharpsharp\|fsharp\|fs\|fqs\|fqf\|fississ\|fiss\|fisis\|fisih\|fis\|fih\|fflatflat\|fflat\|fff\|ff\|fessess\|fess\|feses\|feseh\|fes\|feh\|fax\|fatcs\|fatcb\|fastqt\|fass\|fasqt\|fasd\|fasb\|fas\|fakk\|fak\|fadsd\|fadd\|fad\|facs\|facb\|fabtqt\|fabsb\|fabqt\|fabb\|fab\|fa\|f\|ex\|etqs\|etqf\|essess\|ess\|esharpsharp\|esharp\|eses\|eseh\|es\|eqs\|eqf\|eississ\|eiss\|eisis\|eisih\|eis\|eih\|eflatflat\|eflat\|eff\|ef\|eessess\|eess\|eeses\|eeseh\|ees\|eeh\|e\|dx\|dtqs\|dtqf\|dss\|dsharpsharp\|dsharp\|ds\|dqs\|dqf\|dox\|dotcs\|dotcb\|dostqt\|doss\|dosqt\|dosd\|dosb\|dos\|dokk\|dok\|dodsd\|dodd\|dod\|docs\|docb\|dobtqt\|dobsb\|dobqt\|dobb\|dob\|do\|dississ\|diss\|disis\|disih\|dis\|dih\|dflatflat\|dflat\|dff\|df\|dessess\|dess\|deses\|deseh\|des\|deh\|d\|cx\|ctqs\|ctqf\|css\|csharpsharp\|csharp\|cs\|cqs\|cqf\|cississ\|ciss\|cisis\|cisih\|cis\|cih\|cflatflat\|cflat\|cff\|cf\|cessess\|cess\|ceses\|ceseh\|ces\|ceh\|c\|bx\|btqs\|btqf\|bss\|bsharpsharp\|bsharp\|bs\|bqs\|bqf\|bisis\|bisih\|bis\|bih\|bflatflat\|bflat\|bff\|bf\|bess\|beses\|beseh\|bes\|beh\|bb\|b\|ax\|atqs\|atqf\|assess\|ass\|asharpsharp\|asharp\|ases\|aseh\|asas\|asah\|as\|aqs\|aqf\|aississ\|aiss\|aisis\|aisih\|ais\|aih\|aflatflat\|aflat\|aff\|af\|aessess\|aess\|aeses\|aeseh\|aes\|aeh\|a\|a\)\([,']\)\{,4}\([?!]\)\?\)\|s\|r\|R\|q\)\(\(128\|64\|32\|16\|8\|4\|2\|1\|\\breve\|\\longa\|\\maxima\)[.]\{,8}\)\?\(\A\|\n\)"me=e-1 diff --git a/syntax/lilypond.vim b/syntax/lilypond.vim new file mode 100644 index 0000000..97f78c8 --- /dev/null +++ b/syntax/lilypond.vim @@ -0,0 +1,91 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'lilypond') != -1 + finish +endif + +" LilyPond syntax file +" Language: LilyPond +" Maintainer: Heikki Junes +" Last Change: 2010 Jul 26 +" +" Installed As: vim/syntax/lilypond.vim +" Uses Generated File: vim/syntax/lilypond-words.vim +" +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" Read the LilyPond syntax match groups: +" lilyKeyword, lilyReservedWord, lilyNote +if version < 600 + so :p:h/lilypond-words.vim +else + runtime! syntax/lilypond-words.vim + if exists("b:current_syntax") + unlet b:current_syntax + endif +endif + +" Match also parethesis of angle type +setlocal mps+=<:> + +" Case matters +syn case match + +syn cluster lilyMatchGroup contains=lilyMatcher,lilyString,lilyComment,lilyStatement,lilyNumber,lilySlur,lilySpecial,lilyNote,lilyKeyword,lilyArticulation,lilyReservedWord,lilyScheme + +syn region lilyMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[<>]" end="}" contains=@lilyMatchGroup fold +syn region lilyMatcher matchgroup=Delimiter start="\[" end="]" contains=@lilyMatchGroup fold +syn region lilyMatcher matchgroup=Delimiter start="<" skip="\\\\\|\\[{<>}]" end=">" contains=@lilyMatchGroup fold + +syn region lilyString start=/"/ end=/"/ skip=/\\"/ +syn region lilyComment start="%{" skip="%$" end="%}" +syn region lilyComment start="%\([^{]\|$\)" end="$" + +syn match lilyNumber "[-_^.]\?\d\+[.]\?" +syn match lilySlur "[(~)]" +syn match lilySlur "\\[()]" +syn match lilySpecial "\\[\\]" +" avoid highlighting the extra character in situations like +" c--\mf c^^\mf c__\mf +syn match lilyArticulation "[-_^][-_^+|>.]" + +" Include Scheme syntax highlighting, where appropriate +syn include @embeddedScheme syntax/scheme.vim +unlet b:current_syntax +syn region lilyScheme matchgroup=Delimiter start="#['`]\?(" matchgroup=Delimiter end=")" contains=@embeddedScheme + +" Rest of syntax highlighting rules start here +" +" " Define the default highlighting. +" " For version 5.7 and earlier: only when not done already +" " For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_lily_syn_inits") + if version < 508 + let did_lily_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + HiLink Delimiter Identifier + + HiLink lilyString String + HiLink lilyComment Comment + + HiLink lilyNote Identifier + HiLink lilyArticulation PreProc + HiLink lilyKeyword Keyword + HiLink lilyReservedWord Type + + HiLink lilyNumber Constant + HiLink lilySpecial Special + HiLink lilySlur ModeMsg + + delcommand HiLink +endif + +let b:current_syntax = "lilypond"