codekingpro/portable-devtools
114k
1*ft_mp.txt* For Vim version 9.2. Last change: 2026 Feb 142 3This is the documentation for the METAFONT and MetaPost filetype plugins.4Unless otherwise specified, the commands, settings and mappings defined below5apply equally to both filetypes.6 7NOTE: the plugin requires |+vim9script|.8 9==============================================================================10CONTENTS *mp.vim* *ft-metapost*11 *mf.vim* *ft-metafont*12 131. Introduction |ft-metapost-intro|142. Commands |ft-metapost-commands|153. Settings |ft-metapost-settings|164. Mappings |ft-metapost-mappings|17 18==============================================================================19 *ft-metapost-intro*20 *ft-metafont-intro*21Introduction ~22This filetype plugin provides extensive support for editing METAFONT and23MetaPost documents, including syntax coloring, indentation, and completion.24 25Defining indentation rules for METAFONT and MetaPost code is tricky and26somewhat subjective, because the syntax is quite liberal. The plugin uses some27heuristics that work well most of the time, but in particular cases you may28want to to override the automatic rules, so that the manually defined29indentation is preserved by commands like `gg=G`.30 31This can be achieved by appending `%>`, `%<`, `%=` or `%!` to a line to32explicitly control the indentation of the next line. The `<` and `>` symbols33may be repeated many times: for instance, `%>>` will cause the next line to be34indented twice. Of course, `%<` means that the next line should be35de-indented; `%=` sets the indentation of the next line to be equal to the36indentation of the current line; and `%!` means that the indentation of the37next line should not change from whatever it has been manually set.38 39For example, this is the default indentation of a simple macro:40>41 def foo =42 makepen(43 subpath(T-n,t) of r44 shifted .5down45 --subpath(t,T) of r shifted .5up -- cycle46 )47 withcolor black48 enddef49<50By adding the special comments, the indentation can be adjusted arbitrarily:51>52 def foo =53 makepen(54 subpath(T-n,t) of r %>55 shifted .5down %>56 --subpath(t,T) of r shifted .5up -- cycle %<<<57 )58 withcolor black59 enddef60<61 *ft-metapost-commands*62Commands ~63 *:FixBeginfigs*64Renumber beginfig() blocks in the current buffer so that the n-th figure has65number n. MetaPost only.66 67 *ft-metapost-settings*68 *ft-metafont-settings*69Settings ~70 *'g:mf_other_macros'*71Highlight some other basic macro names, e.g., from cmbase, logo, etc. This is72set to 1 by default in METAFONT buffers, and it is set to 0 by default in73MetaPost buffers.74 75 *'g:mf_plain_macros'*76Highlight keywords defined by plain.mf. This is set to 1 by default in77METAFONT buffers, and it is set to 0 by default in MetaPost buffers.78 79 *'g:mf_plain_modes'*80Highlight keywords defined by modes.mf. This is set to 1 by default in81METAFONT buffers, and it is set to 0 by default in MetaPost buffers.82 83 *'g:mp_close_tag'*84Define additional keywords that end indented blocks. For instance, if you85define:86>87 g:mp_close_tag = ['\<endfoo\>']88<89any line starting with `endfoo` will be de-indented compared to its previous90line.91>92 g:mp_close_tag = []93<94 *'b:mp_metafun'*95 *'g:mp_metafun'*96If set to 1, highlight ConTeXt's MetaFun keywords. MetaPost only.97>98 g:mp_metafun = 099<100 *'g:mp_mfplain_macros'*101Highlight keywords defined by mfplain.mp. MetaPost only.102>103 g:mp_mfplain_macros = 1104<105 *'g:mp_open_tag'*106Define additional keywords that start indented blocks. For instance, if you107define:108>109 g:mp_open_tag = ['\<beginfoo\>']110<111the line following `beginfoo` will be indented.112>113 g:mp_open_tag = []114<115 *'g:mp_other_macros'*116Highlight keywords defined by all base macro packages (boxes, rboxes, format,117graph, marith, sarith, string, TEX). This option affects only MetaPost118buffers.119>120 g:mp_other_macros = 1121<122 *'g:mp_plain_macros'*123Highlight keywords defined by plain.mp. MetaPost only.124>125 g:mp_plain_macros = 1126<127 *'g:no_mp_maps'*128 *'g:no_mf_maps'*129When set, do not define any mapping in buffers with the corresponding130filetype.131>132 g:no_mp_maps = 0133 g:no_mf_maps = 0134<135 *ft-metapost-mappings*136 *ft-metafont-mappings*137Mappings ~138 139]] [count] vardefs, macros or figures forward.140 141[[ [count] vardefs, macros or figures backward.142 143][ [count] end of vardefs, macros or figures forward.144 145[] [count] end of vardefs, macros or figures backward.146 147]} [count] end of blocks (fi, endfor, endgroup) forward.148 149[{ [count] begin of blocks (if, for, begingroup) backward.150 151 vim:tw=78:sw=4:ts=8:noet:ft=help:norl:152 