Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: MetaPost |
| 3 | " Maintainer: Andreas Scherer <andreas.scherer@pobox.com> |
| 4 | " Last Change: April 30, 2001 |
| 5 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 6 | " quit when a syntax file was already loaded |
| 7 | if exists("b:current_syntax") |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 8 | finish |
| 9 | endif |
| 10 | |
| 11 | let plain_mf_macros = 0 " plain.mf has no special meaning for MetaPost |
| 12 | let other_mf_macros = 0 " cmbase.mf, logo.mf, ... neither |
| 13 | |
| 14 | " Read the Metafont syntax to start with |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 15 | runtime! syntax/mf.vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 16 | |
| 17 | " MetaPost has TeX inserts for typeset labels |
| 18 | " verbatimtex, btex, and etex will be treated as keywords |
| 19 | syn match mpTeXbegin "\(verbatimtex\|btex\)" |
| 20 | syn match mpTeXend "etex" |
| 21 | syn region mpTeXinsert start="\(verbatimtex\|btex\)"hs=e+1 end="etex"he=s-1 contains=mpTeXbegin,mpTeXend keepend |
| 22 | |
| 23 | " MetaPost primitives not found in Metafont |
| 24 | syn keyword mpInternal bluepart clip color dashed fontsize greenpart infont |
| 25 | syn keyword mpInternal linecap linejoin llcorner lrcorner miterlimit mpxbreak |
| 26 | syn keyword mpInternal prologues redpart setbounds tracinglostchars |
| 27 | syn keyword mpInternal truecorners ulcorner urcorner withcolor |
| 28 | |
| 29 | " Metafont primitives not found in MetaPost |
| 30 | syn keyword notDefined autorounding chardx chardy fillin granularity hppp |
| 31 | syn keyword notDefined proofing smoothing tracingedges tracingpens |
| 32 | syn keyword notDefined turningcheck vppp xoffset yoffset |
| 33 | |
| 34 | " Keywords defined by plain.mp |
| 35 | if !exists("plain_mp_macros") |
| 36 | let plain_mp_macros = 1 " Set this to '0' if your source gets too colourful |
| 37 | endif |
| 38 | if plain_mp_macros |
| 39 | syn keyword mpMacro ahangle ahlength background bbox bboxmargin beginfig |
| 40 | syn keyword mpMacro beveled black blue buildcycle butt center cutafter |
| 41 | syn keyword mpMacro cutbefore cuttings dashpattern defaultfont defaultpen |
| 42 | syn keyword mpMacro defaultscale dotlabel dotlabels drawarrow drawdblarrow |
| 43 | syn keyword mpMacro drawoptions endfig evenly extra_beginfig extra_endfig |
| 44 | syn keyword mpMacro green label labeloffset mitered red rounded squared |
| 45 | syn keyword mpMacro thelabel white base_name base_version |
| 46 | syn keyword mpMacro upto downto exitunless relax gobble gobbled |
| 47 | syn keyword mpMacro interact loggingall tracingall tracingnone |
| 48 | syn keyword mpMacro eps epsilon infinity right left up down origin |
| 49 | syn keyword mpMacro quartercircle halfcircle fullcircle unitsquare identity |
| 50 | syn keyword mpMacro blankpicture withdots ditto EOF pensquare penrazor |
| 51 | syn keyword mpMacro penspeck whatever abs round ceiling byte dir unitvector |
| 52 | syn keyword mpMacro inverse counterclockwise tensepath mod div dotprod |
| 53 | syn keyword mpMacro takepower direction directionpoint intersectionpoint |
| 54 | syn keyword mpMacro softjoin incr decr reflectedabout rotatedaround |
| 55 | syn keyword mpMacro rotatedabout min max flex superellipse interpath |
| 56 | syn keyword mpMacro magstep currentpen currentpen_path currentpicture |
| 57 | syn keyword mpMacro fill draw filldraw drawdot unfill undraw unfilldraw |
| 58 | syn keyword mpMacro undrawdot erase cutdraw image pickup numeric_pickup |
| 59 | syn keyword mpMacro pen_lft pen_rt pen_top pen_bot savepen clearpen |
| 60 | syn keyword mpMacro clear_pen_memory lft rt top bot ulft urt llft lrt |
| 61 | syn keyword mpMacro penpos penstroke arrowhead makelabel labels penlabel |
| 62 | syn keyword mpMacro range numtok thru clearxy clearit clearpen pickup |
| 63 | syn keyword mpMacro shipit bye hide stop solve |
| 64 | endif |
| 65 | |
| 66 | " Keywords defined by mfplain.mp |
| 67 | if !exists("mfplain_mp_macros") |
| 68 | let mfplain_mp_macros = 0 " Set this to '1' to include these macro names |
| 69 | endif |
| 70 | if mfplain_mp_macros |
| 71 | syn keyword mpMacro beginchar blacker capsule_def change_width |
| 72 | syn keyword mpMacro define_blacker_pixels define_corrected_pixels |
| 73 | syn keyword mpMacro define_good_x_pixels define_good_y_pixels |
| 74 | syn keyword mpMacro define_horizontal_corrected_pixels |
| 75 | syn keyword mpMacro define_pixels define_whole_blacker_pixels |
| 76 | syn keyword mpMacro define_whole_vertical_blacker_pixels |
| 77 | syn keyword mpMacro define_whole_vertical_pixels endchar |
| 78 | syn keyword mpMacro extra_beginchar extra_endchar extra_setup |
| 79 | syn keyword mpMacro font_coding_scheme font_extra_space font_identifier |
| 80 | syn keyword mpMacro font_normal_shrink font_normal_space |
| 81 | syn keyword mpMacro font_normal_stretch font_quad font_size |
| 82 | syn keyword mpMacro font_slant font_x_height italcorr labelfont |
| 83 | syn keyword mpMacro makebox makegrid maketicks mode_def mode_setup |
| 84 | syn keyword mpMacro o_correction proofrule proofrulethickness rulepen smode |
| 85 | |
| 86 | " plus some no-ops, also from mfplain.mp |
| 87 | syn keyword mpMacro cullit currenttransform gfcorners grayfont hround |
| 88 | syn keyword mpMacro imagerules lowres_fix nodisplays notransforms openit |
| 89 | syn keyword mpMacro proofoffset screenchars screenrule screenstrokes |
| 90 | syn keyword mpMacro showit slantfont titlefont unitpixel vround |
| 91 | endif |
| 92 | |
| 93 | " Keywords defined by other macro packages, e.g., boxes.mp |
| 94 | if !exists("other_mp_macros") |
| 95 | let other_mp_macros = 1 " Set this to '0' if your source gets too colourful |
| 96 | endif |
| 97 | if other_mp_macros |
| 98 | syn keyword mpMacro circmargin defaultdx defaultdy |
| 99 | syn keyword mpMacro boxit boxjoin bpath circleit drawboxed drawboxes |
| 100 | syn keyword mpMacro drawunboxed fixpos fixsize pic |
| 101 | endif |
| 102 | |
| 103 | " Define the default highlighting |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 104 | " Only when an item doesn't have highlighting yet |
| 105 | command -nargs=+ HiLink hi def link <args> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 106 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 107 | HiLink mpTeXinsert String |
| 108 | HiLink mpTeXbegin Statement |
| 109 | HiLink mpTeXend Statement |
| 110 | HiLink mpInternal mfInternal |
| 111 | HiLink mpMacro Macro |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 112 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 113 | delcommand HiLink |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 114 | |
| 115 | let b:current_syntax = "mp" |
| 116 | |
| 117 | " vim: ts=8 |