ft_mp.txt ForVim version 9.2. Last change: 2026 Feb 14Thisis the documentation for the METAFONT and MetaPostfiletype plugins.Unless otherwise specified, the commands, settings and mappings defined belowapply equally to both filetypes.NOTE: theplugin requires+vim9script.==============================================================================CONTENTSmp.vimft-metapostmf.vimft-metafont1. Introductionft-metapost-intro2. Commandsft-metapost-commands3. Settingsft-metapost-settings4. Mappingsft-metapost-mappings==============================================================================ft-metapost-introft-metafont-introIntroductionThisfiletypeplugin provides extensive support for editing METAFONT andMetaPost documents, includingsyntax coloring, indentation, and completion.Defining indentation rules for METAFONT and MetaPost codeis tricky andsomewhat subjective, because thesyntaxis quite liberal. Theplugin uses someheuristics that work well most of the time, but in particular cases you maywant to to override the automatic rules, so that the manually definedindentationis preserved by commands likegg=G.This can be achieved by appending%>,%<,%= or%! toa line toexplicitlycontrol the indentation of the next line. The< and> symbolsmay be repeated many times: for instance,%>> will cause the next line to beindented twice. Of course,%< means that the next line should bede-indented;%= sets the indentation of the next line to be equal to theindentation of the current line; and%! means that the indentation of thenext line should not change from whateverit has been manually set.For example, thisis the default indentation ofa simple macro:def foo = makepen( subpath(T-n,t) of r shifted .5down --subpath(t,T) of r shifted .5up -- cycle ) withcolor blackenddefBy adding the special comments, the indentation can be adjusted arbitrarily:def foo = makepen( subpath(T-n,t) of r %> shifted .5down %> --subpath(t,T) of r shifted .5up -- cycle %<<< ) withcolor blackenddefft-metapost-commandsCommands:FixBeginfigsRenumber beginfig() blocks in the current buffer so that the n-th figure hasnumber n. MetaPost only.ft-metapost-settingsft-metafont-settingsSettings'g:mf_other_macros'Highlight some other basicmacro names, e.g., from cmbase, logo, etc. Thisisset to 1 by default in METAFONT buffers, anditis set to0 by default inMetaPost buffers.'g:mf_plain_macros'Highlight keywords defined by plain.mf. Thisis set to 1 by default inMETAFONT buffers, anditis set to0 by default in MetaPost buffers.'g:mf_plain_modes'Highlight keywords defined by modes.mf. Thisis set to 1 by default inMETAFONT buffers, anditis set to0 by default in MetaPost buffers.'g:mp_close_tag'Define additional keywords thatend indented blocks. For instance, if youdefine:g:mp_close_tag = ['\<endfoo\>']any linestarting withendfoo will be de-indented compared to its previousline.g:mp_close_tag = []'b:mp_metafun''g:mp_metafun'If set to 1, highlight ConTeXt's MetaFun keywords. MetaPost only.g:mp_metafun = 0'g:mp_mfplain_macros'Highlight keywords defined by mfplain.mp. MetaPost only.g:mp_mfplain_macros = 1'g:mp_open_tag'Define additional keywords that start indented blocks. For instance, if youdefine:g:mp_open_tag = ['\<beginfoo\>']the line followingbeginfoo will be indented.g:mp_open_tag = []'g:mp_other_macros'Highlight keywords defined by all basemacropackages (boxes, rboxes, format,graph, marith, sarith, string, TEX). This option affects only MetaPostbuffers.g:mp_other_macros = 1'g:mp_plain_macros'Highlight keywords defined by plain.mp. MetaPost only.g:mp_plain_macros = 1'g:no_mp_maps''g:no_mf_maps'When set,do not define anymapping inbuffers with the correspondingfiletype.g:no_mp_maps = 0g:no_mf_maps = 0ft-metapost-mappingsft-metafont-mappingsMappings]][count] vardefs, macros or figures forward.[[[count] vardefs, macros or figures backward.][[count]end of vardefs, macros or figures forward.[][count]end of vardefs, macros or figures backward.]}[count]end of blocks (fi, endfor, endgroup) forward.[{[count] begin of blocks (if, for, begingroup) backward. vim:tw=78:sw=4:ts=8:noet:ft=help:norl: