summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/context/data/mp.vim
blob: ef99ff726d8449809ec13b7f5138e45a9b937b42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
" Vim syntax file
" Language:	MetaPost
" Maintainer:	Andreas Scherer <andreas.scherer@pobox.com>
" Last Change:	April 30, 2001

" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
  syn clear
elseif exists("b:current_syntax")
  finish
endif

let plain_mf_macros = 0 " plain.mf has no special meaning for MetaPost
let other_mf_macros = 0 " cmbase.mf, logo.mf, ... neither

" Read the Metafont syntax to start with
if version < 600
  source <sfile>:p:h/mf.vim
else
  runtime! syntax/mf.vim
endif

unlet b:current_syntax
syn include @texTop syntax/tex.vim

" MetaPost has TeX inserts for typeset labels
" verbatimtex, btex, and etex will be treated as keywords
syn match mpTeXbegin "\(verbatimtex\|btex\)"
syn match mpTeXend "etex"
syn region mpTeXinsert start="\(verbatimtex\|btex\)"hs=e+1 end="etex"he=s-1 contains=@texTop,mpTeXbegin,mpTeXend containedin=ALL keepend
" syn region mpTeXinsert start="\(verbatimtex\|btex\)"hs=e+1 end="etex"he=s-1 contains=mpTeXbegin,mpTeXend,@texTop keepend

" MetaPost primitives not found in Metafont
syn keyword mpInternal bluepart clip color dashed fontsize greenpart infont
syn keyword mpInternal linecap linejoin llcorner lrcorner miterlimit mpxbreak
syn keyword mpInternal prologues redpart setbounds tracinglostchars
syn keyword mpInternal truecorners ulcorner urcorner withcolor

" Metafont primitives not found in MetaPost
syn keyword notDefined autorounding chardx chardy fillin granularity hppp
syn keyword notDefined proofing smoothing tracingedges tracingpens
syn keyword notDefined turningcheck vppp xoffset yoffset

" Keywords defined by plain.mp
if !exists("plain_mp_macros")
  let plain_mp_macros = 1 " Set this to '0' if your source gets too colourful
endif
if plain_mp_macros
  syn keyword mpMacro ahangle ahlength background bbox bboxmargin beginfig
  syn keyword mpMacro beveled black blue buildcycle butt center cutafter
  syn keyword mpMacro cutbefore cuttings dashpattern defaultfont defaultpen
  syn keyword mpMacro defaultscale dotlabel dotlabels drawarrow drawdblarrow
  syn keyword mpMacro drawoptions endfig evenly extra_beginfig extra_endfig
  syn keyword mpMacro green label labeloffset mitered red rounded squared
  syn keyword mpMacro thelabel white base_name base_version
  syn keyword mpMacro upto downto exitunless relax gobble gobbled
  syn keyword mpMacro interact loggingall tracingall tracingnone
  syn keyword mpMacro eps epsilon infinity right left up down origin
  syn keyword mpMacro quartercircle halfcircle fullcircle unitsquare identity
  syn keyword mpMacro blankpicture withdots ditto EOF pensquare penrazor
  syn keyword mpMacro penspeck whatever abs round ceiling byte dir unitvector
  syn keyword mpMacro inverse counterclockwise tensepath mod div dotprod
  syn keyword mpMacro takepower direction directionpoint intersectionpoint
  syn keyword mpMacro softjoin incr decr reflectedabout rotatedaround
  syn keyword mpMacro rotatedabout min max flex superellipse interpath
  syn keyword mpMacro magstep currentpen currentpen_path currentpicture
  syn keyword mpMacro fill draw filldraw drawdot unfill undraw unfilldraw
  syn keyword mpMacro undrawdot erase cutdraw image pickup numeric_pickup
  syn keyword mpMacro pen_lft pen_rt pen_top pen_bot savepen clearpen
  syn keyword mpMacro clear_pen_memory lft rt top bot ulft urt llft lrt
  syn keyword mpMacro penpos penstroke arrowhead makelabel labels penlabel
  syn keyword mpMacro range numtok thru clearxy clearit clearpen pickup
  syn keyword mpMacro shipit bye hide stop solve
endif

" Keywords defined by mfplain.mp
if !exists("mfplain_mp_macros")
  let mfplain_mp_macros = 0 " Set this to '1' to include these macro names
endif
if mfplain_mp_macros
  syn keyword mpMacro beginchar blacker capsule_def change_width
  syn keyword mpMacro define_blacker_pixels define_corrected_pixels
  syn keyword mpMacro define_good_x_pixels define_good_y_pixels
  syn keyword mpMacro define_horizontal_corrected_pixels
  syn keyword mpMacro define_pixels define_whole_blacker_pixels
  syn keyword mpMacro define_whole_vertical_blacker_pixels
  syn keyword mpMacro define_whole_vertical_pixels endchar
  syn keyword mpMacro extra_beginchar extra_endchar extra_setup
  syn keyword mpMacro font_coding_scheme font_extra_space font_identifier
  syn keyword mpMacro font_normal_shrink font_normal_space
  syn keyword mpMacro font_normal_stretch font_quad font_size
  syn keyword mpMacro font_slant font_x_height italcorr labelfont
  syn keyword mpMacro makebox makegrid maketicks mode_def mode_setup
  syn keyword mpMacro o_correction proofrule proofrulethickness rulepen smode

  " plus some no-ops, also from mfplain.mp
  syn keyword mpMacro cullit currenttransform gfcorners grayfont hround
  syn keyword mpMacro imagerules lowres_fix nodisplays notransforms openit
  syn keyword mpMacro proofoffset screenchars screenrule screenstrokes
  syn keyword mpMacro showit slantfont titlefont unitpixel vround
endif

" Keywords defined by other macro packages, e.g., boxes.mp
if !exists("other_mp_macros")
  let other_mp_macros = 1 " Set this to '0' if your source gets too colourful
endif
if other_mp_macros
  syn keyword mpMacro circmargin defaultdx defaultdy
  syn keyword mpMacro boxit boxjoin bpath circleit drawboxed drawboxes
  syn keyword mpMacro drawunboxed fixpos fixsize pic
endif

" 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_mp_syntax_inits")
  if version < 508
    let did_mp_syntax_inits = 1
    command -nargs=+ HiLink hi link <args>
  else
    command -nargs=+ HiLink hi def link <args>
  endif

"  HiLink mpTeXinsert	String
  HiLink mpTeXbegin	Statement
  HiLink mpTeXend	Statement
  HiLink mpInternal	mfInternal
  HiLink mpMacro	Macro

  delcommand HiLink
endif

let b:current_syntax = "mp"

" vim: ts=8