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